Jonny_5 (28th November 2009)
Basically i have my little car goin around but if it hits the sides it doesnt do anything i want it to move to another keyframe. If anyone flash experts know the codes then please help meee!!
Thankz:P

I'm not particularly a flash expert, but collision detection is pretty much the same whatever language. You need some form of script to monitor the objects, and see when their boundaries cross/touch.
This video may help:
[ame="http://www.youtube.com/watch?v=iUbX9tFtqTg"]YouTube- Flash AS3 Collision Detection[/ame]
Jonny_5 (28th November 2009)
is it as2 or as3?
When you move the car you want to get it's x and y position. Then use an if statement so that:
if(car.x < 0) {
// hit the left wall
} else if(car.x > Stage.width) {
// hit the right wall
}
if(car.y < 0) {
// hit the ceiling
} else if(car.y > Stage.height) {
// hit the floor
}
You can adjust the values to take into account the car's width by using this instead:
if(car.x-(car.width/2) < 0)
Failing that use the hitTest method, placing movieclips around the outside. Check the Flash help for hitTest
its as3 but thnx for the tips (:
you need the hittest i.e.
if (car.hitTest(line1)) {
gotoAndStop(2);
}
if (car.hitTest(end)) {
gotoAndStop(4);
}
};
Instead of goto and stop, you could have nextFrame
Send me your email address, and I'll email you some working code as a demonstration!
Jonny_5 (30th November 2009)
my email adress is jonnyebr@hotmail.com
thnx alot
There are currently 1 users browsing this thread. (0 members and 1 guests)