My 1st game
OttoKaries

from turtle import *
from random import randint
tsize = 20
s_width = 200
s_height = 180
class Sprite(Turtle):
def is_collide(self,sprite):
dist = self.distance(sprite.xcor(), sprite.ycor())
if dist < 30:
return True
else:
return False

player = Sprite(0, -50, 10, "turtle", "orange")
enemy1 = Sprite(-s_width, 0, 15, "square", "red")
enemy1.set_move(-200, 0, 100,0)
enemy2 = Sprite(s_width, -110, 35, "square", "red")
enemy2.set_move(200, 70, -200, 70)
goal = Sprite(0, 160, 30, "turtle", "green")

scr = player.getscreen()
scr.listen()
scr.onkey(player.move_up, "Up")
scr.onkey(player.move_left, "Left")
scr.onkey(player.move_right, "Right")
scr.onkey(player.move_down, "Down")

totalscore = 0
while totalscore < 3:
enemy1.make_step()
enemy2.make_step()
if player.is_collide(goal):
player.goto(0, -120)
totalscore += 1
if player.is_collide(enemy1) or player.is_collide(enemy2):
goal.hideturtle()
break
enemy1.hideturtle()
enemy2.hideturtle()

You are viewing a single comment. View All
nbash

BRO THIS IS SOOOO COOL!!!!! Im vote this! :D