DuckRun/scenes/hindernis/hindernis.gd
2024-10-22 19:52:35 +02:00

19 lines
447 B
GDScript

extends CharacterBody2D
@onready var speed = 0
func _ready() -> void:
$"Sprite".frame_coords.x = randi_range(0,4)
if $"/root/Global".active_biom == "w":
$"Sprite".frame_coords.y = 1
elif $"/root/Global".active_biom == "s":
$"Sprite".frame_coords.y = 2
else:
$"Sprite".frame_coords.y = 0
func _process(delta: float) -> void:
speed = $"/root/Global".speed
global_position.x -= speed*delta
if global_position.x < -30:
queue_free()