Scratch programming Sixth Lecture-character animation _ Programming

Source: Internet
Author: User

The things you learned before are enough for you to generate a simple game.


In fact, the game consists of only a few elements:


Control-that's your reaction to the keyboard.

Logic-that's how your whole game is played.

Scoring-How to design your scoring system

Animation-How to design the image, how to let him move


We've learned how to get a character to move through a scene.


But there is something missing, that is, the characters have no expression, no action. This part is called character animation.


In scratch, it is also very easy to do.


From the very beginning of the first "story", we add the "I" role. What you may not have noticed is that the character is not static.


Click "Styling":



You'll find that the character has several shapes:



There are a total of four models, each representing 4 different movements.


We can add code to the program and switch between the four actions to complete the character animation.


We are so designed, after the male God said "not to wait for you too long, suntanned." "After that, broadcast a message called" Wait Too Long "(to create this message), like this:



Then, in the "I" character code, after receiving the "too long" message, then do the animation.



The code above says, "Switch 8 times in those shapes, 0.2 seconds at a time."


You can also adjust the interval, the smaller the interval, the faster the animation.


Let's look at the effect of this animation.



is not very interesting.

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.