comparison pytouhou/game/player.py @ 380:c25530efea3b

Replace player position in game zone right after its move; fix shots offsets at boundaries.
author Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
date Fri, 07 Sep 2012 12:54:38 +0200
parents e0e284fcb288
children 690b5faaa0e6
comparison
equal deleted inserted replaced
379:e0e284fcb288 380:c25530efea3b
195 self.direction = None 195 self.direction = None
196 196
197 self.state.x += dx 197 self.state.x += dx
198 self.state.y += dy 198 self.state.y += dy
199 199
200 if self.state.x < 8.:
201 self.state.x = 8.
202 if self.state.x > self._game.width - 8:
203 self.state.x = self._game.width - 8.
204 if self.state.y < 16.:
205 self.state.y = 16.
206 if self.state.y > self._game.height - 16:
207 self.state.y = self._game.height -16.
208
200 if not self.state.focused and keystate & 4: 209 if not self.state.focused and keystate & 4:
201 self.start_focusing() 210 self.start_focusing()
202 elif self.state.focused and not keystate & 4: 211 elif self.state.focused and not keystate & 4:
203 self.stop_focusing() 212 self.stop_focusing()
204 213