kyouko sprites

This commit is contained in:
D L 2023-01-28 19:21:34 -08:00
parent 34927f93ea
commit e81d347313
22 changed files with 364 additions and 24 deletions

View file

@ -28,12 +28,36 @@ func execute_actions(delta):
func spin(delta):
set_current_action(Constants.UnitCurrentAction.SPINNING)
boost += boost_per_second * delta
current_sprite.visible = false
get_node("SpinningSprite").visible = true
get_node("SpinningSprite").rotation += delta * 32
func move():
set_unit_condition(Constants.UnitCondition.MOVING_STATUS, Constants.UnitMovingStatus.MOVING)
if (get_current_action() == Constants.UnitCurrentAction.IDLE
and unit_conditions[Constants.UnitCondition.IS_ON_GROUND]):
if last_contacted_map_elem_type == Constants.MapElemType.SQUARE:
set_sprite(Constants.SpriteClass.WALK, 0)
elif (last_contacted_map_elem_type == Constants.MapElemType.SMALL_SLOPE_RIGHT_1
or last_contacted_map_elem_type == Constants.MapElemType.SMALL_SLOPE_RIGHT_2):
set_sprite(Constants.SpriteClass.WALK, 1)
elif last_contacted_map_elem_type == Constants.MapElemType.SLOPE_RIGHT:
set_sprite(Constants.SpriteClass.WALK, 2)
elif (last_contacted_map_elem_type == Constants.MapElemType.SMALL_SLOPE_LEFT_1
or last_contacted_map_elem_type == Constants.MapElemType.SMALL_SLOPE_LEFT_2):
set_sprite(Constants.SpriteClass.WALK, 3)
elif last_contacted_map_elem_type == Constants.MapElemType.SLOPE_LEFT:
set_sprite(Constants.SpriteClass.WALK, 4)
func reset_current_action():
.reset_current_action()
if get_current_action() == Constants.UnitCurrentAction.SPINNING:
if not actions[Constants.ActionType.SPIN]:
set_current_action(Constants.UnitCurrentAction.IDLE)
get_node("SpinningSprite").visible = false
get_node("SpinningSprite").rotation = 0
.handle_idle()
current_sprite.visible = true
func custom_inputs():
if scene.input_table[Constants.PlayerInput.GBA_B][scene.I_T_JUST_PRESSED]:
@ -43,6 +67,10 @@ func custom_inputs():
and scene.input_table[Constants.PlayerInput.GBA_B][scene.I_T_PRESSED]):
set_action(Constants.ActionType.SPIN)
func handle_idle():
if boost == 0:
.handle_idle()
func process_unit(delta, time_elapsed : float):
# always be movin'
facing = Constants.Direction.RIGHT
@ -136,6 +164,8 @@ func handle_recoil():
# set to min_speed
func landed():
get_node("SpinningSprite").visible = false
get_node("SpinningSprite").rotation = 0
if get_current_action() == Constants.UnitCurrentAction.SPINNING:
hit(Constants.Direction.RIGHT)
boost = 0