Viper Productions
Car Animation
Started by S1L3NT, Jan 05 2006 03:35 AM
2 replies to this topic
#1
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
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
Viper Productions
#2
Posted 05 January 2006 - 06:40 AM
You need to create boundaries in your movie like this
Have fun with it..
//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
Posted 05 January 2006 - 11:19 PM
ty
1 user(s) are reading this topic
0 members, 1 guests, 0 anonymous users
