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
G
ghardin137279d ago
Well it looks like you basically just fill it and then immediately remove it
P
pepega페페가279d ago
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
G
ghardin137279d ago
Previous.X is the same value as the one you used in fillRect
UU
Unknown User279d ago
P
pepega페페가279d ago
yeah this works, its weird that no matter how much i think, my example still works in my head
UU
Unknown User279d ago
P
pepega페페가279d ago
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
G
ghardin137279d ago
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
UU
Unknown User279d ago
P
pepega페페가279d ago
yeah ur code works fine, i will try to implement more segments rn etc
UU
Unknown User279d ago
P
pepega페페가279d ago
nah bro at first i wanted to make this shi online with socket.io AINTNOWAY
UU
Unknown User277d ago