Jump to content


Car Animation


  • You cannot reply to this topic
2 replies to this topic

#1 S1L3NT

    Young Padawan

  • Members
  • Pip
  • 2 posts

Posted 05 January 2006 - 03:35 AM

Hi all, sorry to bother but there is a tutorial on the site on how to make a car that drives around using arrow keys but it goes out of the screen :ph34r: does anyone know how to make the walls so it doesnt leave the screen it crashes n stops for example or crashes n says game over?

Viper Productions

#2 funkysoul

    The Funky Stuff

  • Publishing Betazoids
  • PipPipPipPip
  • 2,307 posts
  • Gender:Male
  • Location:Zurich, Switzerland
  • Interests:Music: HIM, HIM, HIM, Cafe del Mar, Linkin Park, Fort Minor, Coldplay, Eric Jordan<br />Sports: Snowboarding, KiteSurfing, Extreme Sports<br />Computer: Flash, After Effects, Actionscript

Posted 05 January 2006 - 06:40 AM

You need to create boundaries in your movie like this
//Here we set the variables which define the stage Size
var left:Number = 0;
var top:Number = 0;
var right:Number = Stage.width;
var bottom:Number = Stage.height;

// if the movie is being resized dynamically, we update it here
Stage.addListener(this);
onResize = function(){
right = Stage.width;
bottom = Stage.height;
}

// simple if statement defining what to do if movieclip car hits the edge of the flash movie
if (car._x > right){
// your actions
} else if (car._x < left){
// your actions
}
if (car._y > bottom){
// your actions
} else if (car._y < top){
// your actions
}

Have fun with it.. :)

#3 S1L3NT

    Young Padawan

  • Members
  • Pip
  • 2 posts

Posted 05 January 2006 - 11:19 PM

ty





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users