Skip to main content
GameDev.net gamedev.net
🔒 Locked

[web] Collision

Started by xhermit Apr 10, 2006 at 5:37 PM 1 replies 500+ views
Original Post
xhermit
xhermit
I'm creating an Arkanoid/Breakout style game, but having trouble with how flash handles collision. When the ball hits the top of the paddle everything is fine. But if it hits the side of the paddle (or the paddle runs over the ball from the side) then it starts detecting multiple collisions and the ball gets "stuck" inside the paddle. I'm just using this.hitTest() Thanks
Rob Loach
Rob Loach
You're going to have to check more then just one thing. Right now, I'm assuming you're just checking the position of the ball and the paddle. You're going to have to implement checking the velocity of the ball as well to see whether it's moving away or towards the paddle. So first you'll see whether the ball is moving towards the paddle, and then if it is, you'll go on to check whether there is a collision with it. This way, the ball won't get stuck inside the paddle.
Rob Loach [Website] [Projects] [
xhermit
xhermit
That did it, thanks!

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.