feat: implement plasma gun and rocket swarm mechanics along with various 3D asset imports

This commit is contained in:
DottsGit
2026-06-07 18:23:47 -04:00
parent c9f082ebba
commit 4bb867a6f2
50 changed files with 5372 additions and 437 deletions
+18 -41
View File
@@ -13,7 +13,7 @@ var model_root: Node3D
var auto_switch_slot: int = -1
var is_swinging: bool = false
var default_pos: Vector3 = Vector3(0.3, -0.3, -0.6)
var default_pos: Vector3 = Vector3(0.3, -0.3, -0.945)
var fire_sound: AudioStreamPlayer3D
@@ -26,44 +26,21 @@ func _ready() -> void:
position = default_pos
func _build_model() -> void:
var mat_handle = StandardMaterial3D.new()
mat_handle.albedo_color = Color(0.1, 0.1, 0.1)
var mat_blade = StandardMaterial3D.new()
mat_blade.albedo_color = Color(0.8, 0.8, 0.8)
mat_blade.metallic = 0.8
mat_blade.roughness = 0.2
# Handle
var handle = MeshInstance3D.new()
var h_mesh = CylinderMesh.new()
h_mesh.top_radius = 0.02
h_mesh.bottom_radius = 0.02
h_mesh.height = 0.15
h_mesh.material = mat_handle
handle.mesh = h_mesh
handle.rotation.x = deg_to_rad(90)
handle.position = Vector3(0, 0, 0)
model_root.add_child(handle)
# Blade
var blade = MeshInstance3D.new()
var b_mesh = BoxMesh.new()
b_mesh.size = Vector3(0.01, 0.04, 0.25)
b_mesh.material = mat_blade
blade.mesh = b_mesh
blade.position = Vector3(0, 0, -0.2)
model_root.add_child(blade)
# Guard
var guard = MeshInstance3D.new()
var g_mesh = BoxMesh.new()
g_mesh.size = Vector3(0.06, 0.05, 0.01)
g_mesh.material = mat_handle
guard.mesh = g_mesh
guard.position = Vector3(0, 0, -0.075)
model_root.add_child(guard)
var model_scene = load("res://assets/weapons/knife/source/Knife.fbx")
if model_scene:
var model = model_scene.instantiate()
model_root.add_child(model)
model.scale = Vector3(0.125, 0.125, 0.125)
model.rotation_degrees.y = 270
for light in model.find_children("*", "Light3D", true, false):
light.queue_free()
var mat = StandardMaterial3D.new()
mat.albedo_texture = load("res://assets/weapons/knife/textures/Color Palette.png")
for child in model.find_children("*", "MeshInstance3D", true, false):
child.set_surface_override_material(0, mat)
# Audio (reusing shotgun reload or something generic for now, ideally a swish)
fire_sound = AudioStreamPlayer3D.new()
fire_sound.bus = "SFX"
@@ -106,11 +83,11 @@ func _swing() -> void:
var tween = create_tween()
# Windup: Move to the right, point the blade left and tilt it
tween.tween_property(self, "position", Vector3(0.6, -0.2, -0.4), 0.1)
tween.tween_property(self, "position", Vector3(0.6, -0.2, -0.630), 0.1)
tween.parallel().tween_property(self, "rotation", Vector3(deg_to_rad(10), deg_to_rad(80), deg_to_rad(-40)), 0.1)
# Swipe: Move across the screen to the left quickly
tween.tween_property(self, "position", Vector3(-0.6, -0.3, -0.5), 0.1)
tween.tween_property(self, "position", Vector3(-0.6, -0.3, -0.788), 0.1)
tween.parallel().tween_property(self, "rotation", Vector3(deg_to_rad(10), deg_to_rad(110), deg_to_rad(-60)), 0.1)
# Return to idle