You'll find this component in the Drawing and Animation category of the Palette. Drag an ImageSprite component onto the Viewer. Instead, you'll be setting the mole's position each time the timer fires. In MoleMash, the mole has a speed zero, so it won't move by itself. Sprites can also detect when they are touched. Each sprite has a Speed and a Heading, and also an Interval that determines how often the sprite moves at its designated speed. Sprites are images that can move on the screen within a Canvas. To add the moving mole we'll use a sprite. Set its TimeInterval to 500 milliseconds to make the mole move every half second. Drag out a Clock component it will go into the non-visible components area. The firing interval is determined by the Clock 's TimerInterval property. Here, you'll use the component as a timer that fires at regular internals. The Clock component provides various operations dealing with time, like telling you what the date is. You need to arrange for the mole to jump periodically, and you'll do this with the aid of a Clock component. You'll use Noise to make the phone vibrate when the mole is hit, similar to the way you made the kitty purr in HelloPurr. Also add a Sound component and name it "Noise". Set the Text of ScoreLabel to "Score: -". Put M圜anvas on top and set its dimensions to 300 pixels wide by 300 pixels high. A Label named "ScoreLabel" that shows the score, i.e., the number of times the player has hit the mole.ĭrag these components from the Palette onto the Viewer and assign their names.Several components should be familiar from previous tutorials: Pressing restart resets the score to zero. If it is touched, the score increases by one, and the phone vibrates. You'll design the game so that the mole moves once every half-second. Open the Blocks Editor and connect to the phone.Īlso download this picture of a mole and save it on your computer. Name it "MoleMash", and also set the screen's Title to "MoleMash". (Includes VIDEO tutorial) Getting StartedĬonnect to the App Inventor web site and start a new project. View the book chapter from the App Inventor Book by Wolber, et al. This tutorial shows how to build MoleMash as an example of a simple game that uses animation. In the game MoleMash, a mole pops up at random positions on a playing field, and the player scores points by hitting the mole before it jumps away.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |