Reaching for the Star | Explanations |
There is one rabbit. There is one spinstar. The player controls the rabbit with keyboard. |
Object declaration, instantiation, and initial placement. Declaration of controlled object. |
When left arrow is pressed, the rabbit moves left. When right arrow is pressed, the rabbit moves right. When spacebar is pressed, the rabbit jumps. |
Conditional statements for describing how the rabbit is controlled. |
When the rabbit reaches the spinstar, you win. When the rabbit lands on the wall, you lose. | Conditional statements for describing gameover. |
Map: -------------------s -----------k------kkk --------------k --------k - ---k ------k - -k-------k---k - -kk--------------k - --------k----k------k ---k ----k -------k -r---k -kk-------k wwwwwwwwwwwwwwwwwwwwwww |
Click the image to try it |
Can you add a few more obstacle objects to make the game more challenging?