capri/objects/spring/spring.gd
2025-03-01 18:43:19 -05:00

18 lines
438 B
GDScript

extends Node2D
@export var bounce_power = 240.0
# Called when the node enters the scene tree for the first time.
func _ready() -> void:
pass # Replace with function body.
# Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(delta: float) -> void:
pass
func _on_area_2d_body_entered(body: Node2D) -> void:
if body is Player:
body.velocity.y = -bounce_power
%AnimationPlayer.play("bounce")