45193fc27f
- performance improvements - shake effect - keyboard support
20 lines
490 B
GDScript
20 lines
490 B
GDScript
extends Area2D
|
|
|
|
|
|
# Called when the node enters the scene tree for the first time.
|
|
func _ready() -> void:
|
|
$AnimationPlayer.play("rotate")
|
|
|
|
func _physics_process(delta: float) -> void:
|
|
if $"/root/Global".gamerunning:
|
|
global_position.x -= $"/root/Global".speed*delta
|
|
|
|
|
|
func _on_body_entered(body: Node2D) -> void:
|
|
if body.name == "Duck":
|
|
$AnimationPlayer.play("explode")
|
|
await $AnimationPlayer.animation_finished
|
|
queue_free()
|
|
# add coin
|
|
if body.name == "hurdle":
|
|
queue_free()
|