Customizable target height and radius

New gamemode configuration settings
This commit is contained in:
antimundo 2024-03-02 09:50:51 +01:00
parent 2a0d36886d
commit 2ec4a8ade6
No known key found for this signature in database
GPG key ID: F83F260F8F88F0BC
6 changed files with 27 additions and 11 deletions

View file

@ -10,6 +10,9 @@ movement={
"x": 0,
"y": 0
}
size=1
size={
"radius": 0.5,
"height": 1
}
health=0
initial_targets=1

View file

@ -10,6 +10,9 @@ movement={
"x": 5,
"y": 5
}
size=2
size={
"radius": 1,
"height": 2
}
health=0
initial_targets=6

View file

@ -10,6 +10,9 @@ movement={
"x": 0,
"y": 0
}
size=2
size={
"radius": 1,
"height": 2
}
health=0
initial_targets=3

View file

@ -10,6 +10,9 @@ movement={
"x": 15,
"y": 0
}
size=2
size={
"radius": 1,
"height": 4
}
health=3
initial_targets=1

View file

@ -2,7 +2,8 @@
[ext_resource type="Script" path="res://scenes/game_world/target.gd" id="1_mc4da"]
[sub_resource type="SphereShape3D" id="SphereShape3D_ccits"]
[sub_resource type="CapsuleShape3D" id="CapsuleShape3D_do5mn"]
height = 1.0
[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_nkxxc"]
albedo_color = Color(1, 1, 0, 1)
@ -10,10 +11,10 @@ emission_enabled = true
emission = Color(1, 0.74902, 0, 1)
emission_energy_multiplier = 0.5
[sub_resource type="SphereMesh" id="SphereMesh_gr1eg"]
[sub_resource type="CapsuleMesh" id="CapsuleMesh_xrxto"]
material = SubResource("StandardMaterial3D_nkxxc")
height = 1.0
radial_segments = 32
rings = 16
[node name="Target" type="CharacterBody3D" groups=["Enemy"]]
collision_mask = 2
@ -21,8 +22,8 @@ motion_mode = 1
script = ExtResource("1_mc4da")
[node name="CollisionShape3D" type="CollisionShape3D" parent="."]
shape = SubResource("SphereShape3D_ccits")
shape = SubResource("CapsuleShape3D_do5mn")
[node name="MeshInstance3D" type="MeshInstance3D" parent="CollisionShape3D"]
mesh = SubResource("SphereMesh_gr1eg")
mesh = SubResource("CapsuleMesh_xrxto")
skeleton = NodePath("../..")

View file

@ -21,8 +21,11 @@ func _ready():
material_override.set_emission(Global.string_to_color(DataManager.get_data(category, "TargetColor")))
mesh.material_override = material_override
func init(size = 0.5, movement = {"x": 0, "y": 0}):
scale = Vector3(size, size, size)
func init(size = {"radius": .5, "height": 1}, movement = {"x": 0, "y": 0}):
$CollisionShape3D.shape.radius = size.radius
$CollisionShape3D.shape.height = size.height
$CollisionShape3D/MeshInstance3D.mesh.radius = size.radius
$CollisionShape3D/MeshInstance3D.mesh.height = size.height
current_velocity = Vector3(randf_range(-movement.x, movement.x),\
randf_range(-movement.y, movement.y), 0)