PDA

View Full Version : hittest stop?



yhack
June 3rd, 2004, 03:39 PM
onClipEvent (enterFrame) {
if (Key.isDown(Key.LEFT)) {
this._x -= 5;
if (_root.alien.hitTest(_root.barrier)) {
this._x += 5;
}

the alien moves about then whin it touches a barrier it should stop but why dousnt my code work?

signifer123
June 3rd, 2004, 05:08 PM
try this:


onClipEvent (enterFrame) {
if (Key.isDown(Key.RIGHT)) {
play();
_x+= 5;
if (_root.alien.hitTest(_root.barrier)) {
this._x -= 5;
}
}
}

yhack
June 3rd, 2004, 05:25 PM
nope it dont work :(

signifer123
June 3rd, 2004, 05:26 PM
are yuo useing irregualr objects?

ohh ya i changed the keys in case you didn't notice

yhack
June 3rd, 2004, 05:31 PM
yes im using irregular shapes

signifer123
June 3rd, 2004, 05:38 PM
ohh it think you need to use get_x and get_y for that i'll post a lnk to it i don't qiete get it?

yhack
June 3rd, 2004, 05:39 PM
no i dont

signifer123
June 3rd, 2004, 05:40 PM
here

http://www.kirupaforum.com/forums/showthread.php?t=43509&highlight=irregular+hittest

i hope it helps!

yhack
June 3rd, 2004, 06:04 PM
i didnt understamd it

maybe i can make the alien stop when it gets to a certain pixel?