Retro Lord Posted December 20, 2014 Share Posted December 20, 2014 I'm having a small issue with my collision detection between the ball and player1. Player 1 moves from right to left and the player shoots a ball that travels to the right. Most of the times the ball makes contact with player1, player1 dissapears as it should be. But sometimes no collision is detected. Would this be corrected if I made the ball a bit bigger then the standard smallest size? I'm using a simple code for handling the collision: if collision(ball,player1) then player1y=rand:player1x=135 Thanks in advance. Quote Link to comment Share on other sites More sharing options...
+Random Terrain Posted December 21, 2014 Share Posted December 21, 2014 The "player1y=rand" could be the part that is messing things up. Using rand means that sometimes player1 would be in the same y location after a collision. If this is about the game you posted, are you hearing the beep sound every time there is a collision or does the beep not happen sometimes? Quote Link to comment Share on other sites More sharing options...
Retro Lord Posted December 22, 2014 Author Share Posted December 22, 2014 Thanks for the help once again Random Terrain. The beep plays everytime there is a collision. And as you said, it was the "player1y=rand" that was causing the problems. I managed too fix it =) Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.