mirror of
https://github.com/JHDev2006/Super-Mario-Bros.-Remastered-Public.git
synced 2025-10-22 15:38:14 +00:00
cleaned up some of the posing code
This commit is contained in:
@@ -74,6 +74,7 @@ var pipe_move_direction := 1
|
|||||||
var stomp_combo := 0
|
var stomp_combo := 0
|
||||||
|
|
||||||
var is_invincible := false
|
var is_invincible := false
|
||||||
|
var can_pose := false
|
||||||
var is_posing := false
|
var is_posing := false
|
||||||
|
|
||||||
const COMBO_VALS := [100, 200, 400, 500, 800, 1000, 2000, 4000, 5000, 8000, null]
|
const COMBO_VALS := [100, 200, 400, 500, 800, 1000, 2000, 4000, 5000, 8000, null]
|
||||||
@@ -83,8 +84,6 @@ const COMBO_VALS := [100, 200, 400, 500, 800, 1000, 2000, 4000, 5000, 8000, null
|
|||||||
@onready var normal_state: Node = $States/Normal
|
@onready var normal_state: Node = $States/Normal
|
||||||
@export var auto_death_pit := true
|
@export var auto_death_pit := true
|
||||||
|
|
||||||
var can_pose := true
|
|
||||||
|
|
||||||
var can_hurt := true
|
var can_hurt := true
|
||||||
|
|
||||||
var in_water := false
|
var in_water := false
|
||||||
@@ -616,6 +615,8 @@ func set_power_state_frame() -> void:
|
|||||||
if power_state != null:
|
if power_state != null:
|
||||||
$ResourceSetterNew.resource_json = load(get_character_sprite_path())
|
$ResourceSetterNew.resource_json = load(get_character_sprite_path())
|
||||||
$ResourceSetterNew.update_resource()
|
$ResourceSetterNew.update_resource()
|
||||||
|
if %Sprite.sprite_frames != null:
|
||||||
|
can_pose = %Sprite.sprite_frames.has_animation("PoseDoor")
|
||||||
|
|
||||||
func get_power_up(power_name := "") -> void:
|
func get_power_up(power_name := "") -> void:
|
||||||
if is_dead:
|
if is_dead:
|
||||||
|
@@ -7,7 +7,9 @@ func enter(_msg := {}) -> void:
|
|||||||
player.get_node("CameraCenterJoint/RightWall").set_collision_layer_value(1, false)
|
player.get_node("CameraCenterJoint/RightWall").set_collision_layer_value(1, false)
|
||||||
|
|
||||||
func physics_update(delta: float) -> void:
|
func physics_update(delta: float) -> void:
|
||||||
if player.is_posing: return
|
if player.is_posing:
|
||||||
|
player.velocity.x = 0
|
||||||
|
return
|
||||||
player.input_direction = 1
|
player.input_direction = 1
|
||||||
player.can_run = false
|
player.can_run = false
|
||||||
player.normal_state.handle_movement(delta)
|
player.normal_state.handle_movement(delta)
|
||||||
|
@@ -41,7 +41,6 @@ func _process(_delta: float) -> void:
|
|||||||
|
|
||||||
func _physics_process(_delta: float) -> void:
|
func _physics_process(_delta: float) -> void:
|
||||||
for i: Player in get_tree().get_nodes_in_group("Players"):
|
for i: Player in get_tree().get_nodes_in_group("Players"):
|
||||||
if not i.sprite.sprite_frames.has_animation("PoseDoor"): i.can_pose = false; continue
|
|
||||||
if i.can_pose and i.global_position >= global_position and i.sprite.sprite_frames.has_animation("PoseDoor"):
|
if i.can_pose and i.global_position >= global_position and i.sprite.sprite_frames.has_animation("PoseDoor"):
|
||||||
i.is_posing = true; i.can_pose = false
|
i.is_posing = true; i.can_pose = false
|
||||||
i.global_position = global_position
|
i.global_position = global_position
|
||||||
@@ -51,6 +50,7 @@ func _physics_process(_delta: float) -> void:
|
|||||||
|
|
||||||
func on_pose_finished(player: Player) -> void:
|
func on_pose_finished(player: Player) -> void:
|
||||||
player.is_posing = false
|
player.is_posing = false
|
||||||
|
player.z_index = -2
|
||||||
|
|
||||||
func on_music_finished() -> void:
|
func on_music_finished() -> void:
|
||||||
do_sequence()
|
do_sequence()
|
||||||
|
@@ -29,7 +29,8 @@ func player_touch(player: Player) -> void:
|
|||||||
get_tree().call_group("Enemies", "flag_die")
|
get_tree().call_group("Enemies", "flag_die")
|
||||||
give_points(player)
|
give_points(player)
|
||||||
Global.can_time_tick = false
|
Global.can_time_tick = false
|
||||||
player.z_index = -2
|
if player.can_pose == false:
|
||||||
|
player.z_index = -2
|
||||||
player.global_position.x = $Flag.global_position.x + 3
|
player.global_position.x = $Flag.global_position.x + 3
|
||||||
$Animation.play("FlagDown")
|
$Animation.play("FlagDown")
|
||||||
player.state_machine.transition_to("FlagPole")
|
player.state_machine.transition_to("FlagPole")
|
||||||
|
Reference in New Issue
Block a user