修改细节和调试功能
This commit is contained in:
parent
363a39e6ea
commit
db2e25e6d2
@ -2,7 +2,7 @@
|
|||||||
"background_type":2,
|
"background_type":2,
|
||||||
"init_sun_value":5000,
|
"init_sun_value":5000,
|
||||||
"shovel":1,
|
"shovel":1,
|
||||||
"spawn_zombies":"zombie_list",
|
"spawn_zombies":"list",
|
||||||
"zombie_list":[
|
"zombie_list":[
|
||||||
{"time":1000, "map_y":2, "name":"FootballZombie"},
|
{"time":1000, "map_y":2, "name":"FootballZombie"},
|
||||||
{"time":60000, "map_y":2, "name":"Zombie"}
|
{"time":60000, "map_y":2, "name":"Zombie"}
|
||||||
|
|||||||
@ -104,7 +104,7 @@ def getSunValueImage(sun_value):
|
|||||||
# for pack, must include ttf
|
# for pack, must include ttf
|
||||||
fontPath = os.path.join(os.path.dirname(os.path.dirname(os.path.dirname(__file__))),'resources', 'freesansbold.ttf')
|
fontPath = os.path.join(os.path.dirname(os.path.dirname(os.path.dirname(__file__))),'resources', 'freesansbold.ttf')
|
||||||
font = pg.font.Font(fontPath, 14)
|
font = pg.font.Font(fontPath, 14)
|
||||||
width = 32
|
width = 35
|
||||||
msg_image = font.render(str(sun_value), True, c.NAVYBLUE, c.LIGHTYELLOW)
|
msg_image = font.render(str(sun_value), True, c.NAVYBLUE, c.LIGHTYELLOW)
|
||||||
msg_rect = msg_image.get_rect()
|
msg_rect = msg_image.get_rect()
|
||||||
msg_w = msg_rect.width
|
msg_w = msg_rect.width
|
||||||
|
|||||||
@ -290,7 +290,7 @@ class Plant(pg.sprite.Sprite):
|
|||||||
|
|
||||||
def canAttack(self, zombie):
|
def canAttack(self, zombie):
|
||||||
if (self.state != c.SLEEP and zombie.state != c.DIE and (not zombie.lostHead) and
|
if (self.state != c.SLEEP and zombie.state != c.DIE and (not zombie.lostHead) and
|
||||||
self.rect.x <= zombie.rect.right):
|
self.rect.x <= zombie.rect.right and zombie.rect.left <= 800):
|
||||||
return True
|
return True
|
||||||
return False
|
return False
|
||||||
|
|
||||||
@ -1160,8 +1160,8 @@ class StarFruit(Plant):
|
|||||||
|
|
||||||
def attacking(self):
|
def attacking(self):
|
||||||
if (self.current_time - self.shoot_timer) > 1400:
|
if (self.current_time - self.shoot_timer) > 1400:
|
||||||
self.bullet_group.add(StarBullet(self.rect.left + 5, self.rect.y + 15, c.BULLET_DAMAGE_NORMAL, c.STAR_BACKWARD, self.level))
|
self.bullet_group.add(StarBullet(self.rect.left - 10, self.rect.y + 15, c.BULLET_DAMAGE_NORMAL, c.STAR_BACKWARD, self.level))
|
||||||
self.bullet_group.add(StarBullet(self.rect.centerx - 20, self.rect.bottom - self.rect.h + 5, c.BULLET_DAMAGE_NORMAL, c.STAR_UPWARD, self.level))
|
self.bullet_group.add(StarBullet(self.rect.centerx - 20, self.rect.bottom - self.rect.h - 15, c.BULLET_DAMAGE_NORMAL, c.STAR_UPWARD, self.level))
|
||||||
self.bullet_group.add(StarBullet(self.rect.centerx - 20, self.rect.bottom - 5, c.BULLET_DAMAGE_NORMAL, c.STAR_DOWNWARD, self.level))
|
self.bullet_group.add(StarBullet(self.rect.centerx - 20, self.rect.bottom - 5, c.BULLET_DAMAGE_NORMAL, c.STAR_DOWNWARD, self.level))
|
||||||
self.bullet_group.add(StarBullet(self.rect.right - 5, self.rect.bottom - 20, c.BULLET_DAMAGE_NORMAL, c.STAR_FORWARD_DOWN, self.level))
|
self.bullet_group.add(StarBullet(self.rect.right - 5, self.rect.bottom - 20, c.BULLET_DAMAGE_NORMAL, c.STAR_FORWARD_DOWN, self.level))
|
||||||
self.bullet_group.add(StarBullet(self.rect.right - 5, self.rect.y - 10, c.BULLET_DAMAGE_NORMAL, c.STAR_FORWARD_UP, self.level))
|
self.bullet_group.add(StarBullet(self.rect.right - 5, self.rect.y - 10, c.BULLET_DAMAGE_NORMAL, c.STAR_FORWARD_UP, self.level))
|
||||||
|
|||||||
@ -636,11 +636,14 @@ class Level(tool.State):
|
|||||||
else:
|
else:
|
||||||
map_y = randint(0, 4)
|
map_y = randint(0, 4)
|
||||||
|
|
||||||
# 旗帜波出生点右移
|
if not ((c.ZOMBIE_LIST in self.map_data.keys()) and self.map_data[c.SPAWN_ZOMBIES] == c.SPAWN_ZOMBIES_LIST):
|
||||||
if self.waveNum % 10:
|
# 旗帜波出生点右移
|
||||||
hugeWaveMove = 0
|
if self.waveNum % 10:
|
||||||
|
hugeWaveMove = 0
|
||||||
|
else:
|
||||||
|
hugeWaveMove = 40
|
||||||
else:
|
else:
|
||||||
hugeWaveMove = 40
|
hugeWaveMove = 0
|
||||||
x, y = self.map.getMapGridPos(0, map_y)
|
x, y = self.map.getMapGridPos(0, map_y)
|
||||||
# 新增的僵尸也需要在这里声明
|
# 新增的僵尸也需要在这里声明
|
||||||
if name == c.NORMAL_ZOMBIE:
|
if name == c.NORMAL_ZOMBIE:
|
||||||
@ -1179,5 +1182,4 @@ class Level(tool.State):
|
|||||||
if not ((c.ZOMBIE_LIST in self.map_data.keys()) and self.map_data[c.SPAWN_ZOMBIES] == c.SPAWN_ZOMBIES_LIST):
|
if not ((c.ZOMBIE_LIST in self.map_data.keys()) and self.map_data[c.SPAWN_ZOMBIES] == c.SPAWN_ZOMBIES_LIST):
|
||||||
if self.current_time - self.showHugeWaveApprochingTime <= 2000:
|
if self.current_time - self.showHugeWaveApprochingTime <= 2000:
|
||||||
surface.blit(self.huge_wave_approching_image, self.huge_wave_approching_image_rect)
|
surface.blit(self.huge_wave_approching_image, self.huge_wave_approching_image_rect)
|
||||||
|
self.showLevelProgress(surface)
|
||||||
self.showLevelProgress(surface)
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user