Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from turtle import *
- t = Turtle()
- t.up()
- t.shapesize(2)
- t.tilt(90)
- t.speed(0)
- t.goto(0, -240)
- delay(0)
- bullets = []
- aliens = []
- a1 = Turtle()
- a1.speed(0)
- a1.shape("square")
- a1.shapesize(1)
- a1.up()
- a1.goto(0,280)
- aliens.append(a1)
- def move_left():
- t.bk(10)
- def move_right():
- t.fd(10)
- def shoot():
- bullet = Turtle()
- bullet.speed(0)
- bullet.up()
- bullet.shape("circle")
- bullet.goto(t.xcor(), t.ycor())
- bullet.setheading(90)
- bullets.append(bullet)
- bullet.shapesize(0.6)
- def rozovo():
- t.color("pink")
- def gameplay():
- for x in bullets:
- x.fd(10)
- if x.ycor() >300:
- x.hideturtle()
- bullets.remove(x)
- for x in aliens:
- x.fd(10)
- if x.xcor()>450:
- x.setx(-450)
- x.sety(x.ycor()-30)
- ontimer(gameplay,100 )
- onkeypress(move_left, "Left")
- onkeypress(move_right, "Right")
- onkeypress(shoot, "space")
- onkeypress(rozovo,"q")
- listen()
- gameplay()
- done()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement