"Scratch Game Programming" production "Fruit Ninja" _scratch

Source: Internet
Author: User

Teacher Dong based on the characteristics of 6-16-year-old students, writing a unique game of vegetable cutting. Children can follow the video using scratch to write their own "Fruit Ninja". Can replace the samurai and vegetables in the video to their favorite image. Well-written programs can also be saved and shared with small partners.

The production of "chopping Samurai" in the video is divided into six steps to explain.

First step

Create a background

Our "Chop warriors" need a suitable background, you can choose the same desert as the video, or you can change the selection according to your preferences.



Second Step

Add Samurai to different shapes

The design of the video is the Orange Xu Garden teacher to draw the warrior shape, if the children like this picture can be received from your teacher, you can replace the other cartoon image. For example, Donald Duck, Mickey Mouse, sheep sheep and so on.



Third Step

Writing a samurai Program

A. Using loops and judging whether the spacebar is pressed down to control the shape of the samurai

Y: The space bar is pressed: Switch warrior shape, realize samurai cut things action

N: The space bar is not pressed: then keep the original shape, the position of the mouse is the position of the samurai



Fourth Step

Import Fruit Styling

Students who watch the video will find that there is no use of fruit, the teacher here to adopt a lovely eggplant. Students can also change pictures, such as apples, bananas, strawberries are a good choice.



Fifth Step

Import sound files

Follow the steps in the video to add a vivid soundtrack to the "Cut fruit".



Sixth step

Preparing the Fruit Program

A. Cycle and determine if eggplant met Samurai brandished (must be brandished when the following code, if not brandished, even if the eggplant encounter samurai will not execute the following code)

Y: Eggplant switch into a knife cut into two halves of the shape, issue sound effects, and then use the variable record score +1, wait 0.2 seconds, then hide the cut to the eggplant, with a random number for 1-3 seconds, the use of random numbers to determine the x-coordinate eggplant, so the position of the eggplant is random, and then generate new not cut off the eggplant

B. Cycling and judging whether the eggplant is in the designated position, the samurai has not yet cut to the

Y: Hide the eggplant, the use of random numbers to determine the location of eggplant, so the position of eggplant is random, and then generated a new not cut off the eggplant



Finally, the students check your program for any missing parts and then run your program against the Complete samurai and fruit program.



We today's extracurricular small class is over, please the students continue to pay attention to Oh, next issue we will lead you to learn more wonderful interesting content.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.