Extreme Dodging | Explanations |
There are 20 rocks. There are 10 carrots. There are two spinstars near the top. There is one rabbit at the bottom. You control the rabbit with the mouse. |
Object declaration, instantiation, and initial placement. Declaration of controlled object. |
When the mouse moves, the horizontal position of the rabbit is determined. When the rabbit is empowered and spacebar is pressed, the rabbit shoots up. |
Conditional statements for describing how the rabbit is controlled. |
Rocks move down at 4 pixels per frame. When a rock reaches the bottom border, it wraps around with new x coordinate. Carrots move down. When a carrot reaches the bottom border, it wraps around with new x coordinate. The spinstars move down. When a spinstar reaches the bottom border, it wraps around with new x coordinate. |
Statements for describing how the objectss move. |
When the rabbit collides with a carrot, the carrot is eaten and score increments. When the rabbit touches a spinstar, the spinstar is eaten and the rabbit is empowered for 5 seconds. When a rock is shot, the rock explodes. |
Statements for describing the collisions. |
When the rabbit collides with a rock, the game is over. When score is 10, you win. |
Conditional statements for describing gameover. |
Map: |
Click the image to try it |
Can you add a few more obstacle objects to make the game more challenging?