Presentation is loading. Please wait.

Presentation is loading. Please wait.

When you start a new world, pick a backgrou nd.. Click on add objects to add objects to your world.

Similar presentations


Presentation on theme: "When you start a new world, pick a backgrou nd.. Click on add objects to add objects to your world."— Presentation transcript:

1 When you start a new world, pick a backgrou nd.

2 Click on add objects to add objects to your world.

3 Pick the type of object and then you can drag and drop on the background. Click done when you finish with placing objects.

4 When the program runs, world.my first method will be executed, so I put the things I wanted to do in world.my first method. But first I had to make the bounce methods. obje cts

5 I clicked on the toyball1object and I can see the bounce method that I created. I created it by clicking on create new method and then naming it bounce. Since it is associated with toyball1 it became toyball1.bounce.

6 When you click on bounce for toyBall1.bounce, you see two move statements that I did to make a bouncing motion. I dragged toyBall1.move over twice and selected down or up and the number of meters to move.

7 To show you, I dragged toyBall1.move over again and it shows how to pick down and the meters, other will get me access to other numbers.

8 As you can see, I have a bounce method for each ball. This is volleyball.

9 After I made the bounce method for each ball. I went back to world.my first method which will execute when I run and I dragged over the bounce method for each ball. Note that to do that I clicked on the ball, and then dragged its bounce method over to world.my first method. When I finish, I can click play and I will see the balls bounce.

10 I clicked play and now the tennisBall is doing its bounce method.

11 my first method startup houseke eping proc ess wra pup Startup or housekeeping is done once at the beginning of the program. Process is usually done multiple times - it usually is controlled by a loop. It is possible to just do it once. Wrapup is done once at the end when you are closing down. For example saying the program is ending or displaying totals.

12 Now I am creating three methods within world.my first method. They will be executed in sequence when I play. The three methods are all associated with world so they are named world.startup, world.process and world.wrapup. After I create them, I drag them over to world.my first method.

13 Here is the code in startup.world (to see it I clicked on edit next to startup). To make this I went to toyBall1 and dragged its move over and then I did the same with the other balls.

14 As I said on the last slide, I clicked on toyBall1 and got its associated methods and dragged the move over to world.startup. What I am doing is moving all three balls into the air as my startup.

15 Note that world.wrapup brings all the balls down. But, before I do wrapup, I do world.process.

16 I drag up loop and tell it that I want it to be executed 5 times. Then I drag up Do together so they are done all at once and then I click on each ball and drag its bounce method over. The balls will bounce together 5 times.

17

18 Now I am using an if else.

19 I clicked on create new variable when I made whichBall and gave it the name whichBall and value 1 stayed.

20 I am now duplicating the whichBall set value line I dragged whichBall right below the existing one and it let me pick set value and I set it to 1 temporarily, I am going to change that to a random number.

21 Then I went over to functions and dragged the random number function over where the temporary 1 was. Now I click on more to get the minimum and a new more comes up to let me get the maximum.

22 I now have a random number that is decimal from 0 to 3 so I say if it is < or = 1 bounce the toyBall1, else < or = 2 bounce tennisBall, else bounce volleyBall. One ball will bounce in world.process.

23 This programs combines the last two programs, the pick of the random number and the if are inside the loop so there will be 5 bounces each dependent on the random number that is chosen.

24 I set up the while loop and dragged howMany down and said do it while howMany is < 3. To get the increment, I again dragged howMany down and selected increment.

25


Download ppt "When you start a new world, pick a backgrou nd.. Click on add objects to add objects to your world."

Similar presentations


Ads by Google