I'm quite new to game programming and this forum. I use C++ and SDL as my graphics API to produce games, and so far I have 1 tic tac toe game under my belt, which I have completed about a year ago. Since then I haven't touched a single piece of code, and a week ago I started going back into it and I'm really rusty.
I decided that my next project would be a simple space shooter game clone, and I am having some problems with it. Basically, every time the player presses space-bar, I want to create a laser beam on the screen, move it all the way up with the speed determined by the laserSpeed variable, then deleting the laser once it goes off the top of the screen. I'm a little bit confused as to how I should go about doing that.
I tried various things, setting various flags, trying a bit of arrays, and I don't seem to be doing it right. Would anyone kindly point me in the right direction?
Here is the source code.
Its quite small, all I have so far is the loading/cleanup functions and 2 basic player and laser classes. The movement of the spaceship is done. If you are willing to help, the functions which would interest you are main/player::handleLogic/player::render/laser::handleLogic/laser::render.
Currently I'm going wrong on the visible and hasShot variables... feel free to delete them, they are probably utter rubbish.
I am pretty clueless as to what to try next, can anyone help a newbie out?