Skip to content

Commit

Permalink
Customizable target height and radius
Browse files Browse the repository at this point in the history
New gamemode configuration settings
  • Loading branch information
antimundo committed Mar 2, 2024
1 parent 2a0d368 commit 2ec4a8a
Show file tree
Hide file tree
Showing 6 changed files with 27 additions and 11 deletions.
5 changes: 4 additions & 1 deletion assets/gamemodes/horizontal.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ movement={
"x": 0,
"y": 0
}
size=1
size={
"radius": 0.5,
"height": 1
}
health=0
initial_targets=1
5 changes: 4 additions & 1 deletion assets/gamemodes/moving.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ movement={
"x": 5,
"y": 5
}
size=2
size={
"radius": 1,
"height": 2
}
health=0
initial_targets=6
5 changes: 4 additions & 1 deletion assets/gamemodes/random.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ movement={
"x": 0,
"y": 0
}
size=2
size={
"radius": 1,
"height": 2
}
health=0
initial_targets=3
5 changes: 4 additions & 1 deletion assets/gamemodes/tracking.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ movement={
"x": 15,
"y": 0
}
size=2
size={
"radius": 1,
"height": 4
}
health=3
initial_targets=1
11 changes: 6 additions & 5 deletions scenes/enemies/target.tscn
Original file line number Diff line number Diff line change
Expand Up @@ -2,27 +2,28 @@

[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)
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
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("../..")
7 changes: 5 additions & 2 deletions scenes/game_world/target.gd
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down

0 comments on commit 2ec4a8a

Please sign in to comment.