Is there a way that even though two objects that have different y
co-ordinate collide?
In my game, I wanted to make my object rotate as explained in previousquestion. When I added the code, the object now dissapears from the scene even though it's x
and y
co-ordinate are in the scene. I traced
(in the function that kills the characer if it touches it. i.e hitt
) the x
and y
value of the object and found that it is still there on the scene.
The code is:
ground.addEventListener(Event.ENTER_FRAME, hitt);
function hitt(event: Event) {
if (green.hitTestObject(ground) || blue.hitTestObject(ground) || brown.hitTestObject(ground) || black.hitTestObject(ground)) {
dead = true;
}
else if (kill.hitTestObject(black) || kill.hitTestObject(green) || kill.hitTestObject(blue) || kill.hitTestObject(brown)) {
dead = true;
trace("here",kill.y,green.y,green.x);
}
}
The output is:
[SWF] hello.swf - 519178 bytes after decompression
here -608.95 -401 62.55
I don't know what's going on? Please Help..!!