mirror of
https://github.com/JHDev2006/Super-Mario-Bros.-Remastered-Public.git
synced 2025-10-22 15:38:14 +00:00
fixed pipes, being terrible and i hate them
This commit is contained in:
@@ -53,11 +53,9 @@ func update_direction_textures() -> void:
|
||||
|
||||
func on_mouse_entered(area_idx := 0) -> void:
|
||||
mouse_in_areas |= (1 << area_idx)
|
||||
print(mouse_in_areas)
|
||||
|
||||
func on_mouse_exited(area_idx := 0) -> void:
|
||||
mouse_in_areas &= ~(1 << area_idx)
|
||||
print(mouse_in_areas)
|
||||
|
||||
func is_mouse_in_area(area_idx := 0) -> bool:
|
||||
return mouse_in_areas & (1 << area_idx) != 0
|
||||
|
@@ -43,6 +43,11 @@ func run_pipe_check() -> void:
|
||||
exit_pipe()
|
||||
|
||||
func _physics_process(_delta: float) -> void:
|
||||
if enter_direction >= 2:
|
||||
$Hitbox.scale.y = 8
|
||||
else:
|
||||
$Hitbox.scale.y = 1
|
||||
|
||||
if Engine.is_editor_hint() == false:
|
||||
in_game()
|
||||
update_visuals()
|
||||
@@ -98,12 +103,13 @@ func in_game() -> void:
|
||||
if exit_only:
|
||||
return
|
||||
for i in hitbox.get_overlapping_areas():
|
||||
if i.owner is Player:
|
||||
if i.owner is Player and can_enter:
|
||||
run_player_check(i.owner)
|
||||
|
||||
func run_player_check(player: Player) -> void:
|
||||
# guzlad: Added support for characters with a hitbox height below 1.0 to enter pipes underwater
|
||||
if Global.player_action_pressed(get_input_direction(enter_direction), player.player_id) and can_enter and (player.is_on_floor() or enter_direction == 1 or player.gravity_vector != Vector2.DOWN or (!player.is_on_floor() and enter_direction == 3)) and player.state_machine.state.name == "Normal":
|
||||
print(player.is_actually_on_floor())
|
||||
if Global.player_action_pressed(get_input_direction(enter_direction), player.player_id) and (player.is_on_floor() or enter_direction == 1):
|
||||
can_enter = false
|
||||
pipe_entered.emit()
|
||||
DiscoLevel.can_meter_tick = false
|
||||
|
@@ -748,6 +748,7 @@ func get_character_sprite_path(power_stateto_use := power_state.state_name) -> S
|
||||
|
||||
func enter_pipe(pipe: PipeArea, warp_to_level := true) -> void:
|
||||
z_index = -10
|
||||
can_bump_sfx = false
|
||||
Global.can_pause = false
|
||||
Global.can_time_tick = false
|
||||
pipe_enter_direction = pipe.get_vector(pipe.enter_direction)
|
||||
@@ -792,7 +793,7 @@ func exit_pipe(pipe: PipeArea) -> void:
|
||||
pipe_enter_direction = -pipe.get_vector(pipe.enter_direction)
|
||||
AudioManager.play_sfx("pipe", global_position)
|
||||
state_machine.transition_to("Pipe")
|
||||
await get_tree().create_timer(0.6, false).timeout
|
||||
await get_tree().create_timer(0.65, false).timeout
|
||||
Global.can_pause = true
|
||||
state_machine.transition_to("Normal")
|
||||
Global.can_time_tick = true
|
||||
|
@@ -9,6 +9,7 @@ func enter(_msg := {}) -> void:
|
||||
physics_update(0)
|
||||
|
||||
func physics_update(delta: float) -> void:
|
||||
player.velocity = Vector2.ZERO
|
||||
player.global_position += (ENTER_SPEED * (player.pipe_enter_direction * player.pipe_move_direction)) * delta
|
||||
if player.pipe_enter_direction.x != 0:
|
||||
player.sprite.speed_scale = 1
|
||||
|
Reference in New Issue
Block a user