better selection
This commit is contained in:
+1
-2
@@ -1,9 +1,8 @@
|
||||
extends Node
|
||||
|
||||
var naampje = "je moeder"
|
||||
var creature_id = 9
|
||||
|
||||
func _ready():
|
||||
print(naampje)
|
||||
get_node("Area").connect('input_event', get_parent(), 'select_a_bitch', [creature_id])
|
||||
get_node("Area").connect('input_event', get_parent(), 'select_a_bitch', [get_index()])
|
||||
pass
|
||||
+6
-5
@@ -2,7 +2,6 @@ extends Node
|
||||
export (PackedScene) var Creature
|
||||
|
||||
var selected = []
|
||||
var id_counter = 0
|
||||
|
||||
func _ready():
|
||||
pass
|
||||
@@ -10,8 +9,6 @@ func _ready():
|
||||
func spawn_a_bitch():
|
||||
# Maak een bitch
|
||||
var c = Creature.instance()
|
||||
c.creature_id = id_counter
|
||||
id_counter += 1
|
||||
add_child(c)
|
||||
|
||||
# Geef de bitch een random positie en rotatie
|
||||
@@ -28,6 +25,10 @@ func kill_a_bitch():
|
||||
func select_a_bitch(camera, event, click_position, click_normal, index, creature_id):
|
||||
if event.is_action_pressed("select_creature"):
|
||||
var kindeke = get_child(creature_id)
|
||||
selected.push(creature_id)
|
||||
kindeke.get_node("SelectionIndicator").visible = true;
|
||||
if selected.has(creature_id):
|
||||
kindeke.get_node("SelectionIndicator").visible = false;
|
||||
selected.erase(creature_id)
|
||||
else:
|
||||
selected.append(creature_id)
|
||||
kindeke.get_node("SelectionIndicator").visible = true;
|
||||
print(creature_id)
|
||||
Reference in New Issue
Block a user