Improved moving platform

This commit is contained in:
Debugman committed 2026-10-18 17:19:50 -05:00
1 parent 7bcdfb1f7a
commit 2342c5b372
13 files changed
+55 -21

No files matched your search

+5 -4
View File
@@ -11,6 +11,9 @@ const JUMP_VELOCITY = -410.0
const DASH_LENGTH = 0.2
const BACKGROUND_COLOR = Color(Color.ORANGE.r + 0.80,Color.ORANGE.g + 0.20,Color.ORANGE.b - 0.10)
var is_on_moving_platform = false
var platform_speed = 0
var death_cooldown = 0.0
var fall_timer = 0.0
var teleport_cooldown = 0
@@ -93,8 +96,6 @@ func spawn_ghost(ghost_position):
var ghost = preload("res://ghost.tscn")
ghost = ghost.instantiate()
get_parent().add_child(ghost)
print(ghost)
print(ghost.position)
ghost.position = ghost_position
func on_death(instant = false, player_position = position):
@@ -122,16 +123,16 @@ func on_death(instant = false, player_position = position):
func _process(delta: float) -> void:
if Input.is_key_pressed(Key.KEY_W) or Input.is_key_pressed(Key.KEY_A) or Input.is_key_pressed(Key.KEY_S) or Input.is_key_pressed(Key.KEY_D):
print("KEYBOARD")
controller_ui = false
elif Input.get_action_strength("move_horizontal") > 0:
print("CONTROLLER")
controller_ui = true
if Input.is_action_just_released("restart") or (Input.is_action_pressed("controller_restart_left") and Input.is_action_pressed("controller_restart_right")):
get_tree().reload_current_scene()
if is_on_floor():
if is_on_moving_platform:
%Player2D.position.x += platform_speed
last_ground_point = global_position
#spawn_point = last_ground_point