Download presentation
Presentation is loading. Please wait.
1
Vehicles and Conditionals
By Henry Qin, edited and revised by Ruthie Tucker, under the direction of Professor Susan Rodger, Duke University 2008
2
Getting Started To build this world, we will need a vehicle and a person. I am using the Humvee and Euripides. You can use whichever characters you would like.
3
Getting Started We are going to make several events in this world.
The mouse will move both your vehicle and your person separately. When you click on the “T” key the mouse should move both of them together, as if they were glued together. We will then create a second world that uses the “T” key to control the camera.
4
World.ChangeVehicle First we will need to create a new method, called world.changevehicle.
5
World.ChangeVehicle Now we need to drag an “if statement” into the newly created method. Now we want to make the world do something if Euripides is set as a vehicle to the Humvee.
6
World.ChangeVehicle Now if the condition is true we will set Euripides’ vehicle to the entire world.
7
World.ChangeVehicle Else the vehicle for Euripides will be set to the Humvee.
8
World.ChangeVehicle Now we need to implement some events
The first event we need is “let the mouse move.” We need to create a new variable to place in the space of “Any Object.”
11
Creating more events Now we need another event to implement our method to make Euripides and the Humvee move together. Create a new event labeled “when a key is typed” and select the letter T.
12
Creating the Events Now we can implement our “Change Vehicle” method.
This will make Euripides and the Humvee move together.
13
Finishing Up Part One Now try playing your world.
First click on Euripides and the Humvee and see if they move separately Now move Euripides on top of the Humvee and hold down the “T” key. Now when you click on the Humvee Euripides should move with it.
14
Adding Camera Control In order to do the final part we will need to start a new world that has the same objects in it as before. See below.
15
Adding Camera Control Once you have added your objects, put Euripides on the Humvee and set him as a vehicle to the Humvee. Now create an event using the arrow keys to drive the Humvee.
16
Adding Camera Control Now we want to create a new world level method labeled just like the old one, “World.ChangeVehicle.” Now lets place an if/else statement inside our new method.
17
Adding Camera Control Now set the camera's vehicle to the Humvee in the “if statement”.
18
Adding Camera Control We want the Camera to be set as a vehicle to the world if the statement is true. Else it should be set to the Humvee.
19
Adding the Final Event Go to the events editor and add a second event that involves pressing the “T” key. In the “Do Nothing” category add “World.ChangeVehicle.”
20
Testing the World Now try playing your world. The arrow keys should move the Humvee with Euripides attached to it.
21
Finishing Up That's all folks!
Now hit the “T” key and try moving your arrow keys again. This time the camera should follow your Humvee while you move around. That's all folks!
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.