I'm trying to make a snake game for class and right now I'm just trying to figure out the movement and this is what I have so far. I know it's a mess and I know it is wrong because it just moves to the right constantly and only shifts up or down using arrow keys. So how would I fix that problem? Also our teacher told us to make a matrix for the snake to move in and to have the food appear in? How exactly would I do that? Oh and also he told us we need to do these things too that I am not really sure how to do so if someone could help me that would be awesome:
For my class we are supposed to recreate a loop image that our teacher gave us:
I really have no idea what I'm doing, but i was trying to just make a red background and then have the blue boxes be a loop. I was trying to set the blue box as a function and then have a row of boxes be a function and then draw all of the rows. But when I try to do this it only draws one blue box in the corner and I have no idea why. Maybe I'm going about this a completely wrong way but I'm really bad at this so someone please help me!