90 likes | 286 Views
Review!. This is for your test, so pay attention!. Whats a variable?. A spot in memory to store information Can be numbers, strings etc You have to declare them in order to use them ( ie you have to give your variable a name before you can use it. Whats a declaration?.
E N D
Review! This is for your test, so pay attention!
Whats a variable? • A spot in memory to store information • Can be numbers, strings etc • You have to declare them in order to use them (ie you have to give your variable a name before you can use it.
Whats a declaration? • Tells the computer to reserve a memory spot, and to give that spot a name. Example: var name1:string; • The variables name is name1, and it is a string variable that stores words.
Whats a function? • Also called a “method” • It’s a mini program that usually gets run many times • Using functions generally saves on space so you don’t have to copy and paste the same code over and over. • We use them most with listeners.
Whats a Listener? • A program built into flash that runs in the background while your game is running. • They wait for a specific event to happen (like a mouse click) and run a small mini program (a function) every time the event happens. • Most objects in your game will use these listeners (aka event handlers)
Whats an Object? • A specific instance of a general type • Example: You can have type: Baseball (its not an actual baseball, just the definition of a baseball) • Now if we make several baseballs and number them 1 through 5 • We get 5 Objects of type baseball • To do anything with one of the baseballs, we need to call each ball by name, baseball1.doStuff(); etc
What are Properties? • Every Object in flash has what we call properties • Example: baseball1.x is the x coordinate of the baseball • baseball1.alpha is the transparency of the baseball1
Last of all… • Watch your capital vs lower case letters, they are completely different things to a computer • Don’t give your variable names spaces in them, and definitely don’t use weird characters like (- + * etc)
Review Assignment • Make 4 narrow boxes that make up a border around the screen • Make a zombie you can drag (see Activity 5 for the code) • Setup hitTests for the zombie, so that if it touches any of the boxes, the zombie moves back to the middle of the screen