from turtle import Turtle, Screen
import time
screen = Screen()
screen.setup(width=600, height=600)
screen.bgcolor("black")
screen.title("инопланетяни")

#nuhjr
pl = Turtle()
pl.shape("triangle")
pl.color("indigo")
pl.penup()
pl.goto(0,250)

def move_right():
    x = pl.xcor()
    if x >280:
        pl.sety(x+20)

def move_left():
    x = pl.xcor()
    if x > -280:
        pl.sety(x-20)


def move_up():
    y = pl.ycor()
    if y < 280:
        pl.sety(y + 20)


def move_down():
    y = pl.xcor()
    if y > -280:
        pl.sety(y - 20)





while True:
    time.sleep(0.1)
    screen.update()


screen.listen()
screen.onkey(move_right, "d")
screen.onkey(move_left, "a")
screen.onkey(move_up, "s")
screen.onkey(move_down, "w")

screen.mainloop()