I am working on my OpenGL C++ assignment to create the STARCASTLE game. Most of my code uses call to function in different classes (files) without any parameters but when I need to send parameters to other classes I cannot send the reference instead a new instance is created in teh other end.
I am doing it the following way tell me if it is right...
in StarCastle.cpp in timerFunction
Expand|Select|Wrap|Line Numbers
- ship.HandleShipPlasmaCollision(cannon)
I want to send cannon and change a variable depending on the situation in the HandleShipPlasmaCollision() function which is in SpaceShip.cpp
The function in SpaceShip.cpp is as follows:
Expand|Select|Wrap|Line Numbers
- void SpaceShip:: HandleShipPlasmaCollision(Cannon &cannon)
- {
- cannon.setFiringMode(true); /*---This effects hee but when it returns to the calling funtcion I donot get the changed value there..---*/
- }
My assignment is due tomorrow morning at 9 AM and I am stuck with this small silly problem...
Please reply soon
Thank You in advance....