platformer-game-test/src/Items/Spring.gd

11 lines
328 B
GDScript3
Raw Normal View History

2020-11-05 02:13:24 +00:00
extends Node2D
2020-11-25 20:07:47 +00:00
export var thrust:float = 250
2020-11-05 02:13:24 +00:00
func _on_Area2D_body_entered(body: Node) -> void:
2020-11-25 20:07:47 +00:00
if body.is_in_group("Boostable"):
var boost_direction = Vector2.UP.rotated(rotation).round()
body.boost(boost_direction * thrust)
AudioManager.play_sfx(AudioManager.Sfx.SPRING)
2020-11-05 02:13:24 +00:00
$AnimationPlayer.play("activated")