Friday, September 23, 2016

Game Development: Alien Planet - Adding Gun and Shooting Enemies, and Passing Through Gates

The player can now equip a weapon, and use it to shoot enemies. The shots are basically a sprite. A collision detection is used. If a collision happens, then the shot is removed from the sprite list. The enemy HP is decreased based on the shot attack power, and when the HP for the enemy reaches zero, then the enemy is removed from the list.

Another added feature is the use of a gate. If the player is equipped with an ID card, and he is colliding with a gate, then a check for the ID card is made. If the ID card exists, then the collision detection has no effect on the player, i.e. the player passes through the gate, otherwise, the x, and y for the player is set back to the coordinates of the previous frame. This means the player is unable to pass through the door.



video