Mercurial > touhou
comparison pytouhou/game/game.py @ 475:9d4d52793eca
Experimental netplay! Yay!
author | Thibaut Girka <thib@sitedethib.com> |
---|---|
date | Wed, 28 Dec 2011 18:45:09 +0100 |
parents | 31460b2ec530 |
children | 1de67f332f00 |
comparison
equal
deleted
inserted
replaced
228:8f4cd1c01d22 | 475:9d4d52793eca |
---|---|
129 enemy = Enemy(pos, life, instr_type, bonus_dropped, die_score, self.enm_anm_wrapper, self) | 129 enemy = Enemy(pos, life, instr_type, bonus_dropped, die_score, self.enm_anm_wrapper, self) |
130 self.enemies.append(enemy) | 130 self.enemies.append(enemy) |
131 return enemy | 131 return enemy |
132 | 132 |
133 | 133 |
134 def run_iter(self, keystate): | 134 def run_iter(self, keystates): |
135 # 1. VMs. | 135 # 1. VMs. |
136 self.ecl_runner.run_iter() | 136 self.ecl_runner.run_iter() |
137 if self.frame % (32*60) == (32*60): #TODO: check if that is really that frame. | 137 if self.frame % (32*60) == (32*60): #TODO: check if that is really that frame. |
138 self.modify_difficulty(+100) | 138 self.modify_difficulty(+100) |
139 | 139 |
149 # In the original game, updates are done in prioritized functions called "chains" | 149 # In the original game, updates are done in prioritized functions called "chains" |
150 # We have to mimic this functionnality to be replay-compatible with the official game. | 150 # We have to mimic this functionnality to be replay-compatible with the official game. |
151 | 151 |
152 # Pri 6 is background | 152 # Pri 6 is background |
153 self.update_effect() #TODO: Pri unknown | 153 self.update_effect() #TODO: Pri unknown |
154 self.update_players(keystate) # Pri 7 | 154 self.update_players(keystates) # Pri 7 |
155 self.update_enemies() # Pri 9 | 155 self.update_enemies() # Pri 9 |
156 self.update_effects() # Pri 10 | 156 self.update_effects() # Pri 10 |
157 self.update_bullets() # Pri 11 | 157 self.update_bullets() # Pri 11 |
158 # Pri 12 is HUD | 158 # Pri 12 is HUD |
159 | 159 |
171 def update_enemies(self): | 171 def update_enemies(self): |
172 for enemy in self.enemies: | 172 for enemy in self.enemies: |
173 enemy.update() | 173 enemy.update() |
174 | 174 |
175 | 175 |
176 def update_players(self, keystate): | 176 def update_players(self, keystates): |
177 for player in self.players: | 177 for player, keystate in zip(self.players, keystates): |
178 player.update(keystate) #TODO: differentiate keystates (multiplayer mode) | 178 player.update(keystate) #TODO: differentiate keystates (multiplayer mode) |
179 if player.state.x < 8.: | 179 if player.state.x < 8.: |
180 player.state.x = 8. | 180 player.state.x = 8. |
181 if player.state.x > self.width - 8: | 181 if player.state.x > self.width - 8: |
182 player.state.x = self.width - 8 | 182 player.state.x = self.width - 8 |