# HG changeset patch # User Jeremy Thurgood # Date 1252095932 0 # Node ID 653da96db572f7f05f9e88e448942568ea40879c # Parent 3074784c93f4a01ab0ad10c3e9bba95c6b199e3f Fixed dangling cursor sprite and did some TODO list maintenance. diff -r 3074784c93f4 -r 653da96db572 TODO --- a/TODO Fri Sep 04 20:23:30 2009 +0000 +++ b/TODO Fri Sep 04 20:25:32 2009 +0000 @@ -1,5 +1,9 @@ == TODO == +* Fix cursor sprite layering + +* Add invalid cursor sprite + * A BuildingFullError can be raised when attempting to hatch eggs in buildings. * Muzzle flashes! @@ -8,8 +12,6 @@ * Add the demolition fox -* Finish egg selling - * Our menu isn't friendly and buildings don't show their contents. * And we need to add a numerical overlay to show how many chickens are in a building. @@ -46,7 +48,3 @@ * simchicken! so are there gonna to be chicken processing plants? escaping chickens? * tzhau: We could add some sort of self-managing henhouse that sells chickens automatically to make space for hatching eggs. - -* Hodgestar: I see the ninja fox screenshot shows we have a chicken counting bug somewhere - * Nitwit: Is the chicken perhaps inside? Or is the number too low? - * Hodgestar: the number's too low - there are 5 chickens visible, but a count of only 4 diff -r 3074784c93f4 -r 653da96db572 gamelib/engine.py --- a/gamelib/engine.py Fri Sep 04 20:23:30 2009 +0000 +++ b/gamelib/engine.py Fri Sep 04 20:25:32 2009 +0000 @@ -120,7 +120,7 @@ if events_equal(e, START_NIGHT): return NightState(self.game) elif e.type is KEYDOWN and e.key == K_ESCAPE: - self.game.gameboard.reset_cursor() + self.game.gameboard.set_cursor() return GameOver(self.game) elif e.type is ANIM_ID: self.game.gameboard.run_animations() @@ -148,7 +148,7 @@ """Add some foxes to the farm""" sound.stop_background_music() self.game.gameboard.tv.sun(False) - self.game.gameboard.reset_cursor() + self.game.gameboard.set_cursor() sound.play_sound("nightfall.ogg") # Add a timer to the event queue @@ -168,7 +168,7 @@ elif e.type is KEYDOWN and e.key == K_d: return pygame.event.post(START_DAY) elif e.type is KEYDOWN and e.key == K_ESCAPE: - self.game.gameboard.reset_cursor() + self.game.gameboard.set_cursor() return GameOver(self.game) elif e.type is ANIM_ID: self.game.gameboard.run_animations() diff -r 3074784c93f4 -r 653da96db572 gamelib/gameboard.py --- a/gamelib/gameboard.py Fri Sep 04 20:23:30 2009 +0000 +++ b/gamelib/gameboard.py Fri Sep 04 20:25:32 2009 +0000 @@ -249,6 +249,12 @@ def set_selected_tool(self, tool, cursor): self.selected_tool = tool self.select_animal_to_place(None) + sprite_curs = None + if buildings.is_building(tool): + sprite_curs = sprite_cursor.SpriteCursor(tool.IMAGE, self.tv) + self.set_cursor(cursor, sprite_curs) + + def set_cursor(self, cursor=None, sprite_curs=None): if cursor: pygame.mouse.set_cursor(*cursor) else: @@ -256,12 +262,10 @@ if self.sprite_cursor: self.tv.sprites.remove(self.sprite_cursor) self.sprite_cursor = None - if buildings.is_building(tool): - self.sprite_cursor = sprite_cursor.SpriteCursor(tool.IMAGE, self.tv) + if sprite_curs: + self.sprite_cursor = sprite_curs self.tv.sprites.append(self.sprite_cursor) - - def reset_cursor(self): - pygame.mouse.set_cursor(*cursors.cursors['arrow']) + def update_sprite_cursor(self, e): tile_pos = self.tv.screen_to_tile(e.pos) @@ -279,7 +283,7 @@ def use_tool(self, e): if e.button == 3: # Right button self.selected_tool = None - self.reset_cursor() + self.set_cursor() elif e.button != 1: # Left button return if self.selected_tool == constants.TOOL_SELL_CHICKEN: