Home >Software Tutorial >Computer Software >How to create a plane war in Scratch How to implement the plane war mini game in Scratch

How to create a plane war in Scratch How to implement the plane war mini game in Scratch

WBOY
WBOYOriginal
2024-08-05 16:54:111048browse

Scratch Plane War Mini Game Production Guide How to build an exciting Plane War game in Scratch? PHP editor Yuzai has compiled a detailed tutorial to guide you step by step to implement this classic game. Whether you are a beginner or an experienced programmer, you can easily master the production process. Continue reading the article to learn how to implement the Scratch airplane battle mini-game, and create your own sky battle with your own hands!

Scratch How to make a plane battle Scratch plane battle mini game

Scratch怎么制作飞机大战 Scratch飞机大战小游戏的实现方法

First add a background. In order to fit the title, the editor added a star background

Scratch怎么制作飞机大战 Scratch飞机大战小游戏的实现方法

Add two more variables, variable names For: 1P score, 2P score

Scratch怎么制作飞机大战 Scratch飞机大战小游戏的实现方法
Scratch怎么制作飞机大战 Scratch飞机大战小游戏的实现方法

First, import an aircraft character, and then delete the default kitten character (right-click), as shown below:

Scratch怎么制作飞机大战 Scratch飞机大战小游戏的实现方法

Then set up the aircraft separately Script: Use "When the... key is pressed" in . . . The form uses WASD to control up, down, left and right respectively: for up and down, use "increase y coordinate by 10" and "increase y coordinate by -10"

See the picture below:

In this way, the aircraft script is designed

Scratch怎么制作飞机大战 Scratch飞机大战小游戏的实现方法

Then design the missile script. This is the point. After importing the character of the missile, design two shapes, one is the initial shape and the other is the explosion shape. The missile script mainly allows him to follow the plane and press the J key to launch, as shown in the picture:

Scratch怎么制作飞机大战 Scratch飞机大战小游戏的实现方法Next Just design airplane 2

Repeat step 3

Scratch怎么制作飞机大战 Scratch飞机大战小游戏的实现方法This airplane script is different. In order to design a two-player game, this airplane is operated with the mouse.

The script is designed as follows:

Scratch怎么制作飞机大战 Scratch飞机大战小游戏的实现方法The script of Missile 2 also needs to be designed. His script is as follows:

Scratch怎么制作飞机大战 Scratch飞机大战小游戏的实现方法In order to be fair and just in the game, several scripts are also designed for the stage, as follows: (Appearance script in the picture) Designed by the editor for the fun of the game, can be deleted)

Scratch怎么制作飞机大战 Scratch飞机大战小游戏的实现方法Finally, let’s test the game:

Scratch怎么制作飞机大战 Scratch飞机大战小游戏的实现方法
Scratch怎么制作飞机大战 Scratch飞机大战小游戏的实现方法Notes:

The rotation mode of aircraft and missiles is set to left and right rotation

上記はすべて、あなたに共有されたチュートリアルです。さらに興味深いチュートリアルは、PHP 中国語 Web サイトでご覧いただけます。

The above is the detailed content of How to create a plane war in Scratch How to implement the plane war mini game in Scratch. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn