Im having trouble with keeping my score updated when my brownie, (which moves when w is pressed), is pressed. Right now it doubles the score but just stays at 2 points every time you press w after.
heres the script:
import turtle
wn = turtle.Screen()
wn.setup(2000, 1000)
wn.bgcolor("black")
brnw = turtle.Turtle()
brnw.goto(-500, 100)
brnw.penup()
brnw.shape("square")
brnw.shapesize(5, 10)
brnw.color("#8A360F")
point_giver = turtle.Turtle()
point_giver.penup()
point_giver.color("#8A360F")
point_giver.goto(-500,100)
points = 1
def Brnw_Animation():
points =+ 1
brnw.speed(3)
brnw.goto(-500, 0)
brnw.goto(-500, 100)
if brnw.pos()[1] >= point_giver.pos()[1]:
score = turtle.Turtle()
score.penup()
score.goto(0, 0)
score.color("green")
score.write(points, font=('arial', 14, 'bold'))
pressed = wn.onkeypress(Brnw_Animation, 'w')
wn.listen()
while True:
wn.update()