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. Dynamic Positioning of sprites on a canvas, based on the size of the screen.Using the Sprite component and the TouchUp, TouchDown, and Flung events.The total score is the number of strokes it takes to complete the entire course.
For each fling of the ball, the stroke count goes up by one.
The ball will bounce off of the rectangular obstacle and the sides of the course. To play this mini golf app, the player first positions his/her ball within the confines of the tee, and then flings the ball toward the hole.
The game is suited for masochistic fans of golf who enjoy a frustrating 8-bit feeling in their gaming endeavors.This Mini Golf App demonstrates how to use the Fling, TouchUp, and TouchDown gestures for Sprites Note that these event handlers are also available for the Canvas.If the hole is near the edge of the screen and there isn’t a hill behind it then it is generally a bit better to be a bit short than a bit long as going off screen starts the level over again.If there is a hill behind the hole sometimes it can make sense to hit the ball a bit long and have it roll back to the hole.If the land you are hitting into it consists of a collection of plateaus at various elevations then using loft makes much more sense.You generally want to wait until the ball comes to a complete stop before hitting again, but if you come up slightly short on #6 and the ball is on the ground sometimes it will let you hit another soft hit before the ball starts rolling in reverse down the hill and off screen.On the hill in #6 it took me about 40 tries to get the ball into the cup via the loft method & when it landed in the cup it then bounced out, kept rolling, and went off screen.If the ground you are going up is a fairly straight hill sometimes it can be better to hit the ball hard up the hillside rolling the whole way up rather than lofting it over the hill.If the ball starts near the edge of the screen you do not need to click on or near the ball to initiate the swing. You can click anywhere on the screen to start your shot.Part of the frustration of this game is the ball roll on hills (and even flat surfaces near hills) can keep on going & you can’t do anything but watch until the ball moves off screen.If the ball rolls off screen it gets placed where it was at the beginning of the hole.You have to beat each hole to play the next one. There is no way to skip a hole in this game.Most the holes in the game are quite easy, but I think it took me about 60 shots to get past hole #6.The higher you score, the worse you did.In this game there is no par, however your score is cumulative across holes & each ball is a score.Tap the screen with your finger and drag it to set the shot strength and angle like a mouse.If the arrow is gray it means you can not shoot.If the arrow is white it means you can shoot.Wait until the ball comes to a stop before trying to aim as the arrow will be gray if you try to move too soon & sometimes if it adjusts from “can’t hit” to “can hit” you can accidentally shoot with the wrong power setting.The direction and length of the arrow represent the strength and angle of your shot.Use your mouse left click to select anywhere on the screen, then pull back to set the shot strength and angle.Your web browser automatically stores your best score.On the first hole it will show play instructions.Tap on the word Go on the game welcome screen to start the game.Set your swing shot and angle to try to complete 18 holes in as few as shots as you can.