-
Notifications
You must be signed in to change notification settings - Fork 0
/
Global.gd
62 lines (51 loc) · 1.51 KB
/
Global.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
56
57
58
59
60
61
62
extends Node
const IDLE = "idle"
const SKIN_ANGULAR_STEPS = 16
# 0 is really insame
var ai_min_weapon_swap_time = 2
enum Currency {Euro, Dollar, Yen, Pound}
# The lineChart singleton has to be assigned to this variable
# Currently, it assigns itself inside _ready
var line_chart = null
func get_currency_scaling(currency):
return line_chart.get_currency_scale(currency)
const currencies = [Currency.Euro, Currency.Dollar, Currency.Yen, Currency.Pound]
const colors = {
Currency.Euro: Color.blue,
Currency.Dollar: Color.green,
Currency.Yen: Color.purple,
Currency.Pound: Color.orange
}
# The skin directory names of the currencies
const skins = {
Currency.Euro: "eur",
Currency.Dollar: "usd",
Currency.Yen: "yen",
Currency.Pound: "gbp"
}
var inverse_skins = {
"usd": Currency.Dollar,
"eur": Currency.Euro,
"yen": Currency.Yen,
"gbp": Currency.Pound
}
var sprite_frames = {}
const symbols = {
Currency.Euro: "€",
Currency.Dollar: "$",
Currency.Yen: "¥",
Currency.Pound: "£"
}
func _ready():
# load all animation sprite frames
var path_template = "res://player/skin/{skin}/{ani}/{step}.png"
for currency in currencies:
var sf = SpriteFrames.new()
for ani in [IDLE]:
for ang_step in range(SKIN_ANGULAR_STEPS):
var ani_ang_step = ani + "_" + str(ang_step)
sf.add_animation(ani_ang_step)
# we only one frame per animation right now
var path = path_template.format({"skin": skins[currency], "ani": ani, "step": ang_step})
sf.add_frame(ani_ang_step, load(path))
sprite_frames[currency] = sf