kyouko sprites
This commit is contained in:
parent
34927f93ea
commit
e81d347313
22 changed files with 364 additions and 24 deletions
|
@ -182,7 +182,7 @@ const UNIT_SPRITES = {
|
|||
# Sprite-class: [Is-animation?, Nodes]
|
||||
UnitType.PLAYER: {
|
||||
SpriteClass.IDLE: [false, ["Idle"]],
|
||||
SpriteClass.WALK: [true, ["Walk"]],
|
||||
SpriteClass.WALK: [false, ["Move0", "Move-1", "Move-2", "Move+1", "Move+2"]],
|
||||
SpriteClass.JUMP: [false, ["Jump1", "Jump2"]],
|
||||
SpriteClass.RECOIL: [false, ["Recoil"]],
|
||||
},
|
||||
|
|
|
@ -54,10 +54,8 @@ func _ready():
|
|||
pos = Vector2(position.x / Constants.GRID_SIZE, position.y / -Constants.GRID_SIZE)
|
||||
position.x = position.x * Constants.SCALE_FACTOR
|
||||
position.y = position.y * Constants.SCALE_FACTOR
|
||||
# scale.x = Constants.SCALE_FACTOR
|
||||
# scale.y = Constants.SCALE_FACTOR
|
||||
scale.x = 2.4
|
||||
scale.y = 2.4
|
||||
scale.x = Constants.SCALE_FACTOR
|
||||
scale.y = Constants.SCALE_FACTOR
|
||||
|
||||
func init_unit_w_scene(scene):
|
||||
self.scene = scene
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue