Mercurial > touhou
comparison pytouhou/game/game.py @ 156:ebfd328e700c
Rename a few functions, move a few things around...
author | Thibaut Girka <thib@sitedethib.com> |
---|---|
date | Mon, 10 Oct 2011 18:34:36 +0200 |
parents | 364935f6e313 |
children | ca6f8b3f739d |
comparison
equal
deleted
inserted
replaced
155:ed86bec43b93 | 156:ebfd328e700c |
---|---|
116 bx1, bx2 = bx - half_size, bx + half_size | 116 bx1, bx2 = bx - half_size, bx + half_size |
117 by1, by2 = by - half_size, by + half_size | 117 by1, by2 = by - half_size, by + half_size |
118 | 118 |
119 if not (bx2 < px1 or bx1 > px2 | 119 if not (bx2 < px1 or bx1 > px2 |
120 or by2 < py1 or by1 > py2): | 120 or by2 < py1 or by1 > py2): |
121 bullet.collide(player) | 121 bullet.collide() |
122 player.collide() | |
122 | 123 |
123 for enemy in self.enemies: | 124 for enemy in self.enemies: |
124 half_size_x, half_size_y = enemy.hitbox_half_size | 125 half_size_x, half_size_y = enemy.hitbox_half_size |
125 bx, by = enemy.x, enemy.y | 126 bx, by = enemy.x, enemy.y |
126 bx1, bx2 = bx - half_size_x, bx + half_size_x | 127 bx1, bx2 = bx - half_size_x, bx + half_size_x |
127 by1, by2 = by - half_size_y, by + half_size_y | 128 by1, by2 = by - half_size_y, by + half_size_y |
128 | 129 |
129 if not (bx2 < px1 or bx1 > px2 | 130 if enemy.touchable and not (bx2 < px1 or bx1 > px2 |
130 or by2 < py1 or by1 > py2): | 131 or by2 < py1 or by1 > py2): |
131 enemy.collide(player) | 132 enemy.collide() |
133 player.collide() | |
132 | 134 |
133 for item in self.items: | 135 for item in self.items: |
134 half_size = item.hitbox_half_size | 136 half_size = item.hitbox_half_size |
135 bx, by = item.x, item.y | 137 bx, by = item.x, item.y |
136 bx1, bx2 = bx - half_size, bx + half_size | 138 bx1, bx2 = bx - half_size, bx + half_size |
137 by1, by2 = by - half_size, by + half_size | 139 by1, by2 = by - half_size, by + half_size |
138 | 140 |
139 if not (bx2 < px1 or bx1 > px2 | 141 if not (bx2 < px1 or bx1 > px2 |
140 or by2 < py1 or by1 > py2): | 142 or by2 < py1 or by1 > py2): |
141 item.collect(player) | 143 player.collect(item) |
142 | 144 |
143 # 5. Cleaning | 145 # 5. Cleaning |
144 self.cleanup() | 146 self.cleanup() |
145 | 147 |
146 self.frame += 1 | 148 self.frame += 1 |