# HG changeset patch # User Emmanuel Gil Peyrot # Date 1347015278 -7200 # Node ID c25530efea3b981b147868ada19b035abdccb983 # Parent e0e284fcb288152f741011ae13e931a03a2faa70 Replace player position in game zone right after its move; fix shots offsets at boundaries. diff -r e0e284fcb288 -r c25530efea3b pytouhou/game/game.py --- a/pytouhou/game/game.py Thu Aug 30 11:34:56 2012 +0200 +++ b/pytouhou/game/game.py Fri Sep 07 12:54:38 2012 +0200 @@ -283,14 +283,6 @@ for player in self.players: player.update(keystate) #TODO: differentiate keystates (multiplayer mode) - if player.state.x < 8.: - player.state.x = 8. - if player.state.x > self.width - 8: - player.state.x = self.width - 8 - if player.state.y < 16.: - player.state.y = 16. - if player.state.y > self.height - 16: - player.state.y = self.height -16 #XXX: Why 78910? Is it really the right value? player.state.effective_score = min(player.state.effective_score + 78910, diff -r e0e284fcb288 -r c25530efea3b pytouhou/game/player.py --- a/pytouhou/game/player.py Thu Aug 30 11:34:56 2012 +0200 +++ b/pytouhou/game/player.py Fri Sep 07 12:54:38 2012 +0200 @@ -197,6 +197,15 @@ self.state.x += dx self.state.y += dy + if self.state.x < 8.: + self.state.x = 8. + if self.state.x > self._game.width - 8: + self.state.x = self._game.width - 8. + if self.state.y < 16.: + self.state.y = 16. + if self.state.y > self._game.height - 16: + self.state.y = self._game.height -16. + if not self.state.focused and keystate & 4: self.start_focusing() elif self.state.focused and not keystate & 4: