Download presentation
Presentation is loading. Please wait.
Published byHelen West Modified over 9 years ago
1
Creating and Calling Procedures Alice 3 Beta
2
A few choices to be made Right window, upper left hand corner start by clicking on Class “MyScene” button 1.Click “class” 2 Click MyScene 3 Click Procedures 4 Click Declare Procedure
3
After requesting to create a procedure, Name it (any legal name)
4
New Tab appears named with your new method name
5
This example will use a parameter to be passed into method when the method is called Click on Add Parameter button Next click on Value Type arrow
6
This example will use an integer Many other types are available
7
This example “howHigh” keyed in as name of integer parameter Any legal name OK, name should relate to purpose of parameter
8
Continue by clicking “OK” button
9
New Button “howHigh” appears and “Add Parameter” button may be used to create other parameters as needed “howHigh” Add Parameter
10
Many tiles can be dragged to the right in this example a Princess “move” was chosen This example chose “UP” Princess “Move”
11
A number (an integer) place holder is picked 1.0 in this example
12
Result of last 1 integer choice (1.0 is really just 1 an integer) Example Princess will move up 1 meter
13
Integer “howHigh” button dragged toward the 1.0 placeholder Target for howHigh parameter
14
“howHigh” dropped off on top of 1.0 replacing it
15
Click on “run X” tab Then click on This a.k.a. Scene Find the method you want to call “princessMethod” in this example drag the tile to the right window
16
Choose an integer “meters Princess will move UP” in this example “3” chosen as demonstration
17
Result tile on right below an existing instruction. Call to princessMethod passing 3 “howHigh” parameter
18
Next run program
19
Result: Princess moves UP too far
20
Call adjusted to “2” meters UP re-run program
21
Princess now completely in frame
22
Example has worked Method called correctly, adjusted when necessary The method may be called many times and passed the same parameter (argument) or a different one each call.
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.