[Solved]Snake Game: unable to draw tail correctly
Posted: Sat Oct 26, 2019 9:19 pm
I've been creating the snake game in love and i wasn't able to draw the tail correctly due to not being able to give each tail block the correct x and y.
Basically there is this array of tail blocks that starts at 0 and gains one unit each time the snake eats food, this unit has x and y coordinates.
each update cycle, the snake moves, the tail moves(new x,y for each unit) and the tail gets longer if food is eaten.
I tried several times but my spaghetti code didn't cut it.
I know I should have used a timer variable and a proper grid but i wanted this one to be different.
TLDR: in main.lua exists an updateTail function, where unit.x and unit.y reside.
Thanks for taking the time to read this and a huge hug is waiting for any wonderful person who gives me advice regarding this subject.
Basically there is this array of tail blocks that starts at 0 and gains one unit each time the snake eats food, this unit has x and y coordinates.
each update cycle, the snake moves, the tail moves(new x,y for each unit) and the tail gets longer if food is eaten.
I tried several times but my spaghetti code didn't cut it.
I know I should have used a timer variable and a proper grid but i wanted this one to be different.
TLDR: in main.lua exists an updateTail function, where unit.x and unit.y reside.
Thanks for taking the time to read this and a huge hug is waiting for any wonderful person who gives me advice regarding this subject.