diff --git a/source/component/map.py b/source/component/map.py index 531008a..eb1f393 100755 --- a/source/component/map.py +++ b/source/component/map.py @@ -1,4 +1,3 @@ -__author__ = 'wszqkzqk' import random import pygame as pg from .. import tool diff --git a/source/component/menubar.py b/source/component/menubar.py index 69c0328..44585f8 100755 --- a/source/component/menubar.py +++ b/source/component/menubar.py @@ -1,4 +1,3 @@ -__author__ = 'wszqkzqk' import os import random import pygame as pg diff --git a/source/component/plant.py b/source/component/plant.py index 065b68d..617c006 100755 --- a/source/component/plant.py +++ b/source/component/plant.py @@ -1,4 +1,3 @@ -__author__ = 'wszqkzqk' import random import pygame as pg from .. import tool diff --git a/source/component/zombie.py b/source/component/zombie.py index ba918a9..cf604d3 100755 --- a/source/component/zombie.py +++ b/source/component/zombie.py @@ -1,4 +1,3 @@ -__author__ = 'wszqkzqk' import pygame as pg from .. import tool from .. import constants as c diff --git a/source/constants.py b/source/constants.py index c2984d5..85b9ed2 100755 --- a/source/constants.py +++ b/source/constants.py @@ -1,4 +1,3 @@ -__author__ = 'wszqkzqk' START_LEVEL_NUM = 1 START_LITTLE_GAME_NUM = 1 @@ -47,6 +46,7 @@ SHOVEL_BOX = 'shovelBox' #GAME INFO DICTIONARY KEYS CURRENT_TIME = 'current time' LEVEL_NUM = 'level num' +LITTLEGAME_NUM = 'littleGame num' #STATES FOR ENTIRE GAME MAIN_MENU = 'main menu' diff --git a/source/state/level.py b/source/state/level.py index 4748939..ce0fc0e 100644 --- a/source/state/level.py +++ b/source/state/level.py @@ -1,4 +1,3 @@ -__author__ = 'wszqkzqk' import os import json import sys @@ -321,7 +320,8 @@ class Level(tool.State): elif self.checkMainMenuClick(mouse_pos): self.done = True self.next = c.MAIN_MENU - self.persist = {c.CURRENT_TIME:0.0, c.LEVEL_NUM:c.START_LEVEL_NUM} + #self.persist = {c.CURRENT_TIME:0.0, c.LEVEL_NUM:c.START_LEVEL_NUM} # 应该不能用c.LEVEL_NUM:c.START_LEVEL_NUM + self.persist = {c.CURRENT_TIME:0.0, c.LEVEL_NUM:self.persist[c.LEVEL_NUM], c.LITTLEGAME_NUM:self.persist[c.LITTLEGAME_NUM]} pg.mixer.music.stop() pg.mixer.music.load(os.path.join(os.path.dirname(os.path.dirname(os.path.dirname(__file__))) ,"resources", "music", "intro.opus")) pg.mixer.music.play(-1, 0) @@ -675,7 +675,7 @@ class Level(tool.State): _, map_y = self.map.getMapIndex(zombie.rect.centerx, zombie.rect.bottom) self.zombie_groups[map_y].remove(zombie) self.hypno_zombie_groups[map_y].add(zombie) - elif (plant.name == c.POTATOMINE and not plant.is_init): + elif (plant.name == c.POTATOMINE and not plant.is_init): # 土豆雷不是灰烬植物,不能用Boom zombie.setDamage(1800) # 避免僵尸在用铲子移除植物后还在原位啃食 plant.health = 0 @@ -782,7 +782,10 @@ class Level(tool.State): def checkGameState(self): if self.checkVictory(): - self.game_info[c.LEVEL_NUM] += 1 + if c.LITTLEGAME_BUTTON in self.game_info: + self.game_info[c.LITTLEGAME_NUM] += 1 + else: + self.game_info[c.LEVEL_NUM] += 1 self.next = c.GAME_VICTORY self.done = True elif self.checkLose(): diff --git a/source/state/mainmenu.py b/source/state/mainmenu.py index 9daf551..8ac797d 100644 --- a/source/state/mainmenu.py +++ b/source/state/mainmenu.py @@ -1,4 +1,3 @@ -__author__ = 'wszqkzqk' import pygame as pg from .. import tool from .. import constants as c diff --git a/source/state/screen.py b/source/state/screen.py index 379d2be..d53f548 100644 --- a/source/state/screen.py +++ b/source/state/screen.py @@ -1,4 +1,3 @@ -__author__ = 'wszqkzqk' import pygame as pg from .. import tool from .. import constants as c diff --git a/source/tool.py b/source/tool.py index 957e22a..b99773a 100755 --- a/source/tool.py +++ b/source/tool.py @@ -1,4 +1,3 @@ -__author__ = 'wszqkzqk' import os import json import sys @@ -44,7 +43,8 @@ class Control(): self.state_name = None self.state = None self.game_info = {c.CURRENT_TIME:0.0, - c.LEVEL_NUM:c.START_LEVEL_NUM} + c.LEVEL_NUM:c.START_LEVEL_NUM, + c.LITTLEGAME_NUM:c.START_LITTLE_GAME_NUM} def setup_states(self, state_dict, start_state): self.state_dict = state_dict