Skip to content

Commit

Permalink
Fix a bug in the RandomActuator.
Browse files Browse the repository at this point in the history
Fix a potential performance issue in Sprite.render_to_buffer.
  • Loading branch information
arnauddupuis committed Aug 7, 2022
1 parent 1c6dd2e commit 2cdee44
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
3 changes: 2 additions & 1 deletion pygamelib/actuators.py
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,8 @@ def next_move(self):
if isinstance(self.parent, board_items.Movable):
ppav = self.parent.position_as_vector()
if (
self.__current_dir_move_left <= 0
self.__current_dir_move_left is None
or self.__current_dir_move_left <= 0
or ppav != self.__projected_position_cache
):

Expand Down
4 changes: 3 additions & 1 deletion pygamelib/gfx/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -1001,6 +1001,8 @@ def __init__(
self.parent = parent
self.name = name
self.default_sprixel = default_sprixel
self.row_offset = 0
self.column_offset = 0
# Double linking here, GC will hate it...
self._initial_text_object = None
if self.name is None or type(self.name) is not str:
Expand Down Expand Up @@ -1594,7 +1596,7 @@ def render_to_buffer(self, buffer, row, column, buffer_height, buffer_width):
# buffer[sr][sc] = sprix.__repr__()
buffer[sr][sc] = sprix
for c in range(sc + 1, sc + sprix.length):
buffer[sr][c] = Sprixel()
buffer[sr][c] = null_sprixel


class SpriteCollection(UserDict):
Expand Down

0 comments on commit 2cdee44

Please sign in to comment.