Intro
Hi every one! I made a game called Planet Hunter with lots of help from my father especially for debugging. You can watch a demo of the game in this video below.
If you want play this game check out the github repository iniyan2013/planetHunter: a planet hopping developed on python (github.com)
screen.setup(600,600)
screen.bgcolor(“black”)
Description = [“Mars”,”Jupiter”,”Saturn”,”Uranus”,”Neptune”]
planets = [“mars.gif”,”jupiter.gif”,”saturn.gif”,”uranus.gif”,”neptune.gif”]
#starting index for planet
iPlanetCounter = 0
The following code writes name of first planet, and shows first planet.
PlanetName.hideturtle() #hides the turtle
PlanetName.penup() #stops the turtle from drawing a line whenever moving
PlanetName.goto(130,180) #moves the turtle to the top right corner of the screen
PlanetName.color(“blue”)
PlanetName.write(“Planet names: “, align =”left”, font=(“Courier”,15,”bold”))
PlanetName.goto(300,180)
PlanetName.write(Description[iPlanetCounter], align =”left”, font=(“Courier”, 15,”bold”))
screen.addshape(“boy.gif”)
#global variables
score = 0
isGameOn = 1
#score turtle
sturtle = turtle.Turtle()
sturtle.hideturtle()
sturtle.penup()
sturtle.goto(-300,180)
sturtle.pendown()
sturtle.color(“blue”)
sturtle.write(“score:”,align =”left”, font=(“Courier”,15,”bold”))
#sturtle = turtle.Turtle()
sturtle.penup()
sturtle.goto(-190,180)
sturtle.pendown()
sturtle.color(“blue”)
sturtle.write(“0″,align =”right”, font=(“Courier”,15,”bold”))
#timer turtle
#player fox turtle
fox = turtle.Turtle() # instantiates a Turtle object from the Turtle class into fox
fox.shape(“boy.gif”) # sets the shape of the turtle to fox.png
fox.resizemode(“auto”)
fox.penup() # stops the turtle from drawing a line whenever moving
fox.speed(0) # sets the turtle’s speed to ‘fastest’
fox.goto(-200,-200)
#planet turtle
planet = turtle.Turtle() # instantiates a Turtle object from the Turtle class into fox
planet.shape(planets[iPlanetCounter]) # sets the shape of the turtle to fox.png
planet.resizemode(“auto”)
planet.penup()
Leave a Reply