Mercurial > touhou
comparison pytouhou/game/player.py @ 152:86807b8a63bd
Add collisions with enemies and items.
author | Emmanuel Gil Peyrot <linkmauve@linkmauve.fr> |
---|---|
date | Sun, 09 Oct 2011 15:32:43 -0700 |
parents | c7f0fd9d2145 |
children | ebfd328e700c |
comparison
equal
deleted
inserted
replaced
151:5cf927cbd9c5 | 152:86807b8a63bd |
---|---|
67 self._sprite = Sprite() | 67 self._sprite = Sprite() |
68 self._anmrunner = ANMRunner(self.anm_wrapper, index, self._sprite) | 68 self._anmrunner = ANMRunner(self.anm_wrapper, index, self._sprite) |
69 self._anmrunner.run_frame() | 69 self._anmrunner.run_frame() |
70 | 70 |
71 | 71 |
72 def die(self): | |
73 self.state.lives -= 1 | |
74 self.state.x = 192.0 | |
75 self.state.y = 384.0 | |
76 #TODO: animation | |
77 #TODO: set invulnerability. | |
78 | |
79 | |
72 def update(self, keystate): | 80 def update(self, keystate): |
73 try: | 81 try: |
74 dx, dy = {16: (0.0, -1.0), 32: (0.0, 1.0), 64: (-1.0, 0.0), 128: (1.0, 0.0), | 82 dx, dy = {16: (0.0, -1.0), 32: (0.0, 1.0), 64: (-1.0, 0.0), 128: (1.0, 0.0), |
75 16|64: (-SQ2, -SQ2), 16|128: (SQ2, -SQ2), | 83 16|64: (-SQ2, -SQ2), 16|128: (SQ2, -SQ2), |
76 32|64: (-SQ2, SQ2), 32|128: (SQ2, SQ2)}[keystate & (16|32|64|128)] | 84 32|64: (-SQ2, SQ2), 32|128: (SQ2, SQ2)}[keystate & (16|32|64|128)] |