pepega1337. – 15-15 Jul 12
okay apparently im too stupid to make a snake game, how on this planet earth is this not working as expecting get me a rope
![](https://cdn.answeroverflow.com/1128706270505996440/image.png)
13 Replies
Well it looks like you basically just fill it and then immediately remove it
but i thought im removing the previous one, like: draw a rectangle, remember its position, draw another one at new position and remove the old one
Previous.X is the same value as the one you used in fillRect
Unknown User•15mo ago
Message Not Public
Sign In & Join Server To View
yeah this works, its weird that no matter how much i think, my example still works in my head
Unknown User•15mo ago
Message Not Public
Sign In & Join Server To View
nah i cant think, in my head I am drawing a rectangle at x0 y0, then remembering its position for future and incrementing the actual x position, then erasing the old rectangle, does that mean that the rectangle will get drawn and removed immediately? if yes then it took me 3h to figure it out and i dont know how
Yes
That’s what your code says 🙂
Basically what you’d want to do is track the previous intervals state and remove that before you fill the current intervals rectangles
So you’d basically need two loops
One to remove the previous values and another to add the new ones
And then you save the current ones as the previous
Then you move
Unknown User•15mo ago
Message Not Public
Sign In & Join Server To View
yeah ur code works fine, i will try to implement more segments rn etc
Unknown User•15mo ago
Message Not Public
Sign In & Join Server To View
nah bro at first i wanted to make this shi online with socket.io ![AINTNOWAY](https://cdn.discordapp.com/emojis/1029207400802168912.gif)
![AINTNOWAY](https://cdn.discordapp.com/emojis/1029207400802168912.gif)
This thread hasn’t had any activity in 36 hours, so it’s now locked.
Threads are closed automatically after 36 hours. If you have a followup question, you may want to reply to this thread so other members know they're related. https://discord.com/channels/102860784329052160/565213527673929729/1128706270728290334