mirror of
https://github.com/n0remac/game-jam-2020.git
synced 2025-12-09 14:05:20 -06:00
implement new enums into animations file
This commit is contained in:
@@ -46,11 +46,11 @@ class Enums(Enum):
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
# Play Direction Enums
|
# Play Direction Enums
|
||||||
RIGHT_FACING
|
RIGHT_FACING = 0
|
||||||
LEFT_FACING
|
LEFT_FACING = 1
|
||||||
FRONT_FACING
|
FRONT_FACING = 2
|
||||||
UP_FACING
|
UP_FACING = 3
|
||||||
DOWN_FACING
|
DOWN_FACING = 4
|
||||||
|
|
||||||
class Sprites(object):
|
class Sprites(object):
|
||||||
"""
|
"""
|
||||||
|
|||||||
@@ -43,7 +43,7 @@ class Player(Mob):
|
|||||||
main_path = "resources/images/character/knight/"
|
main_path = "resources/images/character/knight/"
|
||||||
|
|
||||||
# Default to face-front
|
# Default to face-front
|
||||||
self.character_face_direction = Enums.FRONT_FACING
|
self.character_dir = Enums.FRONT_FACING
|
||||||
|
|
||||||
# Load textures for idle standing
|
# Load textures for idle standing
|
||||||
for i in range(4):
|
for i in range(4):
|
||||||
@@ -72,13 +72,13 @@ class Player(Mob):
|
|||||||
|
|
||||||
# Figure out if we need to flip face left, right, up, or down
|
# Figure out if we need to flip face left, right, up, or down
|
||||||
if self.change_x > 0:
|
if self.change_x > 0:
|
||||||
self.character_face_direction = Enums.LEFT_FACING
|
self.character_dir = Enums.LEFT_FACING
|
||||||
elif self.change_x < 0:
|
elif self.change_x < 0:
|
||||||
self.character_face_direction = Enums.RIGHT_FACING
|
self.character_dir = Enums.RIGHT_FACING
|
||||||
elif self.change_x == 0 and self.change_y == 0:
|
elif self.change_x == 0 and self.change_y == 0:
|
||||||
self.character_face_direction = Enums.FRONT_FACING
|
self.character_dir = Enums.FRONT_FACING
|
||||||
|
|
||||||
# idle animation
|
# Idle Animation
|
||||||
if self.change_x == 0 and self.change_y == 0:
|
if self.change_x == 0 and self.change_y == 0:
|
||||||
self.cur_texture += 1
|
self.cur_texture += 1
|
||||||
if self.cur_texture > 3 * Config.IDLE_UPDATES_PER_FRAME:
|
if self.cur_texture > 3 * Config.IDLE_UPDATES_PER_FRAME:
|
||||||
@@ -106,8 +106,7 @@ class Player(Mob):
|
|||||||
self.cur_texture += 1
|
self.cur_texture += 1
|
||||||
if self.cur_texture > 5 * Config.RUN_UPDATES_PER_FRAME:
|
if self.cur_texture > 5 * Config.RUN_UPDATES_PER_FRAME:
|
||||||
self.cur_texture = 0
|
self.cur_texture = 0
|
||||||
self.texture = self.walking_textures[self.cur_texture // Config.RUN_UPDATES_PER_FRAME][
|
self.texture = self.walking_textures[self.cur_texture // Config.RUN_UPDATES_PER_FRAME][self.character_dir.value]
|
||||||
self.character_face_direction]
|
|
||||||
|
|
||||||
def tick(self):
|
def tick(self):
|
||||||
"""
|
"""
|
||||||
|
|||||||
Reference in New Issue
Block a user