forked from JohnCoday/Cave-Story-Godot
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathFadeThingy.gd
48 lines (43 loc) · 977 Bytes
/
FadeThingy.gd
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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
extends Camera2D
var canFade = true
var rowsStarded = 0
var faded = false
@onready var timer = $Timer
# Called when the node enters the scene tree for the first time.
func _ready():
Globals.fadeThing = self
func _fade():
var rows = get_children()
var first = true
for row in rows:
if first == true:
first = false
else:
for spr in row.get_children():
spr.speed_scale = 1
spr.play("default")
timer.start(0.025)
await(timer.timeout)
timer.start(1)
await(timer.timeout)
faded = true
return true
func _fadeOut():
faded = false
var rows = get_children()
var first = true
for row in rows:
if first == true:
first = false
else:
for spr in row.get_children():
spr.speed_scale = -1
spr.play("default", true)
timer.start(0.025)
await(timer.timeout)
timer.start(1)
await(timer.timeout)
Globals.playerPlayable = true
# Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(delta):
pass