DuckRun/scenes/hindernis/hindernis.gd

19 lines
420 B
GDScript3
Raw Normal View History

2024-10-01 15:56:30 +02:00
extends CharacterBody2D
@onready var speed = 0
func _ready() -> void:
if $"/root/Global".active_biom == "w":
$"Sprite".frame = randi_range(5,9)
if $"/root/Global".active_biom == "s":
$"Sprite".frame = randi_range(10,12)
else:
$"Sprite".frame = randi_range(0,4)
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
if global_position.x < -30:
queue_free()