summaryrefslogtreecommitdiff
path: root/scripts/incubator.gd
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/incubator.gd')
-rw-r--r--scripts/incubator.gd29
1 files changed, 25 insertions, 4 deletions
diff --git a/scripts/incubator.gd b/scripts/incubator.gd
index 245808e..3fd25cf 100644
--- a/scripts/incubator.gd
+++ b/scripts/incubator.gd
@@ -23,7 +23,7 @@ func _ready():
func set_world(i, world):
self.worlds[i] = world
var pos = get_node("spawns/" + str(i))
- world.set_translation(pos.global_transform.origin)
+ world.set_translation(pos.get_global_transform().origin)
func push_world(world):
for x in range(4):
@@ -34,7 +34,12 @@ func push_world(world):
func get_world(x):
return self.worlds[x]
-
+
+func display_life():
+ if self.selected_pos != null:
+ var w = self.get_world(self.selected_pos.x)
+ get_tree().get_root().get_node("Game/HUD").display_message(self.template.template(w), 15)
+
func _on_body_input_event( camera, event, click_pos, click_normal, shape_idx ):
if event.type == InputEvent.MOUSE_BUTTON and event.button_index == BUTTON_LEFT and event.is_pressed():
print("body")
@@ -48,17 +53,33 @@ func _on_right_input_event( camera, event, click_pos, click_normal, shape_idx ):
var w = get_world(self.selected_pos.x)
if w != null:
get_node("animation").play("right")
+ var exporter = get_tree().get_root().get_node("Game/Exporter")
+ exporter.push_world(w)
+ self.worlds[self.selected_pos.x] = null
+ self.selected.set_material_override(self.mat_unselected)
+ self.selected = null
+ self.selected_pos = null
+ var cam = get_tree().get_root().get_node("Game/Camera")
+ cam.select(exporter, exporter.get_node("point"))
func _on_left_input_event( camera, event, click_pos, click_normal, shape_idx ):
if event.type == InputEvent.MOUSE_BUTTON and event.button_index == BUTTON_LEFT and event.is_pressed():
print("evolve")
+ var message = "Cannot evolve, no world spot selected!"
if self.selected_pos != null:
var w = get_world(self.selected_pos.x)
if w != null:
get_node("animation").play("left")
+ var before = w.life.stage
w.evolve()
- get_tree().get_root().get_node("Game/HUD").display_message(self.template.get_stage(w.life.stage)["text"])
-
+ var after = w.life.stage
+ if before != after:
+ message = self.template.template(w)
+ else:
+ message = null
+ else:
+ message = "Cannot evolve, no world!"
+ get_tree().get_root().get_node("Game/HUD").display_message(message)
func _on_cylinder_input_event( camera, event, click_pos, click_normal, shape_idx, node, pos ):
if event.type == InputEvent.MOUSE_BUTTON and event.button_index == BUTTON_LEFT and event.is_pressed():