aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--assets/alpha mayoris.hdr.import35
-rw-r--r--assets/blender/shapes.blendbin1114348 -> 1159840 bytes
-rw-r--r--assets/blender/turrets.blendbin1310324 -> 1363968 bytes
-rw-r--r--assets/turrets.json40
-rw-r--r--scenes/gui.tscn9
-rw-r--r--scenes/gui/gui_button.tscn36
-rw-r--r--scenes/gui/gui_turret.tscn12
-rw-r--r--scripts/control.gd2
-rw-r--r--scripts/gui_picker.gd44
-rw-r--r--scripts/gui_turret.gd64
-rw-r--r--scripts/gui_turret_detail.gd3
-rw-r--r--scripts/load_turrets.gd11
12 files changed, 100 insertions, 156 deletions
diff --git a/assets/alpha mayoris.hdr.import b/assets/alpha mayoris.hdr.import
deleted file mode 100644
index bb7011f..0000000
--- a/assets/alpha mayoris.hdr.import
+++ /dev/null
@@ -1,35 +0,0 @@
-[remap]
-
-importer="texture"
-type="StreamTexture"
-path="res://.import/alpha mayoris.hdr-350cf44b7e2360fe05ff43e65b4884e1.stex"
-metadata={
-"vram_texture": false
-}
-
-[deps]
-
-source_file="res://assets/alpha mayoris.hdr"
-dest_files=[ "res://.import/alpha mayoris.hdr-350cf44b7e2360fe05ff43e65b4884e1.stex" ]
-
-[params]
-
-compress/mode=0
-compress/lossy_quality=0.7
-compress/hdr_mode=0
-compress/bptc_ldr=0
-compress/normal_map=0
-flags/repeat=0
-flags/filter=true
-flags/mipmaps=false
-flags/anisotropic=false
-flags/srgb=2
-process/fix_alpha_border=true
-process/premult_alpha=false
-process/HDR_as_SRGB=false
-process/invert_color=false
-process/normal_map_invert_y=false
-stream=false
-size_limit=0
-detect_3d=true
-svg/scale=1.0
diff --git a/assets/blender/shapes.blend b/assets/blender/shapes.blend
index c1dd8ec..d1c596d 100644
--- a/assets/blender/shapes.blend
+++ b/assets/blender/shapes.blend
Binary files differ
diff --git a/assets/blender/turrets.blend b/assets/blender/turrets.blend
index 710ab5f..4075f7c 100644
--- a/assets/blender/turrets.blend
+++ b/assets/blender/turrets.blend
Binary files differ
diff --git a/assets/turrets.json b/assets/turrets.json
index 4e115a7..3ef9db3 100644
--- a/assets/turrets.json
+++ b/assets/turrets.json
@@ -9,6 +9,7 @@
"upgrades": [ "heavy laser", "sniper" ],
"modules_max": 6,
"model_name": "laser.glb",
+ "thumbnail_name": "laser.png",
"projectile": {
"type": "bullet",
"speed": 5,
@@ -26,6 +27,7 @@
"upgrades": [ "minigun" ],
"modules_max": 6,
"model_name": "laser.glb",
+ "thumbnail_name": "laser.png",
"projectile": {
"type": "bullet",
"speed": 5,
@@ -42,6 +44,7 @@
"range": 5,
"modules_max": 6,
"model_name": "laser.glb",
+ "thumbnail_name": "laser.png",
"projectile": {
"type": "bullet",
"speed": 10,
@@ -59,6 +62,7 @@
"upgrades": [ "railgun" ],
"modules_max": 4,
"model_name": "sniper.glb",
+ "thumbnail_name": "sniper.png",
"projectile": {
"type": "ray",
"model_name": "ray_laser.glb",
@@ -74,6 +78,7 @@
"range": 8,
"modules_max": 4,
"model_name": "sniper.glb",
+ "thumbnail_name": "laser.png",
"projectile": {
"type": "ray",
"model_name": "ray_laser.glb",
@@ -90,6 +95,7 @@
"upgrades": [ "cannon" ],
"modules_max": 3,
"model_name": "shotgun.glb",
+ "thumbnail_name": "shotgun.png",
"projectile": {
"type": "bullet",
"speed": 5,
@@ -108,6 +114,7 @@
"upgrades": [ "tesla" ],
"modules_max": 3,
"model_name": "shotgun.glb",
+ "thumbnail_name": "shotgun.png",
"projectile": {
"type": "bomb",
"speed": 3,
@@ -123,6 +130,7 @@
"range": 4,
"modules_max": 5,
"model_name": "shotgun.glb",
+ "thumbnail_name": "shotgun.png",
"projectile": {
"type": "shock",
"jumps": 5,
@@ -139,6 +147,7 @@
"upgrades": [ "heavy plastic" ],
"modules_max": 3,
"model_name": "plastic.glb",
+ "thumbnail_name": "plastic.png",
"projectile": {
"type": "bounce",
"model_name": "bullet_bounce.glb",
@@ -157,6 +166,7 @@
"upgrades": [ "plasma plastic" ],
"modules_max": 3,
"model_name": "plastic.glb",
+ "thumbnail_name": "plastic.png",
"projectile": {
"type": "bounce",
"model_name": "bullet_bounce.glb",
@@ -175,6 +185,7 @@
"upgrades": [ "plasma plastic" ],
"modules_max": 4,
"model_name": "plastic.glb",
+ "thumbnail_name": "plastic.png",
"projectile": {
"type": "bounce",
"lifetime": 5,
@@ -189,9 +200,10 @@
"cooldown": 1,
"turn_speed": 5,
"range": 5,
- "upgrades": [ "heavy slower" ],
+ "upgrades": [ "heavy slower", "stopper" ],
"modules_max": 4,
"model_name": "slower.glb",
+ "thumbnail_name": "slower.png",
"slowness": 5,
"projectile": {
"type": "bullet",
@@ -209,6 +221,7 @@
"upgrades": [ "final slower" ],
"modules_max": 5,
"model_name": "slower.glb",
+ "thumbnail_name": "slower.png",
"slowness": 7,
"projectile": {
"type": "bullet",
@@ -225,6 +238,7 @@
"range": 7,
"modules_max": 5,
"model_name": "slower.glb",
+ "thumbnail_name": "slower.png",
"slowness": 10,
"projectile": {
"type": "ray",
@@ -234,12 +248,13 @@
},
{
"name": "stopper",
- "cost": { "t": 750 },
+ "cost": { "T": 750 },
"cooldown": 5,
"range": 2,
"upgrades": [ "heavy stopper" ],
"modules_max": 4,
"model_name": "slower.glb",
+ "thumbnail_name": "slower.png",
"stop": 3,
"projectile": {
"type": "area",
@@ -249,11 +264,12 @@
},
{
"name": "heavy stopper",
- "cost": { "t": 1000 },
+ "cost": { "T": 1000 },
"cooldown": 3,
"range": 3,
"modules_max": 5,
"model_name": "slower.glb",
+ "thumbnail_name": "slower.png",
"stop": 5,
"projectile": {
"type": "area",
@@ -267,7 +283,8 @@
"resource_per_wave": { "T": 100 },
"upgrades": [ "kad generator" ],
"max_modules": 2,
- "model_name": "finance.glb"
+ "model_name": "finance.glb",
+ "thumbnail_name": "finance.png"
},
{
"name": "kad generator",
@@ -275,29 +292,34 @@
"resource_per_wave": { "k": 30, "a": 30, "d": 30 },
"upgrades": [ "s generator" ],
"max_modules": 2,
- "model_name": "finance.glb"
+ "model_name": "finance.glb",
+ "thumbnail_name": "finance.png"
},
{
"name": "s generator",
"cost": { "T": 800 },
"resource_per_wave": { "s": 30 },
"max_modules": 3,
- "model_name": "finance.glb"
+ "model_name": "finance.glb",
+ "thumbnail_name": "finance.png"
},
{
"name": "struct I",
"cost": { "T": 50 },
- "model_name": "structI.glb"
+ "model_name": "structI.glb",
+ "thumbnail_name": "structI.png"
},
{
"name": "struct T",
"cost": { "T": 100 },
"collider": "sphere",
- "model_name": "structT.glb"
+ "model_name": "structT.glb",
+ "thumbnail_name": "structT.png"
},
{
"name": "struct X",
"cost": { "T": 150 },
- "model_name": "structX.glb"
+ "model_name": "structX.glb",
+ "thumbnail_name": "structX.png"
}
]
diff --git a/scenes/gui.tscn b/scenes/gui.tscn
index a81e63b..4878cbf 100644
--- a/scenes/gui.tscn
+++ b/scenes/gui.tscn
@@ -11,6 +11,9 @@
bg_color = Color( 0, 0, 0, 0 )
border_width_bottom = 1
+[sub_resource type="StyleBoxFlat" id=6]
+bg_color = Color( 0, 0, 0, 0.482353 )
+
[sub_resource type="StyleBoxFlat" id=3]
resource_local_to_scene = true
resource_name = "border"
@@ -18,10 +21,6 @@ bg_color = Color( 0.6, 0.6, 0.6, 0 )
border_width_top = 1
shadow_offset = Vector2( 1, 1 )
-[sub_resource type="StyleBoxFlat" id=5]
-bg_color = Color( 0, 0, 0, 0.529412 )
-border_width_top = 1
-
[node name="gui" type="Control"]
anchor_right = 1.0
anchor_bottom = 1.0
@@ -216,6 +215,7 @@ anchor_right = 1.0
anchor_bottom = 1.0
margin_top = -120.0
margin_bottom = 1.0
+custom_styles/panel = SubResource( 6 )
script = ExtResource( 3 )
__meta__ = {
"_edit_use_anchors_": false
@@ -246,7 +246,6 @@ anchor_right = 1.0
anchor_bottom = 1.0
margin_top = -150.0
margin_bottom = -120.0
-custom_styles/panel = SubResource( 5 )
__meta__ = {
"_edit_use_anchors_": false
}
diff --git a/scenes/gui/gui_button.tscn b/scenes/gui/gui_button.tscn
index e199560..bc3f5f5 100644
--- a/scenes/gui/gui_button.tscn
+++ b/scenes/gui/gui_button.tscn
@@ -1,6 +1,6 @@
[gd_scene load_steps=4 format=2]
-[ext_resource path="res://scripts/gui_turret.gd" type="Script" id=1]
+[ext_resource path="res://scripts/gui_button.gd" type="Script" id=1]
[ext_resource path="res://themes/snub_theme.tres" type="Theme" id=2]
[sub_resource type="StyleBoxFlat" id=3]
@@ -11,7 +11,7 @@ border_width_right = 1
border_width_bottom = 1
shadow_offset = Vector2( 1, 1 )
-[node name="gui_turret" type="TextureButton"]
+[node name="gui_button" type="TextureButton"]
margin_right = 100.0
margin_bottom = 120.0
rect_min_size = Vector2( 100, 120 )
@@ -32,31 +32,28 @@ __meta__ = {
"_edit_use_anchors_": false
}
-[node name="panel" type="Panel" parent="."]
-anchor_top = 1.0
-anchor_right = 1.0
-anchor_bottom = 1.0
-margin_top = -20.0
-theme = ExtResource( 2 )
+[node name="texture" type="TextureRect" parent="."]
+margin_right = 100.0
+margin_bottom = 100.0
+mouse_filter = 2
__meta__ = {
"_edit_use_anchors_": false
}
-[node name="hbox" type="HBoxContainer" parent="."]
+[node name="panel" type="Panel" parent="."]
anchor_top = 1.0
anchor_right = 1.0
anchor_bottom = 1.0
margin_top = -20.0
-alignment = 1
+theme = ExtResource( 2 )
__meta__ = {
"_edit_use_anchors_": false
}
-[node name="name_label" type="Label" parent="hbox"]
-margin_left = 36.0
-margin_top = 1.0
-margin_right = 64.0
-margin_bottom = 19.0
+[node name="name" type="Label" parent="."]
+anchor_right = 1.0
+margin_top = 101.0
+margin_bottom = 119.0
text = "name"
align = 1
valign = 1
@@ -64,6 +61,15 @@ __meta__ = {
"_edit_use_anchors_": false
}
+[node name="cash" type="Label" parent="."]
+anchor_right = 1.0
+margin_right = -2.0
+margin_bottom = 118.0
+align = 2
+__meta__ = {
+"_edit_use_anchors_": false
+}
+
[node name="border" type="Panel" parent="."]
anchor_right = 1.0
anchor_bottom = 1.0
diff --git a/scenes/gui/gui_turret.tscn b/scenes/gui/gui_turret.tscn
index 1c618b6..08bfd58 100644
--- a/scenes/gui/gui_turret.tscn
+++ b/scenes/gui/gui_turret.tscn
@@ -1,6 +1,6 @@
[gd_scene load_steps=6 format=2]
-[ext_resource path="res://scripts/gui_turret.gd" type="Script" id=1]
+[ext_resource path="res://scripts/gui_button.gd" type="Script" id=1]
[ext_resource path="res://themes/snub_theme.tres" type="Theme" id=2]
[sub_resource type="Environment" id=2]
@@ -33,7 +33,15 @@ __meta__ = {
"_edit_use_anchors_": false
}
-[node name="ColorRect" type="ColorRect" parent="."]
+[node name="texture" type="TextureRect" parent="."]
+margin_right = 100.0
+margin_bottom = 100.0
+mouse_filter = 2
+__meta__ = {
+"_edit_use_anchors_": false
+}
+
+[node name="color" type="ColorRect" parent="."]
margin_right = 100.0
margin_bottom = 100.0
mouse_filter = 2
diff --git a/scripts/control.gd b/scripts/control.gd
index 2e31667..b88874f 100644
--- a/scripts/control.gd
+++ b/scripts/control.gd
@@ -58,9 +58,9 @@ func build_option (st, sttype):
var tname = turret_holder.get_node(editing_turret).info.name
for t in load_turrets.get_upg_turrets(tname):
opts += [ { "type": "turret upg", "name": t.name } ]
- opts += [ { "type": "text", "name": "sell" } ]
opts += [ { "type": "text", "name": "priority" } ]
opts += [ { "type": "text", "name": "modules" } ]
+ opts += [ { "type": "text", "name": "sell" } ]
opts += [ { "type": "text", "name": "back" } ]
gui.bottom_bar.picker.build(opts)
diff --git a/scripts/gui_picker.gd b/scripts/gui_picker.gd
index 7a20842..616b3e8 100644
--- a/scripts/gui_picker.gd
+++ b/scripts/gui_picker.gd
@@ -2,17 +2,23 @@ extends Panel
var _hbox : HBoxContainer
var _gui_button : Resource = load("res://scenes/gui/gui_button.tscn")
-var _gui_turret_button : Resource = load("res://scenes/gui/gui_turret.tscn")
var _options = []
var gui : Control
+var load_turrets : Node
+var resources : Node
var hovering = ""
func _fetch ():
if gui == null: gui = get_parent().gui
if _hbox == null: _hbox = $Hbox
+
+ var root = get_tree().root.get_node("world")
+ resources = root.get_node("player").get_node("resources")
+ load_turrets = root.get_node("saveload").get_node("load_turrets")
+ if !load_turrets.loaded: yield(load_turrets, "done_loading")
func build (options : Array = []):
_fetch()
@@ -26,28 +32,25 @@ func build (options : Array = []):
_options = options
for opt in _options:
- var button = null
+ var button = _gui_button.instance()
+ button.option = opt.name
+
if opt.type == "turret buy":
- button = _gui_turret_button.instance()
- _hbox.add_child(button)
- button.init(opt.name)
+ var tinfo = load_turrets.info[opt.name]
+ button.get_node("name").text = tinfo.name
+ button.get_node("cash").text = resources.dict_to_str(tinfo.cost)
+ button.get_node("texture").texture = load_turrets.thumbnails[tinfo.thumbnail_name]
if opt.type == "turret upg":
- button = _gui_turret_button.instance()
- _hbox.add_child(button)
- button.init(opt.name)
+ var tinfo = load_turrets.info[opt.name]
+ button.get_node("name").text = tinfo.name
+ button.get_node("cash").text = resources.dict_to_str(tinfo.cost)
+ button.get_node("texture").texture = load_turrets.thumbnails[tinfo.thumbnail_name]
if opt.type == "text":
- button = _gui_button.instance()
- _hbox.add_child(button)
- button.get_node("hbox").get_node("name_label").text = opt.name
+ button.get_node("name").text = opt.name
if opt.type == "color":
- button = _gui_button.instance()
- _hbox.add_child(button)
- button.get_node("hbox").get_node("name_label").text = ""
+ button.get_node("name").text = ""
button.get_node("color").color = opt.color
-
- if button != null:
- button.option = opt.name
- else: print("no option for " + str(opt))
+ _hbox.add_child(button)
for child in _hbox.get_children():
child.connect("mouse_entered", self, "_on_gui_turret_mouse_entered", [child.option])
@@ -56,11 +59,6 @@ func build (options : Array = []):
func refresh ():
_fetch()
- if gui.control.state == Globals.PlayerState.PICK:
- for child in _hbox.get_children(): child.picked = false
- if gui.control.selected == name:
- for child in _hbox.get_children():
- child.picked = child.name == gui.control.selected
func _on_gui_turret_mouse_entered(option : String):
hovering = option;
diff --git a/scripts/gui_turret.gd b/scripts/gui_turret.gd
deleted file mode 100644
index 55e3f5a..0000000
--- a/scripts/gui_turret.gd
+++ /dev/null
@@ -1,64 +0,0 @@
-extends TextureButton
-
-var option : String
-
-var info : Dictionary
-
-var _color_rect : ColorRect
-var _name_label : Label
-var _cash_label : Label
-
-var _viewport : Viewport
-var _spinner : Node
-var _mesh : Node
-
-var _resources : Node
-
-var picked : bool
-var enabled : bool = false
-
-var _rotate_timer : float
-
-func init (turret_name : String):
- var root = get_tree().root.get_node("world")
- var saveload = root.get_node("saveload")
- var load_turrets = saveload.get_node("load_turrets")
- if !load_turrets.loaded: yield(load_turrets, "done_loading")
- info = load_turrets.info[turret_name]
-
- _color_rect = $ColorRect
- _name_label = $hbox/name_label
- _cash_label = $cash_label
- _viewport = $viewport
- _spinner = $viewport/spinner
-
- _resources = root.get_node("player").get_node("resources")
-
- _name_label.text = turret_name
- _cash_label.text = _resources.dict_to_str(info.cost)
-
- var model = load_turrets.models[info.model_name]
- _mesh = model.instance()
- _spinner.add_child(_mesh)
-
- texture_normal = _viewport.get_texture()
-
-func _process(delta):
- if !has_node("viewport"): return
- if _spinner == null: _spinner = $viewport/spinner
- if _spinner != null:
- if _resources == null:
- var root = get_tree().root.get_node("world")
- _resources = root.get_node("player").get_node("resources")
-
- var afforded = _resources.greater_than(info.cost)
- if afforded: _color_rect.color = Color(0,0,0,0)
- else: _color_rect.color = Color(0,0,0,0.5)
-
- if afforded and (is_hovered() or picked):
- _spinner.transform.basis = _spinner.transform.rotated(Vector3.UP, delta).basis
- _rotate_timer = 0
- else:
- _rotate_timer = min(1, _rotate_timer + delta * 5)
- var idle_rot = Transform.rotated(Vector3.UP, PI-PI/4).basis
- _spinner.transform.basis = _spinner.transform.basis.slerp(idle_rot, _rotate_timer)
diff --git a/scripts/gui_turret_detail.gd b/scripts/gui_turret_detail.gd
index f895a6e..74e382e 100644
--- a/scripts/gui_turret_detail.gd
+++ b/scripts/gui_turret_detail.gd
@@ -5,6 +5,7 @@ var hbox_global
var _turret_holder : Node
var _turret_values : Resource = load("res://scenes/gui/gui_turret_values.tscn")
var load_turrets : Node
+var resources : Node
var gui : Control
@@ -18,6 +19,8 @@ func _fetch ():
hbox_labels = $"hbox_global/hbox_labels"
hbox_global = $"hbox_global"
+ resources = root.get_node("player").get_node("resources")
+
load_turrets = root.get_node("saveload").get_node("load_turrets")
if !load_turrets.loaded: yield(load_turrets, "done_loading")
diff --git a/scripts/load_turrets.gd b/scripts/load_turrets.gd
index 194525c..93e7841 100644
--- a/scripts/load_turrets.gd
+++ b/scripts/load_turrets.gd
@@ -4,7 +4,7 @@ var saveload : Node
var info : Dictionary
var models : Dictionary
-var thumbs : Dictionary
+var thumbnails : Dictionary
var loaded : bool = false
signal done_loading
@@ -13,6 +13,7 @@ func _ready():
get_saveload()
load_models()
load_info()
+ load_thumbnails()
emit_signal("done_loading")
loaded = true
@@ -21,7 +22,6 @@ func get_saveload():
func get_upg_turrets(turret_name):
var results = []
- return results # otherwise everything breaks
for turr in info[turret_name].get("upgrades", []):
results += [info[turr]]
return results
@@ -51,3 +51,10 @@ func load_models():
var files = saveload.parse_dir("res://assets/models/turrets", ".glb")
for turr in files:
models[turr] = load("res://assets/models/turrets/" + turr)
+
+func load_thumbnails():
+ thumbnails.clear()
+ var files = saveload.parse_dir("res://assets/textures/thumbnails/turrets", ".png")
+ for turr in files:
+ print(turr)
+ thumbnails[turr] = load("res://assets/textures/thumbnails/turrets/" + turr)