Hi. I'm new to GapiDraw and C++ and I'm trying to develop a small Space Invaders style game for my PDA.
I've written all the code and its all pretty basic and straightforward, however I have an odd bug.
Currently I have 5 classes (player, invader, player missile, enemy missile, and barrier) each of which is pretty basic and pretty much just contains its attributes and methods to draw, move, and check for collisions. If a collision occurs between a missile, invader, or player they switch to an explosion bmp for a few frames and then die... switch to a blank bitmap.
My bug is that whenever I try to instantiate more than 9 of these objects my player sprite doesn't explode properly. If i have 9 or under, the games works exactly as intended but if increase the number of invaders in my array by one, instantiate a brand new class or whatever, my player sprite gets hit by a missile and gets stuck on the explosion bmp.
The same problem also occurs to the invaders, i.e. they get stuck on their explosion sprite and dont 'die', if i reset their status and coordinates and redraw them on then screen.
I have no idea whats causing this. Is it a memory thing? Has it got anything to do with my declaring my CGapiSurfaces as attributes for each class and not using pointers to them, as someone i know suggested?
I'm totally lost - any help appreciated.
Thanks!
I've written all the code and its all pretty basic and straightforward, however I have an odd bug.
Currently I have 5 classes (player, invader, player missile, enemy missile, and barrier) each of which is pretty basic and pretty much just contains its attributes and methods to draw, move, and check for collisions. If a collision occurs between a missile, invader, or player they switch to an explosion bmp for a few frames and then die... switch to a blank bitmap.
My bug is that whenever I try to instantiate more than 9 of these objects my player sprite doesn't explode properly. If i have 9 or under, the games works exactly as intended but if increase the number of invaders in my array by one, instantiate a brand new class or whatever, my player sprite gets hit by a missile and gets stuck on the explosion bmp.
The same problem also occurs to the invaders, i.e. they get stuck on their explosion sprite and dont 'die', if i reset their status and coordinates and redraw them on then screen.
I have no idea whats causing this. Is it a memory thing? Has it got anything to do with my declaring my CGapiSurfaces as attributes for each class and not using pointers to them, as someone i know suggested?
I'm totally lost - any help appreciated.
Thanks!