#...........
for num in range(0,len(self.prevs)):
fill(255,0,0)
rect(self.prevs[num].x,self.prevs[num].y,22,22)
#..........
(I know this code for adding a tail is wrong)
This is the only append(PVector(x,y)) that I have in my program,
but it says “List obj has no attribute x” (for the y is the same), only when I append a second PVector.
It works for the first tail, but when I add the secon tail, I get this error.
OK, addtail is called after show if i collected a fruit
snake.keyPressed()
snake.logic()
prevH = snake.vec
fruit.Show()
snake.Show()
if dist(snake.vec.x,snake.vec.y,fruit.vec.x,fruit.vec.y) < 12.5:
fruit.respawn()
snake.score += 1
#i currently remved addtail but it was here
# snake.tail.append[]
non i want to say that i changed name from self.prevs in sefl.tail,
old code: self.prevs, new code : self.tail
But this error is not a problem, now I dont have it anymore
I am saying, the problem disappeared, and idk how.
THe second problem is just if you want to help, or I will continue by myself, bc i translated a code from a c++ ASCII snake (that did last year) to python, but I have this problem with the tails