HW 10.2

This assignment is more difficult than I assumed I thought all I had to do was create a food class for my snake game

class Food{
int xpos;
int ypos;
color c;

Food(){
xpos = int(random(1,199));
ypos = int(random(1,199));
c = color(0,0,255);
}

void display(){
fill(c);
rect(xpos,ypos,5,5);
}
}

but when I add myFood.display the processing doesn’t run. It could be that I am missing something in my main code or in the Food class, but I will try to fix it before class.

Another class that I can create for my midterm is a snake class.

This entry was posted in Uncategorized. Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *