-
Notifications
You must be signed in to change notification settings - Fork 0
/
Control.gd
55 lines (44 loc) · 1.29 KB
/
Control.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 Control
export(int) var MONTHS_IN_SECONDS = 5
export(int) var INITIAL_MONEY = 500
export(int) var INITIAL_LEVEL = 1
export(int) var CURRENT_MONEY = INITIAL_MONEY
onready var chooseJob = $JobSelector
onready var daysTimer = $DaysTimer
onready var jobTimer = $JobTimer
onready var daysNotification = $DaysNotification
onready var selectedJob = $SelectedJob
onready var progressBar = $ProgressBar
onready var currentMoney = $CurrentMoney
var daysMessage = "Days: %s"
var selectedJobName = "Selected job: %s"
var currentMoneyMessage = "Current money: %s"
var jobOne = Job.new()
var days = 0
func _on_GetJob_pressed():
daysTimer.paused = true
chooseJob.popup()
func _on_StartGame_pressed():
daysTimer.start(MONTHS_IN_SECONDS)
func set_days():
if days >= 31:
print("is 31!")
days = 0
else:
days += 1
func _on_JobSelector_popup_hide():
daysTimer.paused = false
generateJob()
selectedJob.text = selectedJobName % jobOne.jobName
jobTimer.start(jobOne.time)
func generateJob():
jobOne.jobName = "Simple wordpress site"
func _on_DaysTimer_timeout():
set_days()
daysNotification.text = daysMessage % days
progressBar.value = days
func _on_JobTimer_timeout():
jobTimer.stop()
CURRENT_MONEY += jobOne.payment
print(CURRENT_MONEY)
currentMoney.text = currentMoneyMessage % CURRENT_MONEY