Skip to content

Commit

Permalink
code cleanup and new funcs
Browse files Browse the repository at this point in the history
  • Loading branch information
AviationSFO committed Dec 16, 2021
1 parent a193e7b commit 8e06da6
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 6 deletions.
5 changes: 4 additions & 1 deletion CHANGELOG.txt
Original file line number Diff line number Diff line change
Expand Up @@ -40,4 +40,7 @@ Added install script
STABLES

v1.0
Changed fall speed increasing, optimizations, STABLE RELEASE!
Changed fall speed increasing, optimizations, STABLE RELEASE!

v1.1
Code clean up, dev tools on "r" and A + D moving support
21 changes: 17 additions & 4 deletions dodger.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
import time
import random
TK_SILENCE_DEPRECATION=1
# fallers = 1
delay = 0.00625
score = 0
score_this_round = 0
Expand All @@ -14,7 +13,7 @@
highscore = highscoredoc.read()
# Creating a window screen
wn = turtle.Screen()
wn.title("Dodger Game v1.0")
wn.title("Dodger Game v1.1")
wn.bgcolor("black")
wn.setup(width=600, height=600)
wn.tracer(0)
Expand Down Expand Up @@ -45,7 +44,7 @@ def move_down(self):
return self

def randomize_location(self):
self.xpos = random.randint(-280, 280)
self.xpos = random.randrange(-280, 280, 30)
self.ypos = 290
return self
# fallers in the game
Expand Down Expand Up @@ -83,10 +82,25 @@ def move():
if head.direction == "left":
x = head.xcor()
head.setx(x+3)

def DEVTOOLRESET():
head.direction = "Stop"
head.goto(0,-280)
score = 0
fallspeed = 0
score_this_round = 0
time.sleep(2)
fallspeed = 1.5
wn.listen()
wn.onkeypress(goright, "Right")
wn.onkeypress(goleft, "Left")
wn.onkeypress(goright, "d")
wn.onkeypress(goleft, "a")
wn.onkeypress(goright, "D")
wn.onkeypress(goleft, "A")
wn.onkeypress(stop, " ")
wn.onkeypress(DEVTOOLRESET, "r")
wn.onkeypress(DEVTOOLRESET, "R")
# main loop
while True:
wn.update()
Expand Down Expand Up @@ -150,7 +164,6 @@ def move():
if score_this_round == 5 or score_this_round > 5:
score += 1
score_this_round = 0
fallspeed += 0.075
if int(score) < 0:
pen.goto(0, 100)
pen.write("GAME OVER!\nrestart game", align="center", font=("helvetica", 20, "bold"))
Expand Down
2 changes: 1 addition & 1 deletion version.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
Version STABLE v1.0.0
Version STABLE v1.1

0 comments on commit 8e06da6

Please sign in to comment.