PDA

View Full Version : hittest problem-how to ignore the bound box



zeldafreak
May 15th, 2005, 05:57 PM
with my car, i am trying to make it so it can pass right through a MC, but just slow down. I type speed -= 5; but the car just bounces on the bound box of the other MC. How can i get it to not hit the bound box and only the actual object, AND make it pass through the object.

zeldafreak
May 15th, 2005, 06:11 PM
i realized that depending on which end of the car i was entering the other MC (grass) it would change. because the script is when i press down, the car loses speed, and up gains speed, but if i change it around i cant enter it from the other side. is there a way just to make it slower inside the grass? I still have the bound box problem though. I attached the swf.


onClipEvent (load) {
var speed = 0;
}
onClipEvent (enterFrame) {
if (Key.isDown(Key.UP)) {
speed += 1;
gotoAndStop(1);
}
// This will make the car go backwards
if (Key.isDown(Key.DOWN)) {
speed -= 1;
gotoAndStop(2);
}
if (Key.isDown(Key.SPACE)) {
speed -= speed;
gotoAndStop(2);
}
if (Math.abs(speed)>10) {
speed *= .6;
}
if (Key.isDown(Key.LEFT)) {
_rotation -= 6;
}
if (Key.isDown(Key.RIGHT)) {
_rotation += 6;
}
speed *= .98;
x = Math.sin(_rotation*(Math.PI/180))*speed;
y = Math.cos(_rotation*(Math.PI/180))*speed*-1;
if (!_root.move.hitTest(_x+x, _y+y, true)) {
_x += x;
_y += y;
} else {
speed *= -.6;
}
if(this.hitTest(_root.grass)) {
speed -= 2;
}
}