yvel, the speed in the y direction of the user's flingĮssentially, you want to set the GolfBall’s speed and heading to match the speed and heading of the player’s fling gesture.xvel, the speed in the x direction of the user's fling.heading, the direction (in degrees) of the user's fling gesture.speed, the speed of the user's flinging gesture.y, the y position on the Canvas grid of the user's finger.x, the x position on the Canvas grid of the user's finger.Notice how this event handler takes in 6 different arguments: The clock will fire continuously to control the movement of the ballįirst, use the GolfBall.Flung event handler to move the golf ball when it is flung. Z = 2 (when sprites are overlapping, the one with the higher z will appear on top) This is the ball the player will fling to try to hit the Hole We’ll need our screen to have a defined height in order to set up the golf course properly.Īdd the following components in the Designer:īackgroundColor: Green (or whatever you like!) ![]() Screens that are set to scroll do not have a height. In the Screen Properties (shown in right-hand pane): Uncheck the checkbox labeled "Scrollable" so that the screen will not scroll when the app is running. Think of a title related to Mini Golf, or feel free to use the suggested title "Fling It Mini Golf", and type it into the Properties pane on the right side of the Designer. When the Design window opens notice that App Inventor automatically names the screen "Screen1", but you can set the Title of the screen, which will show up in the top bar of the app. Log into App Inventor and start a new project. We'll build this app in stages, adding a little bit of the game at a time. Part I: Start a new app and make a ball that responds to fling events If you are not familiar with the basics, try stepping through some of the basic tutorials before continuing. This tutorial assumes you are familiar with the basics of App Inventor- using the Component Designer to build a user interface, and using the Blocks Editor to specify the app's behavior.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |