Permalink
Browse files

Force drawing of (potentially) unchanged Entities first time they app…

…ear on screen
  • Loading branch information...
1 parent 6afc8e1 commit bfe482f006e65fdc389b07630284603efa5a5def @szabba committed Dec 14, 2012
Showing with 8 additions and 2 deletions.
  1. +8 −2 src/entity.py
View
@@ -61,8 +61,7 @@ def __init__(self, pos, b_box, r_box, state, behaviour,
self.__curr_wrap = StateWrapper(self.__curr)
self.__prev_wrap = StateWrapper(self.__prev)
- self.__needs_redraw = True
- self.__seen_if_others_need_redraw = False
+ self.__was_drawn = False
# Initialise the next and current state
for st in (self.__next, self.__curr, self.__prev):
@@ -138,6 +137,13 @@ def needs_redraw(self, viewport, others=set()):
# Something that isn't on screen never needs to be redrawn
if collide(self.__next.r_box, viewport):
+ # Force the drawing of new Entities first time they apppear on
+ # screen
+ if not self.__was_drawn:
+
+ self.__was_drawn = True
+ return True
+
# See if a redraw is necessary due to changes in the entity itself
moved = self.present().r_box() != self.past().r_box()
sprite_changed = self.present().state_name() != self.past().state_name()

0 comments on commit bfe482f

Please sign in to comment.