diff options
-rwxr-xr-x | horse.py | 12 |
1 files changed, 6 insertions, 6 deletions
@@ -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: |