Fixed moving blocks

This commit is contained in:
Debugman committed 2026-10-18 18:43:49 -05:00
1 parent e7e33fa481
commit 22abac2f11
9 files changed
+135 -26

No files matched your search

+11 -8
View File
@@ -12,7 +12,7 @@ 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 platform_speed = 0.0
var death_cooldown = 0.0
var fall_timer = 0.0
@@ -122,6 +122,10 @@ func on_death(instant = false, player_position = position):
death_cooldown = 0
func _process(delta: float) -> void:
if is_on_moving_platform:
position.x = position.x + platform_speed
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):
controller_ui = false
elif Input.get_action_strength("move_horizontal") > 0:
@@ -131,8 +135,6 @@ func _process(delta: float) -> void:
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
@@ -162,9 +164,10 @@ func _process(delta: float) -> void:
velocity.y = -(0.001 * JUMP_VELOCITY)
if Input.is_action_pressed("jump") and is_on_wall_only():
print("WALL HANGING")
#velocity.y = 0
#velocity.x = 0
pass
#print("WALL HANGING")
#velocity.y = 0
#velocity.x = 0
var direction = Input.get_axis("move_left","move_right")
@@ -199,7 +202,7 @@ func _process(delta: float) -> void:
$Sprite2D.play("running")
$Sprite2D/HatSprite.play("running")
elif !dashing:
elif !dashing and !is_on_moving_platform:
velocity.x = move_toward(velocity.x, 0, FRICTION)
$Sprite2D.play("idle")
$Sprite2D/HatSprite.play("idle")
@@ -208,7 +211,7 @@ func _process(delta: float) -> void:
if get_tree():
for hidden_object in get_tree().get_nodes_in_group("Hidden"):
hidden_object.hide()
#Falling to death.
if position.y >= death_threshold:
print("SLASH KILL")