I’m doing some work for a class, and I’m building space invaders game in ASCII.
I know that I can do better code, using objects, but in my case I can’t use it!
I also know that I have others errors on code, but I only want to know an answer!
When I shoot (pressing space), and then I shoot again and if the first shoot isn’t collide with a alien, the first shoot just stops! and I really don’t know why!
I have comments and vars in Portuguese, but if you don’t understand something, just ask!
Code: http://pastie.org/private/fbnjo8vczkxq6quoem6tig
online: http://www.tomahock.com/Projecto-LabMM3/spaceInvaders.html
P.S. I know that isn’t the best code ever! And it is an alpha version lots to do yet!
You should maintain a list of projectiles and update the entire list each game iteration. It looks like you are only updating the current projectile, and once you shoot one it ignores all previous ones even though they should be updated. That means each iteration you must check for collisions, update location, and check for off of screen for every projectile in the list.