shirogamis-maze/src/Objects/Spring.gd
2021-05-27 01:44:39 -04:00

18 lines
409 B
GDScript

extends Area2D
export var strength = 500
onready var animation_player = $AnimationPlayer
onready var sound = $"CollisionShape2D/Bounce"
func _ready():
sound.pitch_scale = 1/scale.x
func _on_Spring_body_entered(body):
if !sound.playing:
sound.playing = true
if scale.x != 1:
sound.pitch_scale = 1/scale.x
body.bounce_off_glove(strength*scale.x,rotation_degrees+90)
animation_player.play("spring")