修改小推车实现方式
This commit is contained in:
parent
96a6a019b6
commit
1f42c0271f
@ -13,6 +13,8 @@ GRID_Y_LEN = 5
|
|||||||
GRID_X_SIZE = 80
|
GRID_X_SIZE = 80
|
||||||
GRID_Y_SIZE = 100
|
GRID_Y_SIZE = 100
|
||||||
|
|
||||||
|
# 游戏速度倍率(调试用)
|
||||||
|
GAME_RATE = 1
|
||||||
|
|
||||||
WHITE = (255, 255, 255)
|
WHITE = (255, 255, 255)
|
||||||
NAVYBLUE = ( 60, 60, 100)
|
NAVYBLUE = ( 60, 60, 100)
|
||||||
|
|||||||
@ -628,13 +628,13 @@ class Level(tool.State):
|
|||||||
hypno_zombie.setAttack(zombie, False)
|
hypno_zombie.setAttack(zombie, False)
|
||||||
|
|
||||||
def checkCarCollisions(self):
|
def checkCarCollisions(self):
|
||||||
collided_func = pg.sprite.collide_circle_ratio(0.6)
|
|
||||||
for car in self.cars:
|
for car in self.cars:
|
||||||
zombies = pg.sprite.spritecollide(car, self.zombie_groups[car.map_y], False, collided_func)
|
for zombie in self.zombie_groups[car.map_y]:
|
||||||
for zombie in zombies:
|
if zombie and zombie.state != c.DIE and (not zombie.lostHead) and zombie.rect.x <= 0:
|
||||||
if zombie and zombie.state != c.DIE and (not zombie.lostHead):
|
|
||||||
car.setWalk()
|
car.setWalk()
|
||||||
zombie.setDie()
|
if zombie.rect.x <= car.rect.x:
|
||||||
|
zombie.health = 0
|
||||||
|
zombie.kill()
|
||||||
if car.dead:
|
if car.dead:
|
||||||
self.cars.remove(car)
|
self.cars.remove(car)
|
||||||
|
|
||||||
|
|||||||
@ -54,7 +54,7 @@ class Control():
|
|||||||
|
|
||||||
def update(self):
|
def update(self):
|
||||||
# 返回自 pygame_init() 调用以来的毫秒数
|
# 返回自 pygame_init() 调用以来的毫秒数
|
||||||
self.current_time = pg.time.get_ticks()
|
self.current_time = pg.time.get_ticks() * c.GAME_RATE
|
||||||
|
|
||||||
if self.state.done:
|
if self.state.done:
|
||||||
self.flip_state()
|
self.flip_state()
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user