🎉 Celebrating 25 Years of GameDev.net! 🎉

Not many can claim 25 years on the Internet! Join us in celebrating this milestone. Learn more about our history, and thank you for being a part of our community!

Waves and Collisions

posted in r1ckparker's Journal for project Psy
Published April 14, 2019
Advertisement

I wanted the game to have waves of enemies, where 4 or 5 of the same type will appear and move in a predictable pattern towards the player.  I placed some enemies in the stage and it was getting a bit tiresome moving them around if I wanted to move a wave to a different part of the stage.  So instead of placing every individual enemy, I created a 'lead' enemy of just 1 type.  All the enemies are flagged as inactive until they are drawn on screen.  As soon as this enemy is made active, it starts moving and animating.   I also added a spawn code to the lead enemy where it created multiples of itself and sets a speed and direction.  That way if I want to re-position an enemy on the stage, I only have to do it once and move the lead enemy.

I also started adding in a bit of collision detection, to test out the gameplay.  Each bullet fired by the enemy has a 'bounced' flag.  If it is bounced off the players shield, this flag is set.  This way, enemies don't blow each other up with their own bullets.  When a collision occurs, first I check to see if the bullet's bounced flag has been set.  If not do nothing, if yes then create an explosion and destroy the enemy.

I also have some ideas for power-ups, one will make the player move slightly faster, another makes the shield stay active for a longer time.  There's a red bar at the bottom of the screen which measures how long the shield will last.  When I get around to doing some sounds I can put in some cues which alert the player when it is low or about to run out.

 

Previous Entry Shaders
1 likes 0 comments

Comments

ongamex92

Looks nice so far! Good job! I really like that deflecting thing.

April 14, 2019 10:42 PM
r1ckparker
20 hours ago, ongamex92 said:

Looks nice so far! Good job! I really like that deflecting thing.

Thanks!

April 15, 2019 06:56 PM
You must log in to join the conversation.
Don't have a GameDev.net account? Sign up!
Advertisement
Advertisement