DuckRun/scenes/hurdle/hurdle.gd

18 lines
403 B
GDScript3
Raw Permalink Normal View History

2024-10-01 15:56:30 +02:00
extends CharacterBody2D
@onready var speed = 0
func _ready() -> void:
2024-10-22 19:52:35 +02:00
$"Sprite".frame_coords.x = randi_range(0,4)
if $"/root/Global".active_biom == "w":
2024-10-22 19:52:35 +02:00
$"Sprite".frame_coords.y = 1
elif $"/root/Global".active_biom == "s":
$"Sprite".frame_coords.y = 2
else:
2024-10-22 19:52:35 +02:00
$"Sprite".frame_coords.y = 0
2024-10-01 15:56:30 +02:00
func _process(delta: float) -> void:
speed = $"/root/Global".speed
2024-10-01 15:56:30 +02:00
global_position.x -= speed*delta