I have figured it out, the snake game is up and running, everything works, all the collides and all, now to customize it how i want, thanks so much for your help both times Norm and anyone else who...
Type: Posts; User: godlynom
I have figured it out, the snake game is up and running, everything works, all the collides and all, now to customize it how i want, thanks so much for your help both times Norm and anyone else who...
yea, i tested it out, the problem is in my follow method, what i do is i set the x and y of the bodyparts to the x and y of the snake, so now i need to make it so that it appears behind the snake,...
I think it is this code
if(go)
{
int i=0;
for(SnakeBody s: snake)
{
if(snake.indexOf(s)>=1)
{
temp1=s;
they are drawn separately, with different x's and y's, but then the next time they move they all become the original snake's x and y and then are drawn upon each other, so it is all the bodyparts in...
okay, yea, my assumption was correct, they do draw, but then their x and y are changed to that of the original snake, thus merging back into one snake
no, they still disappear, are the coordinates getting changed to the first snake's, or is the SnakeBody not being actually drawn, it says it is, trying to figure this out now
well i put the debugger here
for(SnakeBody s: snake)
{
s.draw(g);
System.out.println(s);
}
and each time i got a food it created a new SnakeBody, and then also was drawing them...
well i debugged the paintComponent, and whenever i collide with a food, a new SnakeBody is created and read every single tick, however, it is not being drawn
as an update, i worked on my class and now the snake body parts get created and drawn, but only for a second, so you see the body part and then it disappears, any help?
Snake class:
import...
So if I were to make many snake objects, would i just create an:
ArrayList <SnakeBody> snake = new ArrayList <SnakeBody>();
and then call them one by one in a for loop based on that?
...
The food class did not copy all over, here is the code again
import java.awt.*;
public class Food
{
double x = 0, y = 0;
private double myX; // x and y coordinates of center
...
Hello all, this is godlynom again, thanks to those who helped me last time. Everything is working, now I just need the body parts to be added after I collide with the food. Essentially everytime you...