Download presentation
Presentation is loading. Please wait.
Published byBrent Crawford Modified over 9 years ago
1
Skater World: Part Three By Deborah Nelson Duke University Under the direction of Professor Susan Rodger June 2009
2
Overview The story continues: Now it’s skaterGuy’s turn to celebrate skaterGirl’s successful jump. The user will be able to control the camera view, and move skaterGirl around on the screen. What we will do: 1.Write a method that uses a loop 2.Create several events which allow the user to interact within the animation 3.Set up the events that will be used in the final scene of Part Four
3
Create skaterGuy Celebrate First, click on skaterGuy in the object tree. In the details area, click on methods, create new method. Name it celebrate. Click OK Drag in a Do together. Then drag skaterGuy into the method. Select say, other. Type in “Wow, Awesome!”
4
Using a Loop We will use a loop to repeat statements multiple times. In this case, we’ll use a loop to have skaterGuy jump twice. From the control statements, drag Loop into the Do Together. Select 2 times. Then, complete the code on the next slide:
5
The complete Celebrate Method
6
Call celebrate Click on world.myFirstMethod tab. Drag skaterGuy’s celebrate method right after makeJump Do Together Play your world to see skaterGuy Celebrate.
7
Creating an Event Now the next step is to allow the user to interact with the animation. We will create three events to change the camera position. Click on create new event. Select “When a key is typed” Then, click on any key. Select Space from the drop down menu.
8
Click on the world.my first method tab. From there, drag the Do together that says “set the camera point of view to skaterGirl’s Head” on top of the Nothing in the event you just created. Play your world and press space bar on your keyboard
9
Create a new event “when a key is typed” Click on any key, select letters, O Drag a Do Together from control statements up to Nothing. Another Event
10
Event continued From world.my first method right click on “camera set point of view to Original Position and make copy. Drag the copy to the Do Together of the event.
11
Event (continued) In the first event that changes the camera view, the camera vehicle is set to skaterGirl. So we need to set the camera vehicle when the view is changed to originalPosition in this second event. Drag camera from the object tree into the Do together of the event. Select camera set vehicle to, the entire world.
12
Play your world Click Play. Press Space to at any time to see the camera view change to skaterGirl Then press O to switch the camera view to originalPosition
13
The third “key” event for camera position Create a new “when a key is typed” event. Click on any key and select letters, S Drag a Do together on top of the Nothing. From world.my first method, drag the “camera set point of view to sideView” instruction to the Do together of the event. Then drag camera into the Do together, select set vehicle to, world, the entire world Play your world, press Space, O or S to see the events
14
A different type of event Let’s try a different type of event in order to allow the user to use the arrow keys to move the skateboard. Create new event. Select Let the arrow keys move Scroll down in your Event pane to see the new event
15
In this event, click on the camera and in the drop down menu, select skateboard, the entire skateboad Play your world. After the skaterGirl goes around the circle, press the spacebar to change to her view. Then use the arrow keys on your keyboard to move her around the world.
16
Click on an object event Now, let’s create an event so that when skaterGuy is clicked on, the camera moves to him. After he talks, the camera will be set to a new view to watch airplanes takeoff. First, we will position the camera and objects. - When we position the objects, we will add a second skaterGuy object from the gallery. This skaterGuy2 will serve as a double in the new view, instead of moving the original skaterGuy around in the world.
17
Positioning the Camera Right click on the camera in the object tree and select methods, set point of view to, Dummy Objects, originalPosition
18
Dropping the Dummy Objects Click on Add Objects to go to the gallery. Use the middle camera arrow. Drag the camera to the right, forward, and swing it around until the camera is facing right of the original scene.
19
Now drop a dummy at the camera. In the object tree, rename “dummy” to watchTakeOff Go to the Skate Park folder. Drag skaterGuy into the world. Use the buttons to position this skaterGuy2. Face him away from the camera, move him close, then down and resize so that he is only at the bottom of the scene.
20
Go back to the Local Gallery. Click on the folder Roads and Signs. Drag the“Do Not Enter Sign” into the world twice. Position the signs like this:
21
Now let’s store the camera position at skaterGuy. Right click on the camera in the object tree. Set point of view to, Dummy Objects, originalPosition. Use the middle camera button to drag the camera very close to skaterGuy. Like this: Drop a dummy at the camera. Rename it “closeUp.” Click on closeUp. In the details area, set vehicle to skaterGuy, because we want this view to stay with him.
22
Another view of the guy Drag the camera to see more of skaterGuy. Drop a dummy at the camera again. Rename this dummy to “guyView.” Click on “guyView”. In the details area, in properties, set the vehicle to skaterGuy, the entire skaterGuy
23
TalkToGuy Method Click Done to exit the layout mode. Click on the world in the object tree. Create a new method. Name it talkToGuy If the mouse is clicked on skaterGuy, the camera view is going to change to “closeUp”. After skaterGuy talks, the camera will then go to “watchTakeOff” view. Then, skaterGuy2 will appear. See the next slide for the code.
24
Writing talkToGuy Drag in the following code:
25
In the world, create a new method. Name it finishedTakeOff. If the mouse is clicked on skaterGuy2, the camera is going back to the originalPosition and skaterGuy2 will disappear. The code: Writing finishedTakeOff
26
Set skaterGuy2 to false, initially Finally, click on skaterGuy2 in the object tree. In the properties tab, set isShowing to false. This is because the original scene is with skaterGuy, so skaterGuy2 shouldn’t be showing yet
27
Complete the events In the event’s pane, Create a new event. Select “When the mouse is clicked on something” Click on anything, select skaterGuy, the entireSkaterGuy from the drop down menu Click on Nothing, select talkToGuy from the drop down menu
28
One more event Click create a new event. “When the mouse is clicked on something” Click on anything, select skaterGuy2, the entire skaterGuy2 from the drop down menu Click on Nothing, select finishedTakeOff from the drop down menu
29
Play your world Play your world. If you want to forward past the methods, Speed up: Or use the Space, O, and S keys to change camera views during the animation. Then click on skaterGuy to test your talkToGuy method. Then click on skaterGuy2 to test the finishedTakeOff method. In Part Four, we will animate a plane to take off, by using billboards
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.