Public Group

#### Archived

This topic is now archived and is closed to further replies.

# Collision Detection?

This topic is 5902 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts


{
ballposition=ballposition-1;
}

{
ballposition=ballposition+1;
}

{
ballposition=ballposition+1;
}

{

Would this work for collision detection?
tcache Contact Me
Formerly known as Wachar <- Thrander <- Tazel [edited by - Tazel on October 19, 2002 10:10:03 AM]

##### Share on other sites
Assuming the direction is right,

According to me, that should work...

##### Share on other sites
Man I hate collision detection I''ve been working on a break out pong type game for almost a month now. I''ve implemented the collision detection for the bricks since the very first week. And 4 weeks later it still is buggy.

I think I will finish the game, and the collision detection will still not be working. ARG it makes me so mad, I''m at almost 100 lines of code I think.

I wish I could snap my fingures and it would work.

##### Share on other sites
Actually, once ballposition == paddleposition, it is too late, they are now occupying the same space. What you want to do is calculate the ball''s next position, see if that is == paddleposition and if it is, then recalculate ballposition to bounce it off the paddle.

##### Share on other sites
Doesn''t the screen''s layout go from 0 on the left to whatever the screen resolution is on the right? So the +1 and -1 should work. And also, how would I check before hand?

tcache
Contact Me

Formerly known as Wachar <- Thrander <- Tazel

##### Share on other sites
hi you can check the ball''s next position by doing this:

ballNextPos = ballCurPos + (ballVel * dt);

...

don''t use equal especialy if your using float, it would rarely reached the equal comparison,

1. 1
2. 2
Rutin
21
3. 3
4. 4
5. 5

• 13
• 26
• 10
• 11
• 9
• ### Forum Statistics

• Total Topics
633736
• Total Posts
3013601
×