adjust chameleon positions
This commit is contained in:
parent
7779cc362f
commit
5cf548fc2e
38
NS.py
38
NS.py
|
@ -1433,10 +1433,20 @@ class Light(Animation):
|
||||||
|
|
||||||
|
|
||||||
class Chemtrails(Sprite):
|
class Chemtrails(Sprite):
|
||||||
|
"""
|
||||||
|
This class stores the graphics and state of the player character. It contains sprite frames, health and life objects, and the
|
||||||
|
timer that counts down the amount of time left to perform a move.
|
||||||
|
"""
|
||||||
|
|
||||||
def __init__(self, parent):
|
def __init__(self, parent):
|
||||||
|
"""
|
||||||
|
Load the sprite frames, one for each pad orientation. Initialize a health object, lives object, and timer.
|
||||||
|
|
||||||
|
@param parent PGFW game object that initialized this object
|
||||||
|
"""
|
||||||
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)
|
||||||
|
# one frame for each pad orientation
|
||||||
for direction in (NS.N, NS.NE, NS.E, NS.NW, NS.S, NS.W):
|
for direction in (NS.N, NS.NE, NS.E, NS.NW, NS.S, NS.W):
|
||||||
self.add_frameset([direction], switch=(direction == NS.N))
|
self.add_frameset([direction], switch=(direction == NS.N))
|
||||||
self.life = Life(self)
|
self.life = Life(self)
|
||||||
|
@ -1444,6 +1454,9 @@ class Chemtrails(Sprite):
|
||||||
self.timer = Timer(self)
|
self.timer = Timer(self)
|
||||||
|
|
||||||
def reset(self):
|
def reset(self):
|
||||||
|
"""
|
||||||
|
Reset the health, lives, and timer objects and deactivate.
|
||||||
|
"""
|
||||||
self.deactivate()
|
self.deactivate()
|
||||||
self.life.reset()
|
self.life.reset()
|
||||||
self.boys.reset()
|
self.boys.reset()
|
||||||
|
@ -1456,6 +1469,9 @@ class Chemtrails(Sprite):
|
||||||
self.active = True
|
self.active = True
|
||||||
|
|
||||||
def challenge(self):
|
def challenge(self):
|
||||||
|
"""
|
||||||
|
Start an attempt against a new queue of swords to be cleared.
|
||||||
|
"""
|
||||||
self.timer.reset()
|
self.timer.reset()
|
||||||
self.queue_index = 0
|
self.queue_index = 0
|
||||||
|
|
||||||
|
@ -1479,6 +1495,11 @@ class Chemtrails(Sprite):
|
||||||
# self.boys.update()
|
# self.boys.update()
|
||||||
|
|
||||||
def attack(self):
|
def attack(self):
|
||||||
|
"""
|
||||||
|
Hit the boss if this is called while the boss attack queue is active and the player is in the correct orientation.
|
||||||
|
Add time to the timer, decrease the boss's health, and play a sound effect. If the queue is finished, reset the
|
||||||
|
timer completely and trigger another boss combo.
|
||||||
|
"""
|
||||||
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]:
|
||||||
|
@ -1502,6 +1523,9 @@ class Chemtrails(Sprite):
|
||||||
self.get_game().platform.reset_lights()
|
self.get_game().platform.reset_lights()
|
||||||
|
|
||||||
def orient(self):
|
def orient(self):
|
||||||
|
"""
|
||||||
|
Place the sprite on screen based on which edge is being pressed by the player on the real mat.
|
||||||
|
"""
|
||||||
ds = self.get_display_surface()
|
ds = self.get_display_surface()
|
||||||
edge = self.get_game().platform.get_edge_pressed()
|
edge = self.get_game().platform.get_edge_pressed()
|
||||||
dy = -Light.TITLE_OFFSET if self.get_game().title.active else 0
|
dy = -Light.TITLE_OFFSET if self.get_game().title.active else 0
|
||||||
|
@ -1511,26 +1535,26 @@ class Chemtrails(Sprite):
|
||||||
else:
|
else:
|
||||||
self.hide()
|
self.hide()
|
||||||
if edge == NS.N:
|
if edge == NS.N:
|
||||||
self.location.center = ds.get_width() / 2, NS.FRONT + dy
|
self.location.center = ds.get_width() / 2, NS.FRONT + dy - 10
|
||||||
self.orientation = NS.N
|
self.orientation = NS.N
|
||||||
elif edge == NS.E:
|
elif edge == NS.E:
|
||||||
self.location.center = ds.get_width() / 2 + NS.FRONT_WIDTH / 2 - 85, \
|
self.location.center = ds.get_width() / 2 + NS.FRONT_WIDTH / 2 - 85, \
|
||||||
NS.FRONT + NS.LENGTH * NS.STEP - 30 + dy
|
NS.FRONT + NS.LENGTH * NS.STEP - 40 + dy
|
||||||
self.orientation = NS.E
|
self.orientation = NS.E
|
||||||
elif edge == NS.S:
|
elif edge == NS.S:
|
||||||
self.location.center = ds.get_width() / 2, \
|
self.location.center = ds.get_width() / 2, \
|
||||||
NS.FRONT + NS.LENGTH - NS.LENGTH * NS.STEP - 50 + dy
|
NS.FRONT + NS.LENGTH - NS.LENGTH * NS.STEP - 65 + dy
|
||||||
self.orientation = NS.S
|
self.orientation = NS.S
|
||||||
elif edge == NS.W:
|
elif edge == NS.W:
|
||||||
self.location.center = ds.get_width() / 2 - NS.FRONT_WIDTH / 2 + 90, \
|
self.location.center = ds.get_width() / 2 - NS.FRONT_WIDTH / 2 + 85, \
|
||||||
NS.FRONT + NS.LENGTH * NS.STEP - 30 + dy
|
NS.FRONT + NS.LENGTH * NS.STEP - 40 + dy
|
||||||
self.orientation = NS.W
|
self.orientation = NS.W
|
||||||
elif edge == NS.NW:
|
elif edge == NS.NW:
|
||||||
self.location.center = ds.get_width() / 2 - 15, \
|
self.location.center = ds.get_width() / 2, \
|
||||||
NS.FRONT + NS.LENGTH * NS.STEP + dy - 45
|
NS.FRONT + NS.LENGTH * NS.STEP + dy - 45
|
||||||
self.orientation = NS.NW
|
self.orientation = NS.NW
|
||||||
elif edge == NS.NE:
|
elif edge == NS.NE:
|
||||||
self.location.center = ds.get_width() / 2 + 5, \
|
self.location.center = ds.get_width() / 2 - 5, \
|
||||||
NS.FRONT + NS.LENGTH * NS.STEP - 45 + dy
|
NS.FRONT + NS.LENGTH * NS.STEP - 45 + dy
|
||||||
self.orientation = NS.NE
|
self.orientation = NS.NE
|
||||||
else:
|
else:
|
||||||
|
|
Loading…
Reference in New Issue