Adding more drone types
This commit is contained in:
parent
0716fd62e8
commit
cfe0fb2e5a
12 changed files with 107 additions and 12 deletions
11
entities/CollectorDrone.tscn
Normal file
11
entities/CollectorDrone.tscn
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
[gd_scene load_steps=2 format=3 uid="uid://dqdi1tpoid80c"]
|
||||
|
||||
[ext_resource type="Script" path="res://entities/scripts/collector_drone.gd" id="1_ws83e"]
|
||||
|
||||
[node name="CollectorDrone" type="Node2D"]
|
||||
script = ExtResource("1_ws83e")
|
||||
|
||||
[node name="Polygon2D" type="Polygon2D" parent="."]
|
||||
position = Vector2(1, -1)
|
||||
color = Color(0.620241, 0.619217, 0.900702, 1)
|
||||
polygon = PackedVector2Array(-28, -25, 25, -28, 26, 33, -32, 19)
|
||||
11
entities/DancerDrone.tscn
Normal file
11
entities/DancerDrone.tscn
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
[gd_scene load_steps=2 format=3 uid="uid://cx7cunaspu08a"]
|
||||
|
||||
[ext_resource type="Script" path="res://entities/scripts/dancer_drone.gd" id="1_44a5b"]
|
||||
|
||||
[node name="DancerDrone" type="Node2D"]
|
||||
script = ExtResource("1_44a5b")
|
||||
|
||||
[node name="Polygon2D" type="Polygon2D" parent="."]
|
||||
position = Vector2(1, -1)
|
||||
color = Color(0.354435, 0.719091, 0.745333, 1)
|
||||
polygon = PackedVector2Array(-28, -25, 25, -28, 26, 33, -32, 19)
|
||||
|
|
@ -1,3 +1,8 @@
|
|||
[gd_scene format=3 uid="uid://c44o1ygkb5861"]
|
||||
[gd_scene format=3 uid="uid://nxq2fd04ehcu"]
|
||||
|
||||
[node name="DirectorDrone" type="Node2D"]
|
||||
|
||||
[node name="Polygon2D" type="Polygon2D" parent="."]
|
||||
position = Vector2(1, -1)
|
||||
color = Color(0.703926, 0.656042, 0.441124, 1)
|
||||
polygon = PackedVector2Array(-28, -25, 25, -28, 26, 33, -32, 19)
|
||||
|
|
|
|||
11
entities/DistractorDrone.tscn
Normal file
11
entities/DistractorDrone.tscn
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
[gd_scene load_steps=2 format=3 uid="uid://ss2dg1i7j4ck"]
|
||||
|
||||
[ext_resource type="Script" path="res://entities/scripts/distractor_drone.gd" id="1_vnjar"]
|
||||
|
||||
[node name="DistractorDrone" type="Node2D"]
|
||||
script = ExtResource("1_vnjar")
|
||||
|
||||
[node name="Polygon2D" type="Polygon2D" parent="."]
|
||||
position = Vector2(1, -1)
|
||||
color = Color(0.926224, 0.528901, 0.424107, 1)
|
||||
polygon = PackedVector2Array(-28, -25, 25, -28, 26, 33, -32, 19)
|
||||
11
entities/scripts/collector_drone.gd
Normal file
11
entities/scripts/collector_drone.gd
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
class_name CollectorDrone extends Drone
|
||||
|
||||
|
||||
# Called when the node enters the scene tree for the first time.
|
||||
func _ready():
|
||||
pass # Replace with function body.
|
||||
|
||||
|
||||
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
||||
func _process(_delta):
|
||||
pass
|
||||
11
entities/scripts/dancer_drone.gd
Normal file
11
entities/scripts/dancer_drone.gd
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
class_name DancerDrone extends Drone
|
||||
|
||||
|
||||
# Called when the node enters the scene tree for the first time.
|
||||
func _ready():
|
||||
pass # Replace with function body.
|
||||
|
||||
|
||||
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
||||
func _process(_delta):
|
||||
pass
|
||||
11
entities/scripts/director_drone.gd
Normal file
11
entities/scripts/director_drone.gd
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
class_name DirectorDrone extends Drone
|
||||
|
||||
|
||||
# Called when the node enters the scene tree for the first time.
|
||||
func _ready():
|
||||
pass # Replace with function body.
|
||||
|
||||
|
||||
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
||||
func _process(_delta):
|
||||
pass
|
||||
11
entities/scripts/distractor_drone.gd
Normal file
11
entities/scripts/distractor_drone.gd
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
class_name DistractorDrone extends Drone
|
||||
|
||||
|
||||
# Called when the node enters the scene tree for the first time.
|
||||
func _ready():
|
||||
pass # Replace with function body.
|
||||
|
||||
|
||||
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
||||
func _process(_delta):
|
||||
pass
|
||||
1
entities/scripts/drone.gd
Normal file
1
entities/scripts/drone.gd
Normal file
|
|
@ -0,0 +1 @@
|
|||
class_name Drone extends Node2D
|
||||
|
|
@ -1,9 +1,8 @@
|
|||
extends HBoxContainer
|
||||
|
||||
func disable_buttons():
|
||||
## Get all children buttons
|
||||
var buttons = get_children()
|
||||
@onready var buttons = get_children()
|
||||
|
||||
func disable_buttons():
|
||||
## Disable all buttons
|
||||
for button in buttons:
|
||||
button.disabled = true
|
||||
|
|
@ -11,9 +10,6 @@ func disable_buttons():
|
|||
visible = false
|
||||
|
||||
func enable_buttons():
|
||||
## Get all children buttons
|
||||
var buttons = get_children()
|
||||
|
||||
## Enable all buttons
|
||||
for button in buttons:
|
||||
button.disabled = false
|
||||
|
|
@ -21,9 +17,6 @@ func enable_buttons():
|
|||
visible = true
|
||||
|
||||
func reset_button_focus():
|
||||
## Get all children buttons
|
||||
var buttons = get_children()
|
||||
|
||||
## Reset focus on all buttons
|
||||
for button in buttons:
|
||||
button.release_focus()
|
||||
|
|
|
|||
|
|
@ -6,7 +6,13 @@ var spawning_type : String = ""
|
|||
@onready var drone_controls = %DroneControls
|
||||
@onready var spawned_drones_container = get_node("SpawnedDrones")
|
||||
@onready var cursor = preload("res://resources/cursors/launch_drone.png")
|
||||
|
||||
# Drones!
|
||||
@onready var test_drone = preload("res://entities/TestDrone.tscn")
|
||||
@onready var director_drone = preload("res://entities/DirectorDrone.tscn")
|
||||
@onready var dancer_drone = preload("res://entities/DancerDrone.tscn")
|
||||
@onready var distractor_drone = preload("res://entities/DistractorDrone.tscn")
|
||||
@onready var collector_drone = preload("res://entities/CollectorDrone.tscn")
|
||||
|
||||
func _ready() -> void:
|
||||
Log.pr("Drone Manager Ready...")
|
||||
|
|
@ -23,7 +29,20 @@ func _input(event) -> void:
|
|||
|
||||
func spawn_drone(drone_type : String) -> void:
|
||||
Log.pr("This function will put a " + drone_type + " drone in the world")
|
||||
var new_drone = test_drone.instantiate()
|
||||
|
||||
var new_drone = null
|
||||
# Create a new instance of the drone
|
||||
if drone_type == "director":
|
||||
new_drone = director_drone.instantiate()
|
||||
elif drone_type == "dancer":
|
||||
new_drone = dancer_drone.instantiate()
|
||||
elif drone_type == "distractor":
|
||||
new_drone = distractor_drone.instantiate()
|
||||
elif drone_type == "collector":
|
||||
new_drone = collector_drone.instantiate()
|
||||
else:
|
||||
new_drone = test_drone.instantiate()
|
||||
|
||||
spawned_drones_container.add_child(new_drone)
|
||||
new_drone.position = get_viewport().get_mouse_position()
|
||||
|
||||
|
|
|
|||
|
|
@ -7,5 +7,5 @@ func _ready():
|
|||
|
||||
|
||||
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
||||
func _process(delta):
|
||||
func _process(_delta):
|
||||
pass
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue