• Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint

Wind

To make the game a little more unpredictable, I created a wind movie clip that dynamically generates a random speed and direction for the wind factor. The factor affects the direction and speed of the bomb. To randomly generate the wind’s speed and direction when the movie starts, as well as at the end of each game, I placed the new randomizeWind() function in frame 1 on the main timeline:

// Randomizes wind speed and direction 
function randomizeWind() {
    wind.windspeed = Math.round(Math.random()*100); 
    wind.winddirection = Math.round(Math.random()*360); 
    // Activate the change in wind speed and direction 
    // in the MC's onClipEvent(enterFrame) 
    wind.changedir = true; 
    wind.changespeed = true; 
} 


PREVIEW

                                                                          

Not a subscriber?

Start A Free Trial


  
  • Creative Edge
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint