aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjacopograndi <jacopo.grandi@outlook.it>2022-02-08 11:24:51 +0100
committerjacopograndi <jacopo.grandi@outlook.it>2022-02-08 11:24:51 +0100
commiteea642395bb0ef706c7241d4a749f3e0ac4cc460 (patch)
tree6c015c9315b0102247661f942b018ccf8c45551d
parente8b2ea6b2bf789b7942d86faebbcc4d810741f25 (diff)
revised wave generation
-rw-r--r--assets/maps/map0.json1
-rw-r--r--assets/maps/map1.json1
-rw-r--r--default_env.tres6
-rw-r--r--project.godot6
-rw-r--r--scenes/gui.tscn39
-rw-r--r--scripts/control.gd59
-rw-r--r--scripts/enemies.gd5
-rw-r--r--scripts/globals.gd4
-rw-r--r--scripts/gui.gd6
-rw-r--r--scripts/gui_bottom_bar.gd4
-rw-r--r--scripts/gui_picker.gd16
-rw-r--r--scripts/load_map.gd17
-rw-r--r--scripts/spawner.gd2
-rw-r--r--scripts/wave.gd35
14 files changed, 162 insertions, 39 deletions
diff --git a/assets/maps/map0.json b/assets/maps/map0.json
new file mode 100644
index 0000000..703bdbc
--- /dev/null
+++ b/assets/maps/map0.json
@@ -0,0 +1 @@
+{"attach":[{"id":"@attachPoint@786","pos":[3.25,0.25,1],"rot":[0.707107,0,0,0.707107]},{"id":"@attachPoint@787","pos":[-0.75,4,1.75],"rot":[0,0,0,1]},{"id":"@attachPoint@788","pos":[3.25,3.75,1.5],"rot":[0.707107,0,0,0.707107]},{"id":"@attachPoint@789","pos":[0.25,0.5,1.25],"rot":[0,0,0,1]}],"path":[{"id":"@path@755","pos":[1.25,0.75,2.75],"rot":[-0.707107,0,0,0.707107]},{"id":"@path@756","pos":[1.25,0.75,2.25],"rot":[-0.707107,0,0,0.707107]},{"id":"@path@757","pos":[1.25,0.75,1.75],"rot":[-0.707107,0,0,0.707107]},{"id":"@path@758","pos":[1.25,0.75,1.25],"rot":[-0.707107,0,0,0.707107]},{"id":"@path@759","pos":[1.25,0.75,0.75],"rot":[0,0,-0.707107,0.707107]},{"id":"@path@760","pos":[1.75,0.75,0.75],"rot":[0,0,-0.707107,0.707107]},{"id":"@path@761","pos":[2.25,0.75,0.75],"rot":[0,0,-0.707107,0.707107]},{"id":"@path@762","pos":[2.75,0.75,0.75],"rot":[0,0,0,1]},{"id":"@path@763","pos":[2.75,1.25,0.75],"rot":[0,0,0,1]},{"id":"@path@764","pos":[2.75,1.75,0.75],"rot":[0,0,0,1]},{"id":"@path@765","pos":[2.75,2.25,0.75],"rot":[0,0,0,1]},{"id":"@path@766","pos":[2.75,2.75,0.75],"rot":[0,0,0.707107,0.707107]},{"id":"@path@767","pos":[2.25,2.75,0.75],"rot":[0,0,0.707107,0.707107]},{"id":"@path@768","pos":[1.75,2.75,0.75],"rot":[0,0,0.707107,0.707107]},{"id":"@path@769","pos":[1.25,2.75,0.75],"rot":[0,0,0.707107,0.707107]},{"id":"@path@770","pos":[0.75,2.75,0.75],"rot":[0,0,0.707107,0.707107]},{"id":"@path@771","pos":[0.25,2.75,0.75],"rot":[0,0,0.707107,0.707107]},{"id":"@path@772","pos":[-0.25,2.75,0.75],"rot":[0.707107,0,0,0.707107]},{"id":"@path@773","pos":[-0.25,2.75,1.25],"rot":[0.707107,0,0,0.707107]},{"id":"@path@774","pos":[-0.25,2.75,1.75],"rot":[0.707107,0,0,0.707107]},{"id":"@path@775","pos":[-0.25,2.75,2.25],"rot":[0.707107,0,0,0.707107]},{"id":"@path@776","pos":[-0.25,2.75,2.75],"rot":[0.707107,0,0,0.707107]},{"id":"@path@777","pos":[-0.25,2.75,3.25],"rot":[0.707107,0,0,0.707107]},{"id":"@path@778","pos":[-0.25,2.75,3.75],"rot":[0.707107,0,0,0.707107]},{"id":"@path@779","pos":[-0.25,2.75,4.25],"rot":[0.707107,0,0,0.707107]},{"id":"@path@780","pos":[-0.25,2.75,4.75],"rot":[0.707107,0,0,0.707107]},{"id":"@path_end@781","pos":[-0.25,2.75,5.25],"rot":[0.707107,0,0,0.707107]},{"id":"path_start","pos":[1.25,0.75,5.25],"rot":[-0.707107,0,0,0.707107]},{"id":"@path@782","pos":[1.25,0.75,4.75],"rot":[-0.707107,0,0,0.707107]},{"id":"@path@783","pos":[1.25,0.75,4.25],"rot":[-0.707107,0,0,0.707107]},{"id":"@path@784","pos":[1.25,0.75,3.75],"rot":[-0.707107,0,0,0.707107]},{"id":"@path@785","pos":[1.25,0.75,3.25],"rot":[-0.707107,0,0,0.707107]}],"voxels":[{"id":0,"pos":[2,0,1]},{"id":0,"pos":[2,0,2]},{"id":0,"pos":[2,0,3]},{"id":0,"pos":[2,0,5]},{"id":0,"pos":[2,0,6]},{"id":0,"pos":[2,0,4]},{"id":0,"pos":[3,0,1]},{"id":0,"pos":[4,0,1]},{"id":0,"pos":[5,0,1]},{"id":2,"pos":[1,0,1]},{"id":2,"pos":[1,0,0]},{"id":2,"pos":[-2,4,0]},{"id":2,"pos":[-2,3,0]},{"id":2,"pos":[-2,2,0]},{"id":2,"pos":[-2,1,0]},{"id":2,"pos":[-2,0,0]},{"id":2,"pos":[-2,0,1]},{"id":2,"pos":[-2,0,2]},{"id":2,"pos":[-2,0,3]},{"id":2,"pos":[-2,4,3]},{"id":2,"pos":[-2,1,3]},{"id":2,"pos":[-2,2,3]},{"id":2,"pos":[-2,3,3]},{"id":2,"pos":[-1,0,3]},{"id":2,"pos":[0,0,3]},{"id":2,"pos":[1,0,3]},{"id":2,"pos":[1,0,2]},{"id":2,"pos":[-1,0,1]},{"id":2,"pos":[0,0,1]},{"id":2,"pos":[-1,0,2]},{"id":2,"pos":[0,0,2]},{"id":2,"pos":[-2,-1,3]},{"id":2,"pos":[-2,-1,0]},{"id":2,"pos":[1,-1,0]},{"id":2,"pos":[1,-1,3]},{"id":2,"pos":[-2,-1,2]},{"id":2,"pos":[0,-1,3]},{"id":2,"pos":[0,-2,3]},{"id":2,"pos":[0,-1,2]},{"id":2,"pos":[-1,-1,3]},{"id":2,"pos":[-1,-2,3]},{"id":2,"pos":[-2,-2,3]},{"id":2,"pos":[-2,-2,2]},{"id":2,"pos":[-2,-2,1]},{"id":2,"pos":[-2,-2,0]},{"id":2,"pos":[-1,-1,2]},{"id":2,"pos":[0,-1,1]},{"id":2,"pos":[-1,-1,1]},{"id":2,"pos":[1,-1,2]},{"id":2,"pos":[1,-1,1]},{"id":2,"pos":[-1,-1,0]},{"id":2,"pos":[1,-2,3]},{"id":2,"pos":[-1,-2,2]},{"id":2,"pos":[-1,-2,1]},{"id":2,"pos":[-1,-2,0]},{"id":2,"pos":[0,-2,0]},{"id":2,"pos":[0,-2,1]},{"id":2,"pos":[0,-2,2]},{"id":2,"pos":[1,-2,2]},{"id":2,"pos":[1,-2,1]},{"id":2,"pos":[1,-2,0]},{"id":0,"pos":[6,0,1]},{"id":0,"pos":[6,1,1]},{"id":0,"pos":[6,2,1]},{"id":0,"pos":[6,3,1]},{"id":0,"pos":[6,4,1]},{"id":0,"pos":[6,5,1]},{"id":0,"pos":[6,6,1]},{"id":0,"pos":[2,6,1]},{"id":0,"pos":[3,6,1]},{"id":0,"pos":[4,6,1]},{"id":0,"pos":[5,6,1]},{"id":2,"pos":[-2,-1,1]},{"id":2,"pos":[0,-1,0]},{"id":2,"pos":[9,5,2]},{"id":2,"pos":[9,5,1]},{"id":2,"pos":[9,4,2]},{"id":2,"pos":[9,4,1]},{"id":2,"pos":[9,3,2]},{"id":2,"pos":[9,3,1]},{"id":2,"pos":[9,2,2]},{"id":2,"pos":[9,2,1]},{"id":2,"pos":[-1,0,0]},{"id":0,"pos":[1,6,1]},{"id":0,"pos":[0,6,1]},{"id":0,"pos":[-1,6,1]},{"id":2,"pos":[2,-2,1]},{"id":2,"pos":[3,-2,1]},{"id":2,"pos":[4,-2,1]},{"id":2,"pos":[5,-2,1]},{"id":2,"pos":[2,-2,2]},{"id":2,"pos":[3,-2,2]},{"id":2,"pos":[5,-2,2]},{"id":2,"pos":[6,-2,2]},{"id":2,"pos":[7,-2,2]},{"id":2,"pos":[4,-2,2]},{"id":2,"pos":[6,-2,1]},{"id":2,"pos":[7,-2,1]},{"id":2,"pos":[8,-2,2]},{"id":2,"pos":[8,-2,1]},{"id":2,"pos":[9,-2,2]},{"id":2,"pos":[9,-2,1]},{"id":2,"pos":[9,-1,2]},{"id":2,"pos":[9,-1,1]},{"id":2,"pos":[9,0,1]},{"id":2,"pos":[9,0,2]},{"id":2,"pos":[9,1,1]},{"id":2,"pos":[9,1,2]},{"id":2,"pos":[-2,5,3]},{"id":2,"pos":[-2,5,0]},{"id":2,"pos":[-2,6,0]},{"id":2,"pos":[-2,7,0]},{"id":2,"pos":[-2,7,1]},{"id":2,"pos":[-2,7,2]},{"id":2,"pos":[-2,7,3]},{"id":2,"pos":[-2,6,3]},{"id":2,"pos":[6,7,1]},{"id":2,"pos":[6,7,2]},{"id":2,"pos":[7,7,1]},{"id":2,"pos":[7,7,2]},{"id":2,"pos":[8,7,2]},{"id":2,"pos":[9,7,2]},{"id":2,"pos":[9,6,2]},{"id":2,"pos":[9,6,1]},{"id":2,"pos":[8,7,1]},{"id":2,"pos":[9,7,1]},{"id":1,"pos":[-1,5,11]},{"id":1,"pos":[-1,6,9]},{"id":1,"pos":[-1,6,10]},{"id":1,"pos":[-1,6,11]},{"id":1,"pos":[0,5,9]},{"id":1,"pos":[0,5,10]},{"id":1,"pos":[0,5,11]},{"id":1,"pos":[0,6,9]},{"id":1,"pos":[0,6,10]},{"id":1,"pos":[0,6,11]},{"id":1,"pos":[-2,6,9]},{"id":1,"pos":[-2,6,10]},{"id":1,"pos":[-2,6,11]},{"id":1,"pos":[-2,4,9]},{"id":1,"pos":[-2,4,10]},{"id":1,"pos":[-2,4,11]},{"id":1,"pos":[-1,4,9]},{"id":1,"pos":[-1,4,10]},{"id":1,"pos":[-1,4,11]},{"id":1,"pos":[0,4,9]},{"id":1,"pos":[0,4,10]},{"id":1,"pos":[0,4,11]},{"id":1,"pos":[-2,5,9]},{"id":1,"pos":[-2,5,10]},{"id":1,"pos":[-2,5,11]},{"id":1,"pos":[3,1,11]},{"id":1,"pos":[3,1,9]},{"id":1,"pos":[3,1,10]},{"id":1,"pos":[3,2,9]},{"id":1,"pos":[3,2,10]},{"id":1,"pos":[3,2,11]},{"id":1,"pos":[2,2,9]},{"id":1,"pos":[2,2,10]},{"id":1,"pos":[2,2,11]},{"id":1,"pos":[3,0,9]},{"id":1,"pos":[3,0,10]},{"id":1,"pos":[2,0,10]},{"id":1,"pos":[3,0,11]},{"id":1,"pos":[2,0,11]},{"id":1,"pos":[2,0,9]},{"id":1,"pos":[1,2,9]},{"id":1,"pos":[1,1,9]},{"id":1,"pos":[1,2,10]},{"id":1,"pos":[1,2,11]},{"id":1,"pos":[1,1,11]},{"id":1,"pos":[1,1,10]},{"id":1,"pos":[1,0,9]},{"id":1,"pos":[1,0,10]},{"id":1,"pos":[1,0,11]},{"id":1,"pos":[2,1,11]},{"id":0,"pos":[2,0,7]},{"id":0,"pos":[2,0,8]},{"id":0,"pos":[-1,6,2]},{"id":0,"pos":[-1,6,3]},{"id":0,"pos":[-1,6,4]},{"id":0,"pos":[-1,6,5]},{"id":0,"pos":[-1,6,6]},{"id":0,"pos":[-1,6,7]},{"id":0,"pos":[-1,6,8]},{"id":2,"pos":[0,0,0]}],"voxels-palette":[{"color":[1,1,1,1],"id":0},{"color":[1,0.694118,0,1],"id":1},{"color":[0.282353,0,1,1],"id":2}]} \ No newline at end of file
diff --git a/assets/maps/map1.json b/assets/maps/map1.json
new file mode 100644
index 0000000..070f52f
--- /dev/null
+++ b/assets/maps/map1.json
@@ -0,0 +1 @@
+{"attach":[{"id":"attachPoint","pos":[3.25,0.25,1],"rot":[0.707107,0,0,0.707107]},{"id":"@attachPoint@110","pos":[-0.75,4,1.75],"rot":[0,0,0,1]},{"id":"@attachPoint@111","pos":[3.25,3.75,1.5],"rot":[0.707107,0,0,0.707107]},{"id":"@attachPoint@112","pos":[0.25,0.5,1.25],"rot":[0,0,0,1]}],"path":[{"id":"path","pos":[1.25,0.75,2.75],"rot":[-0.707107,0,0,0.707107]},{"id":"@path@81","pos":[1.25,0.75,2.25],"rot":[-0.707107,0,0,0.707107]},{"id":"@path@82","pos":[1.25,0.75,1.75],"rot":[-0.707107,0,0,0.707107]},{"id":"@path@83","pos":[1.25,0.75,1.25],"rot":[-0.707107,0,0,0.707107]},{"id":"@path@84","pos":[1.25,0.75,0.75],"rot":[0,0,-0.707107,0.707107]},{"id":"@path@85","pos":[1.75,0.75,0.75],"rot":[0,0,-0.707107,0.707107]},{"id":"@path@86","pos":[2.25,0.75,0.75],"rot":[0,0,-0.707107,0.707107]},{"id":"@path@87","pos":[2.75,0.75,0.75],"rot":[0,0,0,1]},{"id":"@path@88","pos":[2.75,1.25,0.75],"rot":[0,0,0,1]},{"id":"@path@89","pos":[2.75,1.75,0.75],"rot":[0,0,0,1]},{"id":"@path@90","pos":[2.75,2.25,0.75],"rot":[0,0,0,1]},{"id":"@path@91","pos":[2.75,2.75,0.75],"rot":[0,0,0.707107,0.707107]},{"id":"@path@92","pos":[2.25,2.75,0.75],"rot":[0,0,0.707107,0.707107]},{"id":"@path@93","pos":[1.75,2.75,0.75],"rot":[0,0,0.707107,0.707107]},{"id":"@path@94","pos":[1.25,2.75,0.75],"rot":[0,0,0.707107,0.707107]},{"id":"@path@95","pos":[0.75,2.75,0.75],"rot":[0,0,0.707107,0.707107]},{"id":"@path@96","pos":[0.25,2.75,0.75],"rot":[0,0,0.707107,0.707107]},{"id":"@path@97","pos":[-0.25,2.75,0.75],"rot":[0.707107,0,0,0.707107]},{"id":"@path@98","pos":[-0.25,2.75,1.25],"rot":[0.707107,0,0,0.707107]},{"id":"@path@99","pos":[-0.25,2.75,1.75],"rot":[0.707107,0,0,0.707107]},{"id":"@path@100","pos":[-0.25,2.75,2.25],"rot":[0.707107,0,0,0.707107]},{"id":"@path@101","pos":[-0.25,2.75,2.75],"rot":[0.707107,0,0,0.707107]},{"id":"@path@102","pos":[-0.25,2.75,3.25],"rot":[0.707107,0,0,0.707107]},{"id":"@path@103","pos":[-0.25,2.75,3.75],"rot":[0.707107,0,0,0.707107]},{"id":"@path@104","pos":[-0.25,2.75,4.25],"rot":[0.707107,0,0,0.707107]},{"id":"@path@105","pos":[-0.25,2.75,4.75],"rot":[0.707107,0,0,0.707107]},{"id":"path_end","pos":[-0.25,2.75,5.25],"rot":[0.707107,0,0,0.707107]},{"id":"path_start","pos":[1.25,0.75,5.25],"rot":[-0.707107,0,0,0.707107]},{"id":"@path@106","pos":[1.25,0.75,4.75],"rot":[-0.707107,0,0,0.707107]},{"id":"@path@107","pos":[1.25,0.75,4.25],"rot":[-0.707107,0,0,0.707107]},{"id":"@path@108","pos":[1.25,0.75,3.75],"rot":[-0.707107,0,0,0.707107]},{"id":"@path@109","pos":[1.25,0.75,3.25],"rot":[-0.707107,0,0,0.707107]}],"voxels":[{"id":0,"pos":[2,0,1]},{"id":0,"pos":[2,0,2]},{"id":0,"pos":[2,0,3]},{"id":0,"pos":[2,0,5]},{"id":0,"pos":[2,0,6]},{"id":0,"pos":[2,0,4]},{"id":0,"pos":[3,0,1]},{"id":0,"pos":[4,0,1]},{"id":0,"pos":[5,0,1]},{"id":2,"pos":[1,0,1]},{"id":2,"pos":[1,0,0]},{"id":2,"pos":[-2,4,0]},{"id":2,"pos":[-2,3,0]},{"id":2,"pos":[-2,2,0]},{"id":2,"pos":[-2,1,0]},{"id":2,"pos":[-2,0,0]},{"id":2,"pos":[-2,0,1]},{"id":2,"pos":[-2,0,2]},{"id":2,"pos":[-2,0,3]},{"id":2,"pos":[-2,4,3]},{"id":2,"pos":[-2,1,3]},{"id":2,"pos":[-2,2,3]},{"id":2,"pos":[-2,3,3]},{"id":2,"pos":[-1,0,3]},{"id":2,"pos":[0,0,3]},{"id":2,"pos":[1,0,3]},{"id":2,"pos":[1,0,2]},{"id":2,"pos":[-1,0,1]},{"id":2,"pos":[0,0,1]},{"id":2,"pos":[-1,0,2]},{"id":2,"pos":[0,0,2]},{"id":2,"pos":[-2,-1,3]},{"id":2,"pos":[-2,-1,0]},{"id":2,"pos":[1,-1,0]},{"id":2,"pos":[1,-1,3]},{"id":2,"pos":[-2,-1,2]},{"id":2,"pos":[0,-1,3]},{"id":2,"pos":[0,-2,3]},{"id":2,"pos":[0,-1,2]},{"id":2,"pos":[-1,-1,3]},{"id":2,"pos":[-1,-2,3]},{"id":2,"pos":[-2,-2,3]},{"id":2,"pos":[-2,-2,2]},{"id":2,"pos":[-2,-2,1]},{"id":2,"pos":[-2,-2,0]},{"id":2,"pos":[-1,-1,2]},{"id":2,"pos":[0,-1,1]},{"id":2,"pos":[-1,-1,1]},{"id":2,"pos":[1,-1,2]},{"id":2,"pos":[1,-1,1]},{"id":2,"pos":[-1,-1,0]},{"id":2,"pos":[1,-2,3]},{"id":2,"pos":[-1,-2,2]},{"id":2,"pos":[-1,-2,1]},{"id":2,"pos":[-1,-2,0]},{"id":2,"pos":[0,-2,0]},{"id":2,"pos":[0,-2,1]},{"id":2,"pos":[0,-2,2]},{"id":2,"pos":[1,-2,2]},{"id":2,"pos":[1,-2,1]},{"id":2,"pos":[1,-2,0]},{"id":0,"pos":[6,0,1]},{"id":0,"pos":[6,1,1]},{"id":0,"pos":[6,2,1]},{"id":0,"pos":[6,3,1]},{"id":0,"pos":[6,4,1]},{"id":0,"pos":[6,5,1]},{"id":0,"pos":[6,6,1]},{"id":0,"pos":[2,6,1]},{"id":0,"pos":[3,6,1]},{"id":0,"pos":[4,6,1]},{"id":0,"pos":[5,6,1]},{"id":2,"pos":[-2,-1,1]},{"id":2,"pos":[0,-1,0]},{"id":2,"pos":[9,5,2]},{"id":2,"pos":[9,5,1]},{"id":2,"pos":[9,4,2]},{"id":2,"pos":[9,4,1]},{"id":2,"pos":[9,3,2]},{"id":2,"pos":[9,3,1]},{"id":2,"pos":[9,2,2]},{"id":2,"pos":[9,2,1]},{"id":2,"pos":[-1,0,0]},{"id":0,"pos":[1,6,1]},{"id":0,"pos":[0,6,1]},{"id":0,"pos":[-1,6,1]},{"id":2,"pos":[2,-2,1]},{"id":2,"pos":[3,-2,1]},{"id":2,"pos":[4,-2,1]},{"id":2,"pos":[5,-2,1]},{"id":2,"pos":[2,-2,2]},{"id":2,"pos":[3,-2,2]},{"id":2,"pos":[5,-2,2]},{"id":2,"pos":[6,-2,2]},{"id":2,"pos":[7,-2,2]},{"id":2,"pos":[4,-2,2]},{"id":2,"pos":[6,-2,1]},{"id":2,"pos":[7,-2,1]},{"id":2,"pos":[8,-2,2]},{"id":2,"pos":[8,-2,1]},{"id":2,"pos":[9,-2,2]},{"id":2,"pos":[9,-2,1]},{"id":2,"pos":[9,-1,2]},{"id":2,"pos":[9,-1,1]},{"id":2,"pos":[9,0,1]},{"id":2,"pos":[9,0,2]},{"id":2,"pos":[9,1,1]},{"id":2,"pos":[9,1,2]},{"id":2,"pos":[-2,5,3]},{"id":2,"pos":[-2,5,0]},{"id":2,"pos":[-2,6,0]},{"id":2,"pos":[-2,7,0]},{"id":2,"pos":[-2,7,1]},{"id":2,"pos":[-2,7,2]},{"id":2,"pos":[-2,7,3]},{"id":2,"pos":[-2,6,3]},{"id":2,"pos":[6,7,1]},{"id":2,"pos":[6,7,2]},{"id":2,"pos":[7,7,1]},{"id":2,"pos":[7,7,2]},{"id":2,"pos":[8,7,2]},{"id":2,"pos":[9,7,2]},{"id":2,"pos":[9,6,2]},{"id":2,"pos":[9,6,1]},{"id":2,"pos":[8,7,1]},{"id":2,"pos":[9,7,1]},{"id":1,"pos":[-1,5,11]},{"id":1,"pos":[-1,6,9]},{"id":1,"pos":[-1,6,10]},{"id":1,"pos":[-1,6,11]},{"id":1,"pos":[0,5,9]},{"id":1,"pos":[0,5,10]},{"id":1,"pos":[0,5,11]},{"id":1,"pos":[0,6,9]},{"id":1,"pos":[0,6,10]},{"id":1,"pos":[0,6,11]},{"id":1,"pos":[-2,6,9]},{"id":1,"pos":[-2,6,10]},{"id":1,"pos":[-2,6,11]},{"id":1,"pos":[-2,4,9]},{"id":1,"pos":[-2,4,10]},{"id":1,"pos":[-2,4,11]},{"id":1,"pos":[-1,4,9]},{"id":1,"pos":[-1,4,10]},{"id":1,"pos":[-1,4,11]},{"id":1,"pos":[0,4,9]},{"id":1,"pos":[0,4,10]},{"id":1,"pos":[0,4,11]},{"id":1,"pos":[-2,5,9]},{"id":1,"pos":[-2,5,10]},{"id":1,"pos":[-2,5,11]},{"id":1,"pos":[3,1,11]},{"id":1,"pos":[3,1,9]},{"id":1,"pos":[3,1,10]},{"id":1,"pos":[3,2,9]},{"id":1,"pos":[3,2,10]},{"id":1,"pos":[3,2,11]},{"id":1,"pos":[2,2,9]},{"id":1,"pos":[2,2,10]},{"id":1,"pos":[2,2,11]},{"id":1,"pos":[3,0,9]},{"id":1,"pos":[3,0,10]},{"id":1,"pos":[2,0,10]},{"id":1,"pos":[3,0,11]},{"id":1,"pos":[2,0,11]},{"id":1,"pos":[2,0,9]},{"id":1,"pos":[1,2,9]},{"id":1,"pos":[1,1,9]},{"id":1,"pos":[1,2,10]},{"id":1,"pos":[1,2,11]},{"id":1,"pos":[1,1,11]},{"id":1,"pos":[1,1,10]},{"id":1,"pos":[1,0,9]},{"id":1,"pos":[1,0,10]},{"id":1,"pos":[1,0,11]},{"id":1,"pos":[2,1,11]},{"id":0,"pos":[2,0,7]},{"id":0,"pos":[2,0,8]},{"id":0,"pos":[-1,6,2]},{"id":0,"pos":[-1,6,3]},{"id":0,"pos":[-1,6,4]},{"id":0,"pos":[-1,6,5]},{"id":0,"pos":[-1,6,6]},{"id":0,"pos":[-1,6,7]},{"id":0,"pos":[-1,6,8]},{"id":2,"pos":[0,0,0]}],"voxels-palette":[{"color":[1,1,1,1],"id":0},{"color":[1,0.694118,0,1],"id":1},{"color":[0.282353,0,1,1],"id":2}]} \ No newline at end of file
diff --git a/default_env.tres b/default_env.tres
index 2b796db..a4c71d0 100644
--- a/default_env.tres
+++ b/default_env.tres
@@ -1,15 +1,11 @@
-[gd_resource type="Environment" load_steps=3 format=2]
-
-[ext_resource path="res://assets/textures/planet atmosphere.png" type="Texture" id=1]
+[gd_resource type="Environment" load_steps=2 format=2]
[sub_resource type="PanoramaSky" id=1]
radiance_size = 4
-panorama = ExtResource( 1 )
[resource]
background_mode = 1
background_sky = SubResource( 1 )
-background_color = Color( 0, 0, 0, 0 )
ambient_light_color = Color( 1, 1, 1, 1 )
ambient_light_energy = 0.1
ambient_light_sky_contribution = 0.0
diff --git a/project.godot b/project.godot
index 7c3047a..8854f8a 100644
--- a/project.godot
+++ b/project.godot
@@ -80,6 +80,11 @@ Globals="*res://scripts/globals.gd"
enabled=PoolStringArray( "res://addons/voxel-core/plugin.cfg" )
+[global]
+
+env=false
+default=false
+
[gui]
theme/use_hidpi=true
@@ -185,3 +190,4 @@ quality/shadows/filter_mode=2
quality/subsurface_scattering/quality=2
quality/filters/msaa=4
quality/filters/use_fxaa=true
+environment/default_environment="res://default_env.tres"
diff --git a/scenes/gui.tscn b/scenes/gui.tscn
index bd364c9..4db65b2 100644
--- a/scenes/gui.tscn
+++ b/scenes/gui.tscn
@@ -344,15 +344,6 @@ __meta__ = {
"_edit_use_anchors_": false
}
-[node name="palette" type="Button" parent="bottom_bar/editor_bar/hbox_tools"]
-margin_left = 197.0
-margin_right = 250.0
-margin_bottom = 25.0
-text = "Palette"
-__meta__ = {
-"_edit_use_anchors_": false
-}
-
[node name="hbox_map" type="HBoxContainer" parent="bottom_bar/editor_bar"]
anchor_left = 0.5
anchor_right = 1.0
@@ -518,16 +509,44 @@ __meta__ = {
"_edit_use_anchors_": false
}
+[node name="edit_palette" type="AcceptDialog" parent="."]
+anchor_left = 0.5
+anchor_top = 0.5
+anchor_right = 0.5
+anchor_bottom = 0.5
+margin_left = -191.5
+margin_top = -253.5
+margin_right = 191.5
+margin_bottom = 253.5
+grow_horizontal = 2
+grow_vertical = 2
+rect_min_size = Vector2( 200, 30 )
+popup_exclusive = true
+window_title = "Edit Voxel"
+dialog_text = "Select color:"
+__meta__ = {
+"_edit_use_anchors_": false
+}
+
+[node name="ColorPicker" type="ColorPicker" parent="edit_palette"]
+margin_left = 16.0
+margin_top = 40.4
+margin_right = 367.0
+margin_bottom = 477.4
+__meta__ = {
+"_edit_use_anchors_": false
+}
+
[connection signal="button_down" from="top_bar/panel/editor_button" to="top_bar" method="_on_editor_button_down"]
[connection signal="pressed" from="top_bar/panel/wave_button" to="top_bar" method="_on_wave_button_pressed"]
[connection signal="button_up" from="bottom_bar/editor_bar/hbox_tools/turrets" to="bottom_bar" method="_on_turrets_button_up"]
[connection signal="button_up" from="bottom_bar/editor_bar/hbox_tools/path" to="bottom_bar" method="_on_path_button_up"]
[connection signal="button_up" from="bottom_bar/editor_bar/hbox_tools/attach" to="bottom_bar" method="_on_attach_button_up"]
[connection signal="button_up" from="bottom_bar/editor_bar/hbox_tools/voxel" to="bottom_bar" method="_on_voxel_button_up"]
-[connection signal="button_up" from="bottom_bar/editor_bar/hbox_tools/palette" to="bottom_bar" method="_on_palette_button_up"]
[connection signal="button_up" from="bottom_bar/editor_bar/hbox_map/save" to="bottom_bar" method="_on_save_button_up"]
[connection signal="button_up" from="bottom_bar/editor_bar/hbox_map/save_as" to="bottom_bar" method="_on_save_as_button_up"]
[connection signal="button_up" from="bottom_bar/editor_bar/hbox_map/load" to="bottom_bar" method="_on_load_button_up"]
[connection signal="button_up" from="gui_load_map/vbox/close" to="." method="_on_close_load_map"]
[connection signal="confirmed" from="save_as" to="." method="_on_save_as_confirmed"]
[connection signal="confirmed" from="delete_confirm" to="." method="_on_delete_confirmed"]
+[connection signal="confirmed" from="edit_palette" to="." method="_on_edit_palette_confirmed"]
diff --git a/scripts/control.gd b/scripts/control.gd
index fafd3d8..2a9c76e 100644
--- a/scripts/control.gd
+++ b/scripts/control.gd
@@ -59,11 +59,12 @@ func build_option (st, sttype):
opts += [ { "type": "text", "name": "path" } ]
opts += [ { "type": "text", "name": "end path" } ]
Globals.StateType.VOXEL:
- for i in world.voxel_set.size():
+ for i in world.voxel_set.get_ids():
var details = world.voxel_set.get_voxel(i)
var color = Color(1, 0, 1)
if details.has("color"): color = details.color
opts += [ { "type": "color", "name": str(i), "color": color} ]
+ opts += [ { "type": "text", "name": "add" } ]
Globals.PlayerState.EDIT:
match sttype:
@@ -155,8 +156,19 @@ func do (action, par = {}):
Globals.PlayerState.PICK:
match action:
Globals.PlayerActions.PICK:
- selected = par.name
- state = Globals.PlayerState.PLACE
+ match statetype:
+ Globals.StateType.VOXEL:
+ match par.name:
+ "add":
+ selected = "add"
+ gui.edit_palette.popup()
+ build_option(state, statetype)
+ _:
+ selected = par.name
+ state = Globals.PlayerState.PLACE
+ _:
+ selected = par.name
+ state = Globals.PlayerState.PLACE
Globals.PlayerActions.SELECT:
match statetype:
@@ -174,6 +186,21 @@ func do (action, par = {}):
statetype = par.statetype
build_option(state, statetype)
+ Globals.PlayerActions.EDIT:
+ match statetype:
+ Globals.StateType.VOXEL:
+ match par.name:
+ "add":
+ selected = "add"
+ gui.edit_palette.popup()
+ build_option(state, statetype)
+ _:
+ selected = par.name
+ var dict = world.voxel_set.get_voxel(int(par.name))
+ gui.edit_palette.get_node("ColorPicker").color = dict.color
+ gui.edit_palette.popup()
+ build_option(state, statetype)
+
Globals.PlayerState.PLACE:
match action:
Globals.PlayerActions.PLACE:
@@ -205,6 +232,21 @@ func do (action, par = {}):
statetype = par.statetype
build_option(state, statetype)
+ Globals.PlayerActions.EDIT:
+ match statetype:
+ Globals.StateType.VOXEL:
+ match par.name:
+ "add":
+ selected = "add"
+ gui.edit_palette.popup()
+ build_option(state, statetype)
+ _:
+ selected = par.name
+ var dict = world.voxel_set.get_voxel(int(par.name))
+ gui.edit_palette.get_node("ColorPicker").color = dict.color
+ gui.edit_palette.popup()
+ build_option(state, statetype)
+
Globals.PlayerState.EDIT:
match action:
Globals.PlayerActions.PICK:
@@ -315,3 +357,14 @@ func gui_change_map_event (mapname : String):
path.refresh_path(ineditor)
gui.refresh()
+
+func gui_picked_color (color : Color):
+ if selected != "add":
+ var dict = world.voxel_set.get_voxel(int(selected))
+ dict.color = color
+ world.voxel_set.set_voxel(int(selected), dict)
+ else:
+ world.voxel_set.add_voxel({"color":color})
+ world.update_mesh()
+ build_option(state, statetype)
+ gui.refresh()
diff --git a/scripts/enemies.gd b/scripts/enemies.gd
index a0f4416..3e8276d 100644
--- a/scripts/enemies.gd
+++ b/scripts/enemies.gd
@@ -45,13 +45,14 @@ func _ready():
load_shapes = saveload.get_node("load_shapes")
if !load_shapes.loaded: yield(load_shapes, "done_loading")
-func spawn(name, node_cur=0, rel_pos=0):
+func spawn(name, node_cur=0, rel_pos=0, hp=0):
print("spawned " + name)
var instance = _enemy_blue.instance()
add_child(instance)
instance.transform.origin = _path.nodes[0].transform.origin;
instance.name = str(serial_enemy)
var info = load_shapes.info[name]
+ if hp == 0: hp = info.lives
var instance_model = load_shapes.models[info.model_name].instance()
instance.add_child(instance_model)
@@ -60,7 +61,7 @@ func spawn(name, node_cur=0, rel_pos=0):
var axis : Vector3 = Quat(Vector3(0, randf()*TAU, 0)) * Vector3.RIGHT
enemies[serial_enemy] = {
"name": name,
- "hp": info.lives,
+ "hp": hp,
"slow_effect": 0,
"slow_time": 0,
"cur": node_cur,
diff --git a/scripts/globals.gd b/scripts/globals.gd
index dc30b38..17318f7 100644
--- a/scripts/globals.gd
+++ b/scripts/globals.gd
@@ -11,7 +11,6 @@ enum StateType {
ATTACH,
PATH,
VOXEL,
- VOXEL_PALETTE
TARGETING
MODULES
MODULES_PICK
@@ -23,5 +22,6 @@ enum PlayerActions {
PLACE,
SELECT,
DELETE,
- CANCEL
+ CANCEL,
+ EDIT
}
diff --git a/scripts/gui.gd b/scripts/gui.gd
index 2e63483..65ff39b 100644
--- a/scripts/gui.gd
+++ b/scripts/gui.gd
@@ -10,6 +10,7 @@ var wave_ongoing : Panel
var load_map : PanelContainer
var save_as : AcceptDialog
var delete_confirm : AcceptDialog
+var edit_palette : AcceptDialog
var saveload : Node
var saveload_map : Node
@@ -30,6 +31,8 @@ func _fetch ():
save_as.register_text_enter(save_as.get_node("line_edit"))
if delete_confirm == null:
delete_confirm = $delete_confirm
+ if edit_palette == null:
+ edit_palette = $edit_palette
func _ready():
_fetch()
@@ -59,3 +62,6 @@ func _on_delete_confirmed():
func _on_close_load_map():
load_map.visible = false
+
+func _on_edit_palette_confirmed():
+ control.gui_picked_color(edit_palette.get_node("ColorPicker").color)
diff --git a/scripts/gui_bottom_bar.gd b/scripts/gui_bottom_bar.gd
index af987a4..f8012d3 100644
--- a/scripts/gui_bottom_bar.gd
+++ b/scripts/gui_bottom_bar.gd
@@ -42,10 +42,6 @@ func _on_voxel_button_up():
gui.control.do(Globals.PlayerActions.CHANGE_TYPE,
{ "statetype": Globals.StateType.VOXEL })
-func _on_palette_button_up():
- gui.control.do(Globals.PlayerActions.CHANGE_TYPE,
- { "statetype": Globals.StateType.VOXEL_PALETTE })
-
func _on_save_button_up():
gui.control.gui_save_map_event()
diff --git a/scripts/gui_picker.gd b/scripts/gui_picker.gd
index 85909ec..f9a27fa 100644
--- a/scripts/gui_picker.gd
+++ b/scripts/gui_picker.gd
@@ -40,7 +40,7 @@ func build (options : Array = []):
for child in _hbox.get_children():
child.disconnect("mouse_entered", self, "_on_gui_turret_mouse_entered")
child.disconnect("mouse_exited", self, "_on_gui_turret_mouse_exited")
- child.disconnect("pressed", self, "_on_gui_turret_pressed")
+ child.disconnect("gui_input", self, "_on_gui_turret_input")
child.queue_free()
_options = options
@@ -77,7 +77,7 @@ func build (options : Array = []):
for child in _hbox.get_children():
child.connect("mouse_entered", self, "_on_gui_turret_mouse_entered", [child.option])
child.connect("mouse_exited", self, "_on_gui_turret_mouse_exited", [child.option])
- child.connect("pressed", self, "_on_gui_turret_pressed", [child.option])
+ child.connect("gui_input", self, "_on_gui_turret_input", [child.option])
func refresh ():
_fetch()
@@ -89,4 +89,14 @@ func _on_gui_turret_mouse_exited(option : Dictionary):
hovering = ""
func _on_gui_turret_pressed(option : Dictionary):
- gui.control.do(Globals.PlayerActions.PICK, option)
+ #gui.control.do(Globals.PlayerActions.PICK, option)
+ pass
+
+func _on_gui_turret_input(event, option : Dictionary):
+ if event is InputEventMouseButton and event.pressed:
+ match event.button_index:
+ BUTTON_LEFT:
+ gui.control.do(Globals.PlayerActions.PICK, option)
+ BUTTON_RIGHT:
+ gui.control.do(Globals.PlayerActions.EDIT, option)
+
diff --git a/scripts/load_map.gd b/scripts/load_map.gd
index 13d9255..6a2c67c 100644
--- a/scripts/load_map.gd
+++ b/scripts/load_map.gd
@@ -1,7 +1,7 @@
extends Node
var mapname = "map0.json"
-var mappath = "user://"
+var mappath = "./assets/maps/"
var _world : VoxelMesh = null
var _path_holder : Node = null
@@ -29,6 +29,14 @@ func get_map_state ():
fetch()
var state = {}
+ state["voxels-palette"] = []
+ for id in _world.voxel_set.get_ids():
+ var col : Color = _world.voxel_set.get_voxel(id).color
+ var pal = {
+ "color": [ col.r, col.g, col.b, col.a ],
+ "id": id }
+ state["voxels-palette"] += [pal]
+
state["voxels"] = []
for pos in _world.get_voxels():
var vox = { "pos": [pos.x, pos.y, pos.z], "id":_world.get_voxel_id(pos) }
@@ -60,7 +68,14 @@ func get_map_state ():
func set_map_state (state):
fetch()
+
_world.erase_voxels()
+
+ _world.voxel_set.erase_voxels()
+ for vox in state["voxels-palette"]:
+ var col = Color(vox.color[0], vox.color[1], vox.color[2], vox.color[3])
+ _world.voxel_set.add_voxel({ "color": col })
+
for vox in state["voxels"]:
var vecpos = Vector3(vox.pos[0], vox.pos[1], vox.pos[2]);
_world.set_voxel(vecpos, vox.id)
diff --git a/scripts/spawner.gd b/scripts/spawner.gd
index 9866168..284ae76 100644
--- a/scripts/spawner.gd
+++ b/scripts/spawner.gd
@@ -20,5 +20,5 @@ func _on_timer_batch_timeout():
queue_free()
return
- enemy_holder.spawn(n.enemy)
+ enemy_holder.spawn(n.enemy, 0, 0, n.hp)
start(n.cooldown)
diff --git a/scripts/wave.gd b/scripts/wave.gd
index e61dfef..691b703 100644
--- a/scripts/wave.gd
+++ b/scripts/wave.gd
@@ -10,6 +10,8 @@ var ongoing = false
var load_shapes : Node
var gui : Node
+var rng = RandomNumberGenerator.new()
+
func fetch ():
var root = get_tree().root.get_node("world")
var saveload = root.get_node("saveload")
@@ -22,7 +24,8 @@ func make_queue (spawn):
for n in order.amount:
var e = {
"cooldown": order.cooldown,
- "enemy": order.enemy
+ "enemy": order.enemy,
+ "hp": order.hp
}
queue += [e]
if spawn.random: queue.shuffle()
@@ -50,25 +53,40 @@ func get_affordable_enemies (hp_budget : int):
if load_shapes.info[enemy].cost <= hp_budget:
aff += [load_shapes.info[enemy]]
return aff
+
+func sort_aff_comp(a, b): return a.cost < b.cost
-func pick_enemy (hp_budget : int):
+func pick_enemy (hp_budget : int, density : float, height: float):
var amt = 1
var aff = get_affordable_enemies(hp_budget)
- var enemy = aff[randi() % aff.size()]
+ aff.sort_custom(self, "sort_aff_comp")
+
+ #var rn = rng.randf()
+ #var pick : float = pow(rn, 2*height*(1-rn) + rn)
+ var enemy = aff[round(height * (aff.size()-1))]
+
+ var cooldown : float = rng.randf() * pow(4, density - 0.5)
+
+ var hp_adjusted = max(1, enemy.lives * height)
+ var cost = enemy.cost - enemy.lives + hp_adjusted
+
+ print(cost)
+
var order = {
"amount" : amt,
"enemy": enemy.name,
- "cooldown": 0.5
+ "hp": hp_adjusted,
+ "cooldown": cooldown
}
- return { "enemy": order, "cost": enemy.cost }
+ return { "enemy": order, "cost": cost }
-func gen_wave (wave_num : int):
+func gen_wave (wave_num : int, density : float, height: float):
var hp_budget = get_hp_budget(wave_num)
var enemies = []
for i in range(0, 1000):
if hp_budget < 10: break
- var enemy_cost = pick_enemy(hp_budget)
+ var enemy_cost = pick_enemy(hp_budget, density, height)
enemies += [ enemy_cost.enemy ]
hp_budget -= enemy_cost.cost
@@ -82,10 +100,11 @@ func gen_wave (wave_num : int):
func start():
fetch()
+ rng.randomize()
ongoing = true
var w = null
if wave_num <= waves.size()-1: w = waves[wave_num]
- else: w = gen_wave(wave_num)
+ else: w = gen_wave(wave_num, 0.5, 0.2)
start_wave(w)
func end():