chart
This commit is contained in:
parent
62e5e2e50b
commit
6b17bb1e24
27
NS.py
27
NS.py
|
@ -79,7 +79,17 @@ class NS(Game, Animation):
|
||||||
self.dialogue = Dialogue(self)
|
self.dialogue = Dialogue(self)
|
||||||
self.chemtrails = Chemtrails(self)
|
self.chemtrails = Chemtrails(self)
|
||||||
self.boss = Boss(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():
|
if self.serial_enabled():
|
||||||
self.serial_kill = False
|
self.serial_kill = False
|
||||||
self.serial_data = 0
|
self.serial_data = 0
|
||||||
|
@ -106,6 +116,7 @@ class NS(Game, Animation):
|
||||||
output = self.serial_reader.readline().strip()
|
output = self.serial_reader.readline().strip()
|
||||||
if output:
|
if output:
|
||||||
self.serial_data = int(output, 2)
|
self.serial_data = int(output, 2)
|
||||||
|
self.idle_elapsed = 0
|
||||||
else:
|
else:
|
||||||
self.serial_data = 0
|
self.serial_data = 0
|
||||||
|
|
||||||
|
@ -894,8 +905,6 @@ class Light(Animation):
|
||||||
|
|
||||||
class Chemtrails(Sprite):
|
class Chemtrails(Sprite):
|
||||||
|
|
||||||
TIME_ADDITION = 1000
|
|
||||||
|
|
||||||
def __init__(self, parent):
|
def __init__(self, parent):
|
||||||
Sprite.__init__(self, parent)
|
Sprite.__init__(self, parent)
|
||||||
self.load_from_path(self.get_resource("littleSlimeGoop"), True)
|
self.load_from_path(self.get_resource("littleSlimeGoop"), True)
|
||||||
|
@ -940,7 +949,7 @@ class Chemtrails(Sprite):
|
||||||
boss = self.get_game().boss
|
boss = self.get_game().boss
|
||||||
queue = boss.queue
|
queue = boss.queue
|
||||||
if self.orientation == queue[self.queue_index]:
|
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:
|
if boss.level_index == 0:
|
||||||
boss.health.decrease(4)
|
boss.health.decrease(4)
|
||||||
elif boss.level_index == 1:
|
elif boss.level_index == 1:
|
||||||
|
@ -999,8 +1008,6 @@ class Timer(GameChild):
|
||||||
|
|
||||||
TEXT = u"\u25F7"
|
TEXT = u"\u25F7"
|
||||||
BAR_POSITION = 448, 11
|
BAR_POSITION = 448, 11
|
||||||
MAX_TIME = 10000
|
|
||||||
START_TIME = 7000
|
|
||||||
|
|
||||||
def __init__(self, parent):
|
def __init__(self, parent):
|
||||||
GameChild.__init__(self, parent)
|
GameChild.__init__(self, parent)
|
||||||
|
@ -1017,7 +1024,7 @@ class Timer(GameChild):
|
||||||
self.label.location.topright = dsr.right - 2, 5
|
self.label.location.topright = dsr.right - 2, 5
|
||||||
|
|
||||||
def reset(self):
|
def reset(self):
|
||||||
self.time_remaining = self.START_TIME
|
self.time_remaining = self.get_configuration("time", "timer-start-time")
|
||||||
|
|
||||||
def add_time(self, amount):
|
def add_time(self, amount):
|
||||||
self.time_remaining += amount
|
self.time_remaining += amount
|
||||||
|
@ -1036,7 +1043,8 @@ class Timer(GameChild):
|
||||||
color = Color("red")
|
color = Color("red")
|
||||||
mask = Surface(self.bar.get_size())
|
mask = Surface(self.bar.get_size())
|
||||||
mask.fill((128, 128, 128))
|
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()))
|
mask.fill(color, (mask.get_width() - width, 0, width, mask.get_height()))
|
||||||
surface = self.bar.copy()
|
surface = self.bar.copy()
|
||||||
surface.blit(mask, (0, 0), None, BLEND_RGBA_MIN)
|
surface.blit(mask, (0, 0), None, BLEND_RGBA_MIN)
|
||||||
|
@ -1504,7 +1512,8 @@ class Sword(Animation):
|
||||||
self.get_game().sfx["brandish"].play()
|
self.get_game().sfx["brandish"].play()
|
||||||
self.play(self.lower, delay=400, play_once=True)
|
self.play(self.lower, delay=400, play_once=True)
|
||||||
if len(self.parent.unbrandished) > 0:
|
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):
|
def lower(self):
|
||||||
# self.hide()
|
# self.hide()
|
||||||
|
|
6
config
6
config
|
@ -27,3 +27,9 @@ sfx-volume = .8
|
||||||
buffer = 0
|
buffer = 0
|
||||||
arduino-port = /dev/ttyACM0
|
arduino-port = /dev/ttyACM0
|
||||||
serial = yes
|
serial = yes
|
||||||
|
|
||||||
|
[time]
|
||||||
|
timer-max-time = 10000
|
||||||
|
timer-start-time = 7000
|
||||||
|
timer-addition = 1000
|
||||||
|
sword-delay = 300
|
||||||
|
|
|
@ -20,3 +20,12 @@
|
||||||
130375
|
130375
|
||||||
134183
|
134183
|
||||||
174976
|
174976
|
||||||
|
142026
|
||||||
|
140320
|
||||||
|
132416
|
||||||
|
159243
|
||||||
|
227709
|
||||||
|
153523
|
||||||
|
155712
|
||||||
|
247891
|
||||||
|
178357
|
||||||
|
|
Loading…
Reference in New Issue