Reputation: 5
I'm not sure how to get rid of the black arrow, if you could help that would be great! Thanks, also if you have any other modifications to make the game better that would be awesome as well! Thanks again!
It says I need to write more detail, so I m just going to keep typing fora bit and hope that I have enough words to write. It should be good right around here.
import math
import random
score = 0
print ("\n" * 40)
print("Welcome Player, I Hope You Have What it Takes to be the Next WARLORD BOSS")
print("Enemies Killed:\n0")
#Title
t=turtle.Pen()
t.pencolor("magenta")
t.hideturtle()
t.penup()
t.setposition(-300,350)
t.write("Catch 40 turtles for a suprise ( ͡° ͜ʖ ͡°)", font=("Verdana", 18))
#Tip
text=turtle.Pen()
t.pencolor("magenta")
t.hideturtle()
turtle.clear()
t.penup()
t.setposition(-100, -350)
t.write("TOUCH THE EDGES, I DARE YOU", font=("Verdana", 18))```
#Set up screen
wn = turtle.Screen()
wn.bgcolor("dim gray")
wn.title("EXEXEXEXEEXXEXEXE HACK COMMENCING␀␀␀␀␀")
#Draw border
mypen = turtle.Turtle()
mypen.penup()
mypen.speed(10)
mypen.hideturtle()
mypen.setposition(-300,-300)
mypen.pendown()
mypen.pensize(3)
for side in range(4):
mypen.color("crimson")
mypen.forward(300)
mypen.color("gold")
mypen.forward(300)
mypen.left(90)
mypen.hideturtle()
#Create player turtle
player = turtle.Turtle()
player.color("powder blue")
player.shape("arrow")
player.penup()
player.speed(0)
#Create goal
goal = turtle.Turtle()
goal.color("red")
goal.shape("turtle")
goal.penup()
goal.speed(0)
goal.setposition(-100, -100)
#Set speed
speed = 1
#Define functions
def turnleft():
player.left(30)
def turnright():
player.right(30)
def increasespeed():
global speed
speed +=0.5
def decreasespeed():
global speed
speed -= 1
#Set keyboard binding
turtle.listen()
turtle.onkey(turnleft, "Left")
turtle.onkey(turnright, "Right")
turtle.onkey(increasespeed, "Up")
turtle.onkey(decreasespeed, "Down")
while True:
player.forward(speed)
#Boundary check
if player.xcor() > 300 or player.xcor() < -300:
print("I Knew you could never be a WARLORD... Try Again")
quit()
if player.ycor() > 300 or player.ycor() < -300:
print("I Knew you could never be a WARLORD... Try Again")
quit()
#Collision checking
d= math.sqrt(math.pow(player.xcor()-goal.xcor(),2) + math.pow(player.ycor()-goal.ycor(),2))
if d < 20 :
goal.setposition(random.randint(-300,300), random.randint(-300, 300))
score = score + 1
print ("\n" * 40)
print("Wow, You Actually got one!")
print("I think you Might Have What it Takes to be the Next WARLORD BOSS")
print("Enemies Killed")
print (score)
Upvotes: 0
Views: 336
Reputation: 41925
This code is your problem:
text=turtle.Pen()
t.pencolor("magenta")
t.hideturtle()
turtle.clear()
t.penup()
t.setposition(-100, -350)
t.write("TOUCH THE EDGES, I DARE YOU", font=("Verdana", 18))
You copied and pasted but forgot to update t.
to instead be text.
Also, turtle.clear()
doesn't make sense as that refers to a different turtle altogether:
text = turtle.Pen()
text.hideturtle()
text.pencolor("magenta")
text.penup()
text.setposition(-100, -350)
text.write("TOUCH THE EDGES, I DARE YOU", font=("Verdana", 18))
Upvotes: 1