interactive scripting - CGR C/092 - fall 2004
Philip van Allen - v a n a l l e n @ a r t c e n t e r . e d u

room 142, Monday 4:00pm-7:00pm
all materials on this web site © copyright 2004, Philip van Allen
 
week 05a - exercises, enterframe event, flags, movieclip states, events

review exercises : 


To practice some of what we've learned so far, create from scratch the following two exercises. You may refer to the book, but not the previous week's notes.

1) Create an object on the screen that rotates when you click on it. Use the "_rotation" property to do this.

Additional challenges:

  • add code so the object will also move 10 pixels each time you click on it
  • add code to make the object move diagonally

2) Create an object on the screen that moves to a random location on the screen when you click on it. Use the Math.random() method to create a random number, and Math.round() to create an integer. Remember the concepts of Range and Offset.

  • Range - make a range of values by muliplying the random number by a value such as 10 to generate numbers between 0 and 10.
  • Offset - change the start of the range by adding an offset value, such as -5 to produce random numbers between -5 and +5.

Addtional challenges:

  • add code so the object will move in a random location in both X and Y dimensions
  • add code so the object will move a random amount relative to the object's current position

 


 

 

 

all materials on this web site © copyright 2004, Philip van Allen

top