adjust chameleon positions

This commit is contained in:
frank 2022-02-25 00:11:53 -05:00
parent 7779cc362f
commit 5cf548fc2e
1 changed files with 31 additions and 7 deletions

38
NS.py
View File

@ -1433,10 +1433,20 @@ class Light(Animation):
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):
"""
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)
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):
self.add_frameset([direction], switch=(direction == NS.N))
self.life = Life(self)
@ -1444,6 +1454,9 @@ class Chemtrails(Sprite):
self.timer = Timer(self)
def reset(self):
"""
Reset the health, lives, and timer objects and deactivate.
"""
self.deactivate()
self.life.reset()
self.boys.reset()
@ -1456,6 +1469,9 @@ class Chemtrails(Sprite):
self.active = True
def challenge(self):
"""
Start an attempt against a new queue of swords to be cleared.
"""
self.timer.reset()
self.queue_index = 0
@ -1479,6 +1495,11 @@ class Chemtrails(Sprite):
# self.boys.update()
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
queue = boss.queue
if self.orientation == queue[self.queue_index]:
@ -1502,6 +1523,9 @@ class Chemtrails(Sprite):
self.get_game().platform.reset_lights()
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()
edge = self.get_game().platform.get_edge_pressed()
dy = -Light.TITLE_OFFSET if self.get_game().title.active else 0
@ -1511,26 +1535,26 @@ class Chemtrails(Sprite):
else:
self.hide()
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
elif edge == NS.E:
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
elif edge == NS.S:
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
elif edge == NS.W:
self.location.center = ds.get_width() / 2 - NS.FRONT_WIDTH / 2 + 90, \
NS.FRONT + NS.LENGTH * NS.STEP - 30 + dy
self.location.center = ds.get_width() / 2 - NS.FRONT_WIDTH / 2 + 85, \
NS.FRONT + NS.LENGTH * NS.STEP - 40 + dy
self.orientation = NS.W
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
self.orientation = NS.NW
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
self.orientation = NS.NE
else: