Files
Super-Mario-Bros.-Remastere…/Scripts/Classes/States/Player/NoClip.gd
guzlad a0369cd612 [QoL] FPS Counter disabled by default, show message after screenshot, show message if noclip is enabled/disabled (#591)
* FPS counter is off by default, enable with F4

* A message or error is now shown on-screen if a screenshot is taken with F2

* Show message when noclip is enabled or disabled
2025-10-14 16:04:08 +01:00

25 lines
758 B
GDScript
Executable File

extends PlayerState
const SLOW_SPEED := 300.0
const FAST_SPEED := 800.0
var old_layers := []
func enter(_msg := {}) -> void:
player.can_hurt = false
player.set_collision_mask_value(1, false)
player.set_collision_mask_value(2, false)
func physics_update(_delta: float) -> void:
player.velocity = Input.get_vector("move_left_0", "move_right_0", "move_up_0", "move_down_0") * (FAST_SPEED if Input.is_action_pressed("run_0") else SLOW_SPEED)
player.move_and_slide()
if Input.is_action_just_pressed("jump_0"):
state_machine.transition_to("Normal")
Global.log_comment("NOCLIP Disabled")
func exit() -> void:
player.can_hurt = false
player.set_collision_mask_value(1, true)
player.set_collision_mask_value(2, true)
player.velocity = Vector2.ZERO