[SOLVED] Snake clone help

Questions about the LÖVE API, installing LÖVE and other support related questions go here.
Forum rules
Before you make a thread asking for help, read this.
Post Reply
User avatar
DarkblooM
Prole
Posts: 9
Joined: Fri Sep 20, 2024 9:29 pm
Location: France
Contact:

[SOLVED] Snake clone help

Post by DarkblooM »

Hello

Trying to make a Snake clone, I can't seem to figure out why the snake's trail isn't displaying on screen.

Code: https://pastebin.com/i1fqFdBY

Enlightenment would be appreciated.
Last edited by DarkblooM on Tue Jan 14, 2025 3:50 pm, edited 1 time in total.
User avatar
BrotSagtMist
Party member
Posts: 680
Joined: Fri Aug 06, 2021 10:30 pm

Re: Snake clone help

Post by BrotSagtMist »

You are not making copies of the position here.
You merely link it.
Ergo your path points to the real snake.
Try:
table.insert(snake.path, 1, {x=snake.pos.x,y=snake.pos.y})
obey
User avatar
DarkblooM
Prole
Posts: 9
Joined: Fri Sep 20, 2024 9:29 pm
Location: France
Contact:

Re: Snake clone help

Post by DarkblooM »

BrotSagtMist wrote: Tue Jan 14, 2025 3:26 pm You are not making copies of the position here.
You merely link it.
Ergo your path points to the real snake.
Try:
table.insert(snake.path, 1, {x=snake.pos.x,y=snake.pos.y})
Thank you very much!
Post Reply

Who is online

Users browsing this forum: Bing [Bot] and 7 guests