Download - Game Making with Alice
Game Making with Alice
Mike ScottUniversity of Texas at AustinGame Making with Alice1Game Making with Alice
What is Alice?2Alice is a visual programming language.Alice is designed to teach you how to programThe output of Alice programs are movies.The movies can be interactive
Alice and Visual Programming3Programming is done by pointing and clicking, dragging and dropping, selecting from menus, and some typingDownload Alice for free:www.alice.org
4
Object TreeWorld ViewEvent EditorDetails PanelCode EditorControl PrimitivesAlice Models5Main programming data are 3d modelsMany built in and more on web
Output6Output are 3d moviesrun the program, play a moviecan also add sound to programsA lot easier to recognize logic errors"Why do myninja's armskeep flyingaway?"
Sample Program - Bunny and Broccoli
7
Click the CowGame Making with Alice8
Eat the HayGame Making with Alice9
Start AliceGame Making with Alice10Double click on the Alice icon to start AliceIt may take a minute to start up
Cancel the openingdialog screen
Build the SceneGame Making with Alice11Click on the add objects button at the bottom right of the scene
Scroll to the Farm category and clock on Farm
Add Objects to SceneGame Making with Alice12Click and Drag some objects into the sceneOnce in the scene objects can be positioned with the mouseObject can be rotated by selecting the proper option from the menu in the upper rightIf you want to get rid of an object right click it and select delete
A Farm BackgroundGame Making with Alice13Yours can be different.
Add The CowGame Making with Alice14Click on the Local Gallery to get back to the list of categoriesOpen the Animals CategoryScroll over to the Cow and add one to the world
Back to ProgrammingGame Making with Alice15Exit the scene editor by clicking the done button
Make a method to hide the cowGame Making with Alice16Click on the cow in the object tree.Click on the methods in the details windowClick on the create new method buttonName the method hide
16Add commands to the hide methodGame Making with Alice17Click on the properties tab in the detail windowDrag the opacity = 1(100%) icon into the window for hideChange the opacity to 0(0%)Click on the methods tab in the details windowDrag over the cow move commandSelect down for the direction and other for the amount. Set to 2
The completed hide methodGame Making with Alice18
Create the pop up methodClick the cow in the object treeClick on methodsClick the create new method buttonname the method popUp
SimpleGameInAlice
19
Move the cow randomly Start by dragging out cow move tilesone for each of left, right, forward, and backwardClick on world in the object tree to select itClick on functions in the details windowDrag out random number and drop it on the 1 meterselect more and change max to 2SimpleGameInAlice
20
Chapter 1 - 20Be sure to drop the random number on the 1 meter when the 1 meter is in a green box. The green box shows where the dropped tile will go.Add a commentSimpleGameInAlice
21You can add a comment to explain what you are doing in EnglishDrag a // tile from the bottom of the method editing window to where you wish to place the commentClick on the down arrowSelect other
Type in the comment
21Showing the cowClick on cow in the object tree to select itClick on methods in the details windowDrag out a cow move tileselect up 2 metersClick on properties in the details windowDrag out opacity = 0change to 1 (100%)
SimpleGameInAlice
22
Completed popUp method23
Adding a property (field)We need to store the number of time the cow has been clickedClick the cow in the object treeClick on the properties tabClick the create new variable buttonname the variable numClicksset the value to 0SimpleGameInAlice
24
Chapter 1 - 24By default the type of the new variable is a number which is fine since we will use this field to record the number of hits.Increment the number of hitsIf the user clicks on the cow we want to add 1 to the number of clicks so farCreate a method that does thisIt should be a new cow method (cow selected in object tree)Drag numClicks variable into method and select the increment cow.numClicks by 1 option
SimpleGameInAlice
25
Respond to mouse click on cowIn the events window click the create new event buttonselect When the mouse is clicked on somethingChange the anything to the cow (the entire cow)Change the nothing to cow incrementClicksSimpleGameInAlice
26
Method to run the gameClick on world in the object treeSelect methods and edit the my first methodPull up a while tile from the bottom of the editor window and drop into the my first methodselect trueSimpleGameInAlice
27
Chapter 1 - 27Change while loop28Click on functions tabdrag out a < b and drop it on trueselect 1 and 1
While number of hits < 5Click on cow in the object treeClick on propertiesdrag out numClicks = 0 and drop on the first 1Change the second 1 to 5click on other and enter 5SimpleGameInAlice
29
Hide and wait a random amount of timeClick on cow and then the methodsDrag out hideDrag up a wait tile from the bottom of the editor windowselect 1 secondClick on world in the object treeclick on functionsdrag out random number and drop on the 1 secondSimpleGameInAlice
30
pop up and wait for 1 secondChange random number on wait to a min of 0.5 secondsDrag out a cow popUpTry it out!What happens after you click on the cow 5 times?SimpleGameInAlice
31
Tell the user they wonAdd some 3D text that tells the user she or he wonClick on File and then on Add 3D TextType in the text you can change the fontPlace it where you want it to appearClick on add objects to get to the mouse controlsClick on done when done
SimpleGameInAlice
32
Make the text invisible to startClick on the text in the object treeClick on propertiesModify opacity to 0 (0%)SimpleGameInAlice
33
When the user wins show the textDrag out opacity = 0 to the my first methodchange to 1 (100%) Play the game!SimpleGameInAlice
34
Speeding things up in hide methodAll animation commands takes 1 second by defaultyou can change this using the more Drag a Do together block from the bottom and then drag both commands into itSimpleGameInAlice
35
Chapter 1 - 35Do the same thing for the popUp method.Speeding things up in popUp methodRemove the random move left and forwardRight click commands and select deleteChange minimum on random move right and back to -2Set duration on random moves to 0Put move up and set opacity to 1 commands to a do together block and change duration to 0.5 seconds
36Finished popUp method37
Add instructionsCreate 3D text that tells the user what to do in the gameWhen the game starts wait for 1 secondthen make the text invisiblecan set opacity to 0SimpleGameInAlice
38
Show the number of hitsCreate 3D text that says Hits and one that says 0Use the mouse controls to position the textClick on Add Objects to see the mouse controlswhen done click on doneSimpleGameInAlice
39
Chapter 1 - 39Create World incrementClicks methodAdd an incrementClicks method to the worldcall the cow incrementClicks methodclick on the 0 3dText object then propertiesdrag out text = 0select default stringreplace the default string with the what as string function in the world to convert the number to a stringchoose expressions and pick cow numClicks as what to convert
SimpleGameInAlice
40
Chapter 1 - 40Why should we add the incrementHits method to the world and not just modify the cow increment hits? The problem is that we need to modify the 0 text which is not part of the cow put part of the world. In order to make reusable pieces we can't access things in cow methods that are not part of the cow. But, in the world incrementHits method we can call the cow increment hits method.
Change when mouse clickedModify then when mouse is clicked on the cow to call the world's incrementClicks methodTry it!SimpleGameInAlice
41
Other IdeasSimpleGameInAlice
42Have the cow play a sound when hitmodify cow incrementClicks methoduse play sound in methodsyou can also record your own soundsclick on properties for the cowclick on the + next to Soundsand record a sound and name itCount the number of times the cow has appearedAdd a way to losemaybe it will only run till it appears 10 timesmaybe add a timer and a time limitmaybe add other cows that if you click on these you lose, change color of target cow to something like orangeMake the amount of time you give the user to click on the cow a random amount from 0.5 to 1 second
SummarySimpleGameInAlice
43Alice can be used to create simple 3D gamesConcepts coveredcreating methodscreating a property (field)creating a variableusing a while loopcreating a comment
Chapter 1 - 43