-
Notifications
You must be signed in to change notification settings - Fork 0
/
start_room.gd
55 lines (46 loc) · 1.28 KB
/
start_room.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
49
50
51
52
53
54
55
extends Node3D
var r2Speech
var textTimer
var phraseTimer
var textIndex
var phraseIndex
var r2Dialogue
var r2Sound
var opening
var floor
# Called when the node enters the scene tree for the first time.
func _ready():
r2Speech = $R2D2/Speech
textTimer = $TextTimer
phraseTimer = $PhraseTimer
r2Sound = $R2D2/R2Sound
floor = $Room/Floor
textIndex = 0
phraseIndex = 0
r2Dialogue = ["The last guy that went in there\ndidn't last very long...", "Are you sure you want to do this?", "Well... If you say so.", "Go ahead and take the plunge\nwhen you're ready.\nGood luck!"]
opening = false
# Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(delta):
if opening == true and floor.global_position.x > -25:
floor.global_position.x += 5 * Vector3(1,0,0) * delta;
else:
opening = false
func _on_text_timer_timeout():
if textIndex < len(r2Dialogue[phraseIndex]):
textIndex += 1
r2Speech.text = r2Dialogue[phraseIndex].substr(0,textIndex)
elif phraseIndex < len(r2Dialogue)-1:
phraseIndex += 1
textIndex = 0
textTimer.stop()
phraseTimer.start()
else:
textTimer.stop()
phraseTimer.stop()
func _on_phrase_timer_timeout():
textTimer.start()
r2Sound.play()
phraseTimer.stop()
func _on_button_press_body_entered(body):
pass
#opening = true