All
This commit is contained in:
parent
7a8ee29dcb
commit
0fe23420ab
800 changed files with 16547 additions and 0 deletions
21
scenes/scripts/arrow.gd
Normal file
21
scenes/scripts/arrow.gd
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
extends Sprite2D
|
||||
|
||||
@export var bounce_height: float = 10.0 # How high it bounces in pixels
|
||||
@export var bounce_duration: float = 0.5 # Time for one bounce cycle
|
||||
var tween: Tween
|
||||
var start_position: Vector2
|
||||
|
||||
func _ready():
|
||||
start_position = position
|
||||
start_continuous_bounce()
|
||||
|
||||
func start_continuous_bounce():
|
||||
tween = create_tween()
|
||||
tween.set_loops() # Makes it loop infinitely
|
||||
tween.tween_property(self, "position:y", start_position.y - bounce_height, bounce_duration / 2)
|
||||
tween.tween_property(self, "position:y", start_position.y, bounce_duration / 2)
|
||||
|
||||
func stop_bounce():
|
||||
if tween:
|
||||
tween.kill()
|
||||
position = start_position
|
||||
Loading…
Add table
Add a link
Reference in a new issue