This site requires JavaScript, please enable it in your browser!
Greenfoot back

Report as inappropriate.

Winxu1990
Winxu1990 presents ...

2015/8/3

Space Invaders Need Help!

New to Greenfoot and need some help. This is most likely a breeze for some, but I am trying to make this a completed program and can use any help possible.

Requirements:
Movement:
1. All the alien ships exhibit the same movement pattern, moving in one of three possible directions: left, right or down.
2. The aliens move as a block. The block always stays synchronized, i.e. the gaps between each alien and its neighbors remains fixed at all times.
3. The block moves in one horizontal direction, say left, till the left most alien hits the end of the screen. At this point, the whole block moves down one step and then continues to move horizontally to the right. This behavior repeats till the aliens hit the bottom of the screen or get killed. Note that as you kill off aliens on the sides of the block, the block gains more mobility since the aliens can now move farther to the left and right.
4. The aliens move in a stop and go pattern, staying stationary for some time and then moving to their next location in an instant.

Invaders:
The alien invaders come in three varieties, green, blue and pink:
Pink requires 1 hit and awards 10 points;
Blue 2 hits-20 points
Green 3 hits- 30 points
They also fire independently with a 1% probability each time act is called.

Mothership: lose a life each time hit, however you have 3 lives. Respawn at center everytime hit.

Bullets: activated by up arrow on keyboard, and gun requires small cooldown before next bullet. Holding up will provide steady stream of bullets.

Ending: after all invaders are destroyed, or you lose all 3 lives, game over is displayed.

2554 views / 523 in the last 7 days

Tags: game demo with-source

open in greenfoot
Your browser does not support the canvas tag.
danpostdanpost

2015/8/4

It appears you are calling a method from within itself which is not wise without proper precautions in making sure you stop calling it at some point. You are calling the 'atWorldEdge' method inside the 'atWorldEdge' method in the Invader class. In your case, you just should not be doing that. You may be able to call the 'isAtEdge' method inside the 'atWorldEdge' method instead.
danpostdanpost

2015/8/4

As far as those troubled classes (like the Bullet class), copy the text of the JAVA files onto your clipboard (even if you have to open the file outside of greenfoot and copy them) and then, in greenfoot, delete the class and add a new one to copy the text back into (replacing all code in the new class). You also had copied some files into the scenario folder that do not belong there. The only file types you should have are 'java', 'class' and 'ctxt'; these should be accompanied with one 'project GREENFOOT file' and one 'README Text document'. The only folders you should have are the 'images' and 'sounds' folders. Everything else should be removed.

Want to leave a comment? You must first log in.

Who likes this?

No votes yet.