PDA

Click to See Complete Forum and Search --> : Bouncing objects off a wall.



l8erdude
03-25-2002, 02:48 PM
I can't figure this out at all. I don't know the first thing to it. Click here: http://www.f5b.my100megs.com/shipgame.swf to get an idea of what I mean. Arrow keys are move, and space is fire. I want the ship to bounce off the wall.

ironmallet
03-26-2002, 12:02 AM
you just need left right up and down boundaries.

onClipEvent(enterFrame)
{if (this._x<10) {this._x=11; xspeed*=-0.8;}


try attaching that to the ship. If you like the behavior, just set up the other three boundaries.


an alternative would be to have big invisible overlapping rectangles to hitTest against, if you like that sort of thing.

Just trying to save a sinking thread!

l8erdude
03-26-2002, 09:00 PM
Thanks a mill.

bit-101
03-28-2002, 05:44 PM
check out the gravity tutorial at http://www.bit-101.com
covers that and more and the principles behind it.