We are about to switch to a new forum software. Until then we have removed the registration on this forum.
I'll get right to it. My problem is that collision detection with objects in my snake game is not accurate since the speed value is between 1 and 5. This makes the value of snake.x or snake.y sometimes not fall within range of the line collide function. If i increase the range, at slow speeds it would seem like the snake hasn't even touched the line, and i'd get a Game Over.
I can make these obstacles by drawing small ellipses but that would tank my performance. So i'm stuck with just having to draw basic shapes.
here's an example of the level and it's code
void level1()
{
strokeWeight(2);
line(0,250,500,250);
for(float a=248; a<=252; a+=0.1)
if(snake.y==a)
{
snake.gameOver();
start=false;
}
}
I know I've asked a lot of questions about this particular snake game... but hey, i'm learning :D
Answers
Nevermind figured out a way to make it more accurate
The line and ellipse are just for show really.