repl.it
@ismenelik/

Xpasunavi

Python (with Turtle)

No description

fork
loading
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
import turtle
from random import randint

my_pen = turtle.Turtle()

my_pen.penup()
my_pen.setposition(-300,300)
my_pen.pendown() 

for sides in range(3):
  my_pen.forward(100)
  my_pen.right(90)
my_pen.forward(100)
my_pen.hideturtle()

player = turtle.Turtle()
player.penup()

def move_right():
  x = player.xcor()
  x += 10
  player.setx(x)

def move_left():
  x = player.xcor()
  x -= 10
  player.setx(x)

def move_backward():
  y = player.ycor()
  y -= 10
  player.sety(y)

def move_forward():
  y = player.ycor()
  y += 10
  player.sety(y)

wn = turtle.Screen()
wn.listen()

wn.onkey(move_right, 'l')
wn.onkey(move_left, 'j')
wn.onkey(move_forward, 'i')
wn.onkey(move_backward, 'k')

turtle.done()
turtle.close()
result
console
?