PDA

View Full Version : Keeping objects from intersecting



dangerskew
July 17th, 2004, 09:16 PM
I'm having trouble getting this work. I have two squares, one that the player controls, and one that stands still. I'm trying to make it so when you hit the still square with the controlled one, it can't go through it. I don't want the one to bounce off. I want it to just stop, and not be through the still one. The fla. is attached. Thanks

Skribble
July 20th, 2004, 02:25 PM
hi dangerskew

just add this to ur unmovable square.



onClipEvent (enterFrame) {
if (this.hitTest(_root.playersquare)) {
_root.playersquare._x = this._x-10;
}
}

cheesy_x
July 20th, 2004, 05:22 PM
and might i suggest reversing the controls while going backwards????