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
|
extends Spatial
var worlds = []
func _enter_tree():
for x in range(4):
var line = []
self.worlds.append(line)
for y in range(2):
line.append(null)
func set_world(x, y, world):
self.worlds[x][y] = world
var pos = get_node("spawns/" + str(x) + "-" + str(y))
world.set_translation(pos.global_transform.origin)
func push_world(world):
for x in range(4):
for y in range(2):
if self.worlds[x][y] == null:
set_world(x, y, world)
return
func get_world(x, y):
return self.worlds[x][y]
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:
print("body")
var cam = get_tree().get_root().get_camera()
cam.select(self, get_node("point"))
func _on_panel_input_event( camera, event, click_pos, click_normal, shape_idx ):
if event.type == InputEvent.MOUSE_BUTTON and event.button_index == BUTTON_LEFT:
print("panel")
var cam = get_tree().get_root().get_camera()
cam.select(self, get_node("point"))
|