Skip to content

Commit

Permalink
修复显示问题
Browse files Browse the repository at this point in the history
  • Loading branch information
wszqkzqk committed Aug 5, 2022
1 parent d93acfe commit 8067508
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 23 deletions.
21 changes: 13 additions & 8 deletions source/component/map.py
Original file line number Diff line number Diff line change
Expand Up @@ -360,16 +360,21 @@ def checkPlantToSeed(self, x, y, plant_name):
LITTLE_GAME_MAP_DATA = (
# 第0关 测试
{
c.BACKGROUND_TYPE: 6,
c.BACKGROUND_TYPE: 3,
c.GAME_TITLE: "隐藏测试关卡",
c.CHOOSEBAR_TYPE: c.CHOOSEBAR_BOWLING,
c.SHOVEL: 0,
c.CHOOSEBAR_TYPE: c.CHOOSEBAR_MOVE,
c.SHOVEL: 1,
c.SPAWN_ZOMBIES:c.SPAWN_ZOMBIES_AUTO,
c.INCLUDED_ZOMBIES: ( c.POLE_VAULTING_ZOMBIE,),
c.NUM_FLAGS:1,
c.CARD_POOL: { c.WALLNUTBOWLING: 0,
c.REDWALLNUTBOWLING: 0,
c.GIANTWALLNUT:100,}
c.INCLUDED_ZOMBIES: ( c.NORMAL_ZOMBIE, c.NEWSPAPER_ZOMBIE,
c.ZOMBONI, c.FOOTBALL_ZOMBIE,
c.CONEHEAD_ZOMBIE, c.BUCKETHEAD_ZOMBIE),
c.NUM_FLAGS:4,
c.CARD_POOL: { c.LILYPAD: 300,
c.STARFRUIT: 400,
c.PUMPKINHEAD: 100,
c.SEASHROOM: 100,
c.SPIKEWEED: 100,
}
},
# 第1关 坚果保龄球
{
Expand Down
3 changes: 1 addition & 2 deletions source/component/plant.py
Original file line number Diff line number Diff line change
Expand Up @@ -195,8 +195,7 @@ def update(self, game_info):
self.rect.x += 7
self.rect.y += 7
elif self.direction == c.STAR_UPWARD:
# 实际上不知道为什么向上飞的看起来要快一些,所以拟合的时候把速度调小了一点
self.rect.y -= 9
self.rect.y -= 10
elif self.direction == c.STAR_DOWNWARD:
self.rect.y += 10
else:
Expand Down
21 changes: 8 additions & 13 deletions source/state/level.py
Original file line number Diff line number Diff line change
Expand Up @@ -1547,6 +1547,14 @@ def draw(self, surface):
self.showAllContentOfMenu(surface)
# 以后可能需要插入一个预备的状态(预览显示僵尸、返回战场)
elif self.state == c.PLAY:
if self.has_shovel:
# 画铲子
surface.blit(self.shovel_box, self.shovel_box_rect)
surface.blit(self.shovel, self.shovel_rect)
# 画小菜单
surface.blit(self.little_menu, self.little_menu_rect)

self.menubar.draw(surface)
for i in range(self.map_y_len):
self.plant_groups[i].draw(surface)
self.zombie_groups[i].draw(surface)
Expand All @@ -1556,19 +1564,6 @@ def draw(self, surface):
if self.cars[i]:
self.cars[i].draw(surface)
self.head_group.draw(surface)

# 浓雾模式的雾
#if self.background_type == c.BACKGROUND_FOG:
# pg.draw.rect(surface, c.LIGHTGRAY, (400, 0, 400, 600))

if self.has_shovel:
# 画铲子
surface.blit(self.shovel_box, self.shovel_box_rect)
surface.blit(self.shovel, self.shovel_rect)
# 画小菜单
surface.blit(self.little_menu, self.little_menu_rect)

self.menubar.draw(surface)
self.sun_group.draw(surface)

if self.drag_plant:
Expand Down

0 comments on commit 8067508

Please sign in to comment.