DuckRun/scenes/hurdle/hurdle.gd
megamichi 45193fc27f - adding coins
- performance improvements
- shake effect
- keyboard support
2024-11-04 19:10:10 +01: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()