Files
2026-10-18 21:10:30 -05:00

24 lines
679 B
GDScript

extends Node2D
@export var max_distance = 260.0
@export var moving = true
var alt_position = Vector2(position.x + max_distance,0)
@export var move_speed = 0.0
func _ready() -> void:
alt_position = Vector2(position.x + max_distance,0)
func _process(delta: float) -> void:
if position.x != alt_position.x:
position.x = move_toward(position.x, alt_position.x, move_speed)
else:
moving = false
%Player2D.is_on_moving_platform = false
#%Player2D.platform_speed = 0.0
func on_contact(body: Node2D) -> void:
if body==%Player2D and %Player2D.death_cooldown == 0:
print("SLASH KILL")
%Player2D/Jetpack/DeathSound.play()
%Player2D.on_death(false,%Player2D.position)