-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathMain.gd
39 lines (31 loc) · 910 Bytes
/
Main.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
extends Node2D
const CHAR_DESTINATION = 700
const CHAR_WALK_SPEED = 125
var waiting_for_start = true
var animating_character = false
var start_intro = false
func _process(delta):
if waiting_for_start:
_wait_for_enter_to_be_pressed()
elif animating_character:
_animate_character(delta)
elif start_intro:
_start_intro()
func _ready():
#Tell Pause not to pause.
Pause.enabled( false )
func _wait_for_enter_to_be_pressed():
if Input.is_action_pressed("ConfirmButton") || Input.is_action_pressed("ui_accept"):
$AnimatedSprite.play("Run")
waiting_for_start = false
animating_character = true
func _animate_character(delta):
if $AnimatedSprite.position.x < CHAR_DESTINATION :
$AnimatedSprite.position.x += CHAR_WALK_SPEED * delta
else:
animating_character = false
start_intro = true
func _start_intro():
Pause.enabled( true )
SceneBrowser.load_scene("Intro")
start_intro = false