Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlan Aguiar <alanjas@hotmail.com>2013-04-08 21:22:22 (GMT)
committer Alan Aguiar <alanjas@hotmail.com>2013-04-08 21:22:22 (GMT)
commit2b3b81d0f904e8146e5f4d4f58a6fd082610a673 (patch)
tree2f257d71bee6a728a6dcf1c21f7d1c38d2534212
parente337080afa6996b8954e18c4d51e14bb14bf5efe (diff)
esc no close the game
-rwxr-xr-xhorse.py12
1 files changed, 6 insertions, 6 deletions
diff --git a/horse.py b/horse.py
index 74c5b8c..488a1ef 100755
--- a/horse.py
+++ b/horse.py
@@ -118,18 +118,18 @@ class Game():
#adj_loc = location
self.objects.append((image, location))
- def adjust_loc(self,loc,object_size):
+ def adjust_loc(self, loc, object_size):
"""adjust the given location by half the object size. Thus the center of the object will be at loc"""
adj_loc = (loc[0]-object_size[0]/2,loc[1]-object_size[1]/2)
return adj_loc
- def handleEvent(self,event):
+ def handleEvent(self, event):
if event.type == pygame.QUIT:
self.game_running = False
elif event.type == pygame.KEYDOWN:
- if event.key in (27,113): # esc or q=quit
- self.game_running = False
- elif event.key == 97: # a=apple
+ #if event.key in (27,113): # esc or q=quit
+ # self.game_running = False
+ if event.key == 97: # a=apple
self.placeObject(self.apple_image, self.mouse_pos)
elif event.key == 99: # c=carrot
self.placeObject(self.carrot_image, self.mouse_pos)
@@ -142,7 +142,7 @@ class Game():
# Remember mouse location, because we need it in KEYDOWN events
self.mouse_pos = event.pos
- def tick(self,millis):
+ def tick(self, millis):
"""updates the game state for a tick"""
# millis is ignored
if len(self.objects)>0: