diff --git a/NS.py b/NS.py index fef63ee..8d78d2c 100644 --- a/NS.py +++ b/NS.py @@ -79,7 +79,17 @@ class NS(Game, Animation): self.dialogue = Dialogue(self) self.chemtrails = Chemtrails(self) self.boss = Boss(self) - self.get_configuration().type_declarations.add("bool", "input", "serial") + self.get_configuration().type_declarations.add_chart( + { + "time": + { + "int": ["timer-max-time", "timer-start-time", "timer-addition", "sword-delay"] + }, + "input": + { + "bool": "serial" + } + }) if self.serial_enabled(): self.serial_kill = False self.serial_data = 0 @@ -106,6 +116,7 @@ class NS(Game, Animation): output = self.serial_reader.readline().strip() if output: self.serial_data = int(output, 2) + self.idle_elapsed = 0 else: self.serial_data = 0 @@ -894,8 +905,6 @@ class Light(Animation): class Chemtrails(Sprite): - TIME_ADDITION = 1000 - def __init__(self, parent): Sprite.__init__(self, parent) self.load_from_path(self.get_resource("littleSlimeGoop"), True) @@ -940,7 +949,7 @@ class Chemtrails(Sprite): boss = self.get_game().boss queue = boss.queue if self.orientation == queue[self.queue_index]: - self.timer.add_time(self.TIME_ADDITION) + self.timer.add_time(self.get_configuration("time", "timer-addition")) if boss.level_index == 0: boss.health.decrease(4) elif boss.level_index == 1: @@ -999,8 +1008,6 @@ class Timer(GameChild): TEXT = u"\u25F7" BAR_POSITION = 448, 11 - MAX_TIME = 10000 - START_TIME = 7000 def __init__(self, parent): GameChild.__init__(self, parent) @@ -1017,7 +1024,7 @@ class Timer(GameChild): self.label.location.topright = dsr.right - 2, 5 def reset(self): - self.time_remaining = self.START_TIME + self.time_remaining = self.get_configuration("time", "timer-start-time") def add_time(self, amount): self.time_remaining += amount @@ -1036,7 +1043,8 @@ class Timer(GameChild): color = Color("red") mask = Surface(self.bar.get_size()) mask.fill((128, 128, 128)) - width = min(mask.get_width(), mask.get_width() * self.time_remaining / float(self.MAX_TIME)) + width = min(mask.get_width(), mask.get_width() * float(self.time_remaining) / + self.get_configuration("time", "timer-max-time")) mask.fill(color, (mask.get_width() - width, 0, width, mask.get_height())) surface = self.bar.copy() surface.blit(mask, (0, 0), None, BLEND_RGBA_MIN) @@ -1504,7 +1512,8 @@ class Sword(Animation): self.get_game().sfx["brandish"].play() self.play(self.lower, delay=400, play_once=True) if len(self.parent.unbrandished) > 0: - self.play(self.brandish, delay=600, play_once=True) + self.play(self.brandish, delay=self.get_configuration("time", "sword-delay"), + play_once=True) def lower(self): # self.hide() diff --git a/config b/config index 0f37cb4..e2fa475 100644 --- a/config +++ b/config @@ -27,3 +27,9 @@ sfx-volume = .8 buffer = 0 arduino-port = /dev/ttyACM0 serial = yes + +[time] +timer-max-time = 10000 +timer-start-time = 7000 +timer-addition = 1000 +sword-delay = 300 diff --git a/resource/scores b/resource/scores index 64c5761..421f809 100644 --- a/resource/scores +++ b/resource/scores @@ -20,3 +20,12 @@ 130375 134183 174976 +142026 +140320 +132416 +159243 +227709 +153523 +155712 +247891 +178357