mirror of
https://github.com/JHDev2006/Super-Mario-Bros.-Remastered-Public.git
synced 2025-10-21 23:18:11 +00:00
Optional Animations 2: Electric Boogaloo (#596)
* Additional optional animations for water/wing power-up + extras * Added animation fallbacks for new animations * Kicking animation function * Kick anim functionality for shells * Player performs kick animation * RunJump anims + quick fixes new anims, including RunJump, RunJumpFall and RunJumpBump (incredible name) which play depending on the X velocity the player left the ground with. also fixed the bob-omb to play the kick animation as well as it should also * Updated "FlyMove" to "WingMove" for consistency * Update "FlyMove" to "WingMove" in animation fallbacks
This commit is contained in:
@@ -24,6 +24,7 @@ func explode() -> void:
|
|||||||
|
|
||||||
func kick(object: Node2D) -> void:
|
func kick(object: Node2D) -> void:
|
||||||
AudioManager.play_sfx("kick", global_position)
|
AudioManager.play_sfx("kick", global_position)
|
||||||
|
object.kick_anim()
|
||||||
var kick_dir = sign(global_position.x - object.global_position.x)
|
var kick_dir = sign(global_position.x - object.global_position.x)
|
||||||
velocity.x = 150 * kick_dir
|
velocity.x = 150 * kick_dir
|
||||||
direction = kick_dir
|
direction = kick_dir
|
||||||
|
@@ -52,6 +52,7 @@ var input_direction := 0
|
|||||||
var flight_meter := 0.0
|
var flight_meter := 0.0
|
||||||
|
|
||||||
var velocity_direction := 1
|
var velocity_direction := 1
|
||||||
|
var velocity_x_jump_stored := 0
|
||||||
|
|
||||||
var total_keys := 0
|
var total_keys := 0
|
||||||
|
|
||||||
@@ -74,6 +75,9 @@ var can_bump_crouch = false
|
|||||||
var can_bump_swim = false
|
var can_bump_swim = false
|
||||||
var can_bump_fly = false
|
var can_bump_fly = false
|
||||||
|
|
||||||
|
var kicking = false
|
||||||
|
var can_kick_anim = false
|
||||||
|
|
||||||
@export var player_id := 0
|
@export var player_id := 0
|
||||||
const ONE_UP_NOTE = preload("uid://dopxwjj37gu0l")
|
const ONE_UP_NOTE = preload("uid://dopxwjj37gu0l")
|
||||||
var gravity := FALL_GRAVITY
|
var gravity := FALL_GRAVITY
|
||||||
@@ -148,7 +152,11 @@ const ANIMATION_FALLBACKS := {
|
|||||||
"Run": "Move",
|
"Run": "Move",
|
||||||
"PipeWalk": "Walk",
|
"PipeWalk": "Walk",
|
||||||
"LookUp": "Idle",
|
"LookUp": "Idle",
|
||||||
|
"WaterLookUp": "LookUp",
|
||||||
|
"WingLookUp": "WaterLookUp",
|
||||||
"Crouch": "Idle",
|
"Crouch": "Idle",
|
||||||
|
"WaterCrouch": "Crouch",
|
||||||
|
"WingCrouch": "WaterCrouch",
|
||||||
"CrouchFall": "Crouch",
|
"CrouchFall": "Crouch",
|
||||||
"CrouchJump": "Crouch",
|
"CrouchJump": "Crouch",
|
||||||
"CrouchBump": "Bump",
|
"CrouchBump": "Bump",
|
||||||
@@ -159,16 +167,20 @@ const ANIMATION_FALLBACKS := {
|
|||||||
"WalkAttack": "MoveAttack",
|
"WalkAttack": "MoveAttack",
|
||||||
"RunAttack": "MoveAttack",
|
"RunAttack": "MoveAttack",
|
||||||
"SkidAttack": "MoveAttack",
|
"SkidAttack": "MoveAttack",
|
||||||
"FlyIdle": "SwimIdle",
|
"WingIdle": "WaterIdle",
|
||||||
"FlyUp": "SwimUp",
|
"FlyUp": "SwimUp",
|
||||||
"FlyMove": "SwimMove",
|
"WingMove": "SwimMove",
|
||||||
"FlyAttack": "SwimAttack",
|
"FlyAttack": "SwimAttack",
|
||||||
"FlyBump": "SwimBump",
|
"FlyBump": "SwimBump",
|
||||||
"FlagSlide": "Climb",
|
"FlagSlide": "Climb",
|
||||||
"WaterMove": "Move",
|
"WaterMove": "Move",
|
||||||
"WaterIdle": "Idle",
|
"WaterIdle": "Idle",
|
||||||
|
"FlyIdle": "SwimIdle",
|
||||||
"SwimBump": "Bump",
|
"SwimBump": "Bump",
|
||||||
"DieFreeze": "Die",
|
"DieFreeze": "Die",
|
||||||
|
"RunJump": "Jump",
|
||||||
|
"RunJumpFall": "JumpFall",
|
||||||
|
"RunJumpBump": "JumpBump",
|
||||||
"StarJump": "Jump",
|
"StarJump": "Jump",
|
||||||
"StarFall": "JumpFall"
|
"StarFall": "JumpFall"
|
||||||
}
|
}
|
||||||
@@ -449,6 +461,11 @@ func bump_ceiling() -> void:
|
|||||||
await get_tree().create_timer(0.1).timeout
|
await get_tree().create_timer(0.1).timeout
|
||||||
bumping = false
|
bumping = false
|
||||||
|
|
||||||
|
func kick_anim() -> void:
|
||||||
|
kicking = true
|
||||||
|
await get_tree().create_timer(0.2).timeout
|
||||||
|
kicking = false
|
||||||
|
|
||||||
func super_star() -> void:
|
func super_star() -> void:
|
||||||
DiscoLevel.combo_meter += 1
|
DiscoLevel.combo_meter += 1
|
||||||
is_invincible = true
|
is_invincible = true
|
||||||
@@ -671,6 +688,7 @@ func set_power_state_frame() -> void:
|
|||||||
can_bump_crouch = %Sprite.sprite_frames.has_animation("CrouchBump")
|
can_bump_crouch = %Sprite.sprite_frames.has_animation("CrouchBump")
|
||||||
can_bump_swim = %Sprite.sprite_frames.has_animation("SwimBump")
|
can_bump_swim = %Sprite.sprite_frames.has_animation("SwimBump")
|
||||||
can_bump_fly = %Sprite.sprite_frames.has_animation("FlyBump")
|
can_bump_fly = %Sprite.sprite_frames.has_animation("FlyBump")
|
||||||
|
can_kick_anim = %Sprite.sprite_frames.has_animation("Kick")
|
||||||
|
|
||||||
func get_power_up(power_name := "") -> void:
|
func get_power_up(power_name := "") -> void:
|
||||||
if is_dead:
|
if is_dead:
|
||||||
@@ -822,6 +840,7 @@ func jump() -> void:
|
|||||||
if spring_bouncing:
|
if spring_bouncing:
|
||||||
return
|
return
|
||||||
velocity.y = calculate_jump_height() * gravity_vector.y
|
velocity.y = calculate_jump_height() * gravity_vector.y
|
||||||
|
velocity_x_jump_stored = velocity.x
|
||||||
gravity = JUMP_GRAVITY
|
gravity = JUMP_GRAVITY
|
||||||
AudioManager.play_sfx("small_jump" if power_state.hitbox_size == "Small" else "big_jump", global_position)
|
AudioManager.play_sfx("small_jump" if power_state.hitbox_size == "Small" else "big_jump", global_position)
|
||||||
has_jumped = true
|
has_jumped = true
|
||||||
|
@@ -94,6 +94,7 @@ func kick(hit_player: Player) -> void:
|
|||||||
DiscoLevel.combo_meter += 25
|
DiscoLevel.combo_meter += 25
|
||||||
moving = true
|
moving = true
|
||||||
moving_time = 0.0
|
moving_time = 0.0
|
||||||
|
hit_player.kick_anim()
|
||||||
if can_air_kick:
|
if can_air_kick:
|
||||||
$ScoreNoteSpawner.spawn_note(8000)
|
$ScoreNoteSpawner.spawn_note(8000)
|
||||||
else:
|
else:
|
||||||
|
@@ -209,6 +209,8 @@ func get_animation_name() -> String:
|
|||||||
return "FlyAttack"
|
return "FlyAttack"
|
||||||
else:
|
else:
|
||||||
return "AirAttack"
|
return "AirAttack"
|
||||||
|
if player.kicking and player.can_kick_anim:
|
||||||
|
return "Kick"
|
||||||
if player.crouching and not wall_pushing:
|
if player.crouching and not wall_pushing:
|
||||||
if player.bumping and player.can_bump_crouch:
|
if player.bumping and player.can_bump_crouch:
|
||||||
return "CrouchBump"
|
return "CrouchBump"
|
||||||
@@ -220,7 +222,12 @@ func get_animation_name() -> String:
|
|||||||
elif player.is_actually_on_floor():
|
elif player.is_actually_on_floor():
|
||||||
if abs(player.velocity.x) >= 5 and not player.is_actually_on_wall():
|
if abs(player.velocity.x) >= 5 and not player.is_actually_on_wall():
|
||||||
return "CrouchMove"
|
return "CrouchMove"
|
||||||
return "Crouch"
|
elif player.in_water:
|
||||||
|
return "WaterCrouch"
|
||||||
|
elif player.flight_meter > 0:
|
||||||
|
return "WingCrouch"
|
||||||
|
else:
|
||||||
|
return "Crouch"
|
||||||
if player.is_actually_on_floor():
|
if player.is_actually_on_floor():
|
||||||
if player.skidding:
|
if player.skidding:
|
||||||
return "Skid"
|
return "Skid"
|
||||||
@@ -228,17 +235,26 @@ func get_animation_name() -> String:
|
|||||||
if player.in_water:
|
if player.in_water:
|
||||||
return "WaterMove"
|
return "WaterMove"
|
||||||
elif player.flight_meter > 0:
|
elif player.flight_meter > 0:
|
||||||
return "FlyMove"
|
return "WingMove"
|
||||||
elif abs(player.velocity.x) < player.RUN_SPEED - 10:
|
elif abs(player.velocity.x) < player.RUN_SPEED - 10:
|
||||||
return "Walk"
|
return "Walk"
|
||||||
else:
|
else:
|
||||||
return "Run"
|
return "Run"
|
||||||
else:
|
else:
|
||||||
if player.in_water or player.flight_meter > 0:
|
|
||||||
return "WaterIdle"
|
|
||||||
if Global.player_action_pressed("move_up", player.player_id):
|
if Global.player_action_pressed("move_up", player.player_id):
|
||||||
return "LookUp"
|
if player.in_water:
|
||||||
return "Idle"
|
return "WaterLookUp"
|
||||||
|
elif player.flight_meter > 0:
|
||||||
|
return "WingLookUp"
|
||||||
|
else:
|
||||||
|
return "LookUp"
|
||||||
|
else:
|
||||||
|
if player.in_water:
|
||||||
|
return "WaterIdle"
|
||||||
|
elif player.flight_meter > 0:
|
||||||
|
return "WingIdle"
|
||||||
|
else:
|
||||||
|
return "Idle"
|
||||||
else:
|
else:
|
||||||
if player.in_water:
|
if player.in_water:
|
||||||
if swim_up_meter > 0:
|
if swim_up_meter > 0:
|
||||||
@@ -258,15 +274,24 @@ func get_animation_name() -> String:
|
|||||||
return "FlyIdle"
|
return "FlyIdle"
|
||||||
if player.has_jumped:
|
if player.has_jumped:
|
||||||
if player.bumping and player.can_bump_jump:
|
if player.bumping and player.can_bump_jump:
|
||||||
return "JumpBump"
|
if abs(player.velocity_x_jump_stored) < player.RUN_SPEED - 10:
|
||||||
|
return "RunJumpBump"
|
||||||
|
else:
|
||||||
|
return "JumpBump"
|
||||||
elif player.velocity.y < 0:
|
elif player.velocity.y < 0:
|
||||||
if player.is_invincible:
|
if player.is_invincible:
|
||||||
return "StarJump"
|
return "StarJump"
|
||||||
return "Jump"
|
elif abs(player.velocity_x_jump_stored) < player.RUN_SPEED - 10:
|
||||||
|
return "RunJump"
|
||||||
|
else:
|
||||||
|
return "Jump"
|
||||||
else:
|
else:
|
||||||
if player.is_invincible:
|
if player.is_invincible:
|
||||||
return "StarFall"
|
return "StarFall"
|
||||||
return "JumpFall"
|
elif abs(player.velocity_x_jump_stored) < player.RUN_SPEED - 10:
|
||||||
|
return "RunJumpFall"
|
||||||
|
else:
|
||||||
|
return "JumpFall"
|
||||||
else:
|
else:
|
||||||
# guzlad: Fixes characters with fall anims not playing them, but also prevents old characters without that anim not being accurate
|
# guzlad: Fixes characters with fall anims not playing them, but also prevents old characters without that anim not being accurate
|
||||||
if !player.sprite.sprite_frames.has_animation("Fall"):
|
if !player.sprite.sprite_frames.has_animation("Fall"):
|
||||||
|
Reference in New Issue
Block a user