I will probably get condemned for switching back to c++ and opengl. I like html and css and javascript but I really enjoy working with c++ and opengl. I am not tryin g to troll. actually I have made some progress on my space invaders game. I am using sprites to draw a space ship and bullets. I have also drawn the bugs and they will disappear when they are hit by a bullet. my question is how do I erase a bug sprite and then draw another bug sprite next to it, just like in space invaders. I just want a small hint because this problem is kind of complex.
space invaders
please go easy on me people, I am trying to do my best. I have already done a pong game and a breakout game. I am practicing working with sprites.
my question is how do I erase a bug sprite and then draw another bug sprite next to it, just like in space invaders.
Every frame, only the objects you draw that frame are visible. Thus you "erase" a sprite by simply not drawing it that frame or any frames thereafter.
If you want to draw a sprite next to another sprite, take the first sprite's X coordinate, add an appropriate offset to it (say, the width of that sprite) and draw the second sprite there.
Beyond that you're going to have to post code pertaining to your specific issue if you want more specific help.
I have drawn a sprite and then next to it drawn a different sprite, I am using an array to draw the sprites and the different sprites. I have done what josh had he posted in the second paragraph. the one he has posted about drawing and "add an appropriate offset to it"
...and what is your current problem? What is the code that reproduces that problem?
Please remember my previous warnings not to turn threads into mini-blogs with nothing but updates about your progress.