Tank Shooter

For my final project, I decided to make a small tank game. The controls are simple. The W, A, S, and D keys move the player in two dimensions, while the mouse turns the player and clicking shoots the gun.

Capture1

The Blue tank follows the mouse, while the red enemy tanks move around and fire at the player.Capture2

There are powerups that can be collected for additional fire power or a shield to protect from enemy fire.

Capture3

There are also blockades that provide cover.

The most challenging part was to program the firing code and the angular momentum of the bullets:

 public void shoot()
{
//Shoots a Bullet based on the angle of the Player
if (Greenfoot.mouseClicked(null) || (b == true))
{
if (b == true)
{
if (timer > 0)
{
timer = timer - 1;
}
if (timer == 0)
{
b = false;
}
}
world w = (world)getWorld();
w.shoot(xpos,ypos);
}
bullet = m;
}

Leave a Reply

Your email address will not be published. Required fields are marked *