How does scratch make airplane wars? Scratch aircraft war game implementation method


After learning the introductory course of scratch, you should put it into actual combat. If you want to make the game of airplane war, how to make it? Now let’s take a look at the detailed tutorial.

Software name:
Scratch3.0 offline editor v3.6.0 Chinese free installation version
Software size:
Update time:
2020-02-21Download now

Add a background first,To match the titleXiaobian added a star background

Add two more variables, named 1p score and 2p score

First, import an airplane character, and then delete the default cat character (right click), as shown in the following figure:

Then set up scripts for the aircraft: use“When you press… key”In… WASD is used to control the upper, lower, left and right sides respectively“Increase y by 10 “and” increase y by – 10 “

See the figure below:

So the script of the plane is designed

Then the script of the missile is designed. That’s the point. After importing the role of missile, design two shapes,One is the initial shape, the other is the explosive shape

The missile script is mainly to let him follow the plane,Press the j key to launchThe design is as follows:

The next step is to design airplane 2

Repeat step 3

The script of this plane is different. In order to design a game for two people, this plane is operated by mouse.

The script is designed as follows:

The script of missile 2 should also be designed. His script is as follows:

For the sake of fairness and justice of the game, several scripts should also be designed for the stage, as follows: (the script in the picture is small, designed for fun of the game, which can be deleted)

Finally, let’s test the game

matters needing attention:

The rotation mode of aircraft and missile is set to rotate left and right

The above is scratch aircraft war production tutorial, I hope you like it, please continue to pay attention to developer.

Related recommendations:

Scratch how to make space war game applet?

How to add text in scratch programming? Scratch insert text tutorial

How does scratch create multiple backgrounds? Method of multi background switch in scratch