Advanced version of scratch programming pinball game (self-made mini game/source code sharing/course work)

Let’s take a look at the trial effect first~

 

1. Game background

The little monkey in the forest is hungry. It likes to eat bananas and apples. Go and feed it! Be careful not to hit the bat!

2. Design ideas

The theme of this game design is "Animal Keeper". The basic principle of the game is a pinball game. In order to fit the theme, the ball is changed into a fruit shape, and a small monkey character, a bat character, a score variable and a timer are added.

3. Role functions

Fruit: Bounce at random angles.

Baffle: Bounce the fruit to prevent falling.

Red bottom: If the fruit falls and hits the red bottom, the game is over.

Little monkey: The little monkey is very naughty. Although he is hungry, he still runs around. Please control the baffle to successfully feed the fruit to the little monkey. If the feeding is successful, the score is +1.

Bat: If the fruit hits the bat, the score is -1.

Score variable: Enter the second level after the score reaches 2, enter the third level after the score reaches 4, and pass the level when the score reaches 6.

Timer: Record the time required to complete the level. 

4. Source code

(1) Preliminary preparation:

  1. Select an apple character and add a banana as shape 2 in the shape of the apple, as shown in the picture.

  2. Select the background as jungle, and add two backgrounds as background 2 and background 3, as shown in the picture.

  3. Draw a red base as shown in the picture.

  4. Draw a baffle as shown.

  5. Draw a "congratulations" section as shown.

  6. Draw a "game over" tile as shown.

  7. Draw a "Click here to start again" section as shown.

  8. Draw an initial interface as shown in the figure.

  9. Add monkey and bat roles as shown in the picture.

After the preliminary preparation is completed, graphical programming is next.

(2) Source code

  1. background

  2. Apple

  3. Baffle

  4. Monkey

  5. Bat

  6. Congratulations section

  7. game over plate

  8. Initial interface

  9. "Click here to start again" module

Once the programming is complete, you try it out and adjust the parameters appropriately, the game is complete!

Guess you like

Origin blog.csdn.net/weixin_55108360/article/details/129757379