-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathCoin.gd
More file actions
30 lines (22 loc) · 752 Bytes
/
Coin.gd
File metadata and controls
30 lines (22 loc) · 752 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
extends Area2D
var screensize
func _ready():
$Timer.wait_time = rand_range(3, 8)
$Timer.start()
$Tween.interpolate_property($AnimatedSprite, 'scale', $AnimatedSprite.scale,
$AnimatedSprite.scale * 3, 0.3, Tween.TRANS_QUAD,
Tween.EASE_IN_OUT)
$Tween.interpolate_property($AnimatedSprite, 'modulate', Color(1, 1, 1, 1),
Color(1, 1, 1, 0), 0.3, Tween.TRANS_QUAD,
Tween.EASE_IN_OUT)
func pickup():
queue_free()
$Tween.start()
func _on_Tween_tween_completed(object, key):
queue_free()
func _on_Coin_area_entered(area):
if area.is_in_group("obstacles"):
position = Vector2(rand_range(0, screensize.x), rand_range(0, screensize.y))
func _on_Timer_timeout():
$AnimatedSprite.frame = 0
$AnimatedSprite.play()