From fe9738ca4603c276d501b21748142b1a9dab3e29 Mon Sep 17 00:00:00 2001 From: Shawn Date: Sun, 5 Jul 2026 23:54:57 -0400 Subject: [PATCH] Fix weapon switching, scale, add Q key bind - Fixed weapon switching: player.gd now uses weapon_next/weapon_prev/slot actions (was checking for nonexistent 'weapon_toggle') - Added Q key to weapon_next input action - Reduced weapon scale from 0.3 to 0.07-0.08 (was still 3x too large) --- assets/kenney-fps/objects/player.gd | 15 +++++++++++++-- assets/quaternius/weapons/p90.tscn | 2 +- assets/quaternius/weapons/pistol.tscn | 2 +- assets/quaternius/weapons/revolver.tscn | 2 +- assets/quaternius/weapons/rifle.tscn | 2 +- assets/quaternius/weapons/shotgun.tscn | 2 +- assets/quaternius/weapons/sniperrifle.tscn | 2 +- project.godot | 1 + 8 files changed, 20 insertions(+), 8 deletions(-) diff --git a/assets/kenney-fps/objects/player.gd b/assets/kenney-fps/objects/player.gd index dd9a240..ddfbee1 100644 --- a/assets/kenney-fps/objects/player.gd +++ b/assets/kenney-fps/objects/player.gd @@ -227,11 +227,22 @@ func action_shoot(): # Toggle between available weapons (listed in 'weapons') func action_weapon_toggle(): - if Input.is_action_just_pressed("weapon_toggle"): + if Input.is_action_just_pressed("weapon_next"): weapon_index = wrap(weapon_index + 1, 0, weapons.size()) initiate_change_weapon(weapon_index) - Audio.play("assets/kenney-fps/sounds/weapon_change.ogg") + + if Input.is_action_just_pressed("weapon_prev"): + weapon_index = wrap(weapon_index - 1, 0, weapons.size()) + initiate_change_weapon(weapon_index) + Audio.play("assets/kenney-fps/sounds/weapon_change.ogg") + + for i in range(4): + if Input.is_action_just_pressed("weapon_slot_" + str(i + 1)): + if i < weapons.size(): + weapon_index = i + initiate_change_weapon(weapon_index) + Audio.play("assets/kenney-fps/sounds/weapon_change.ogg") # Initiates the weapon changing animation (tween) diff --git a/assets/quaternius/weapons/p90.tscn b/assets/quaternius/weapons/p90.tscn index 35dfa10..856e642 100644 --- a/assets/quaternius/weapons/p90.tscn +++ b/assets/quaternius/weapons/p90.tscn @@ -3,6 +3,6 @@ [ext_resource type="PackedScene" path="res://assets/quaternius/models/P90.glb" id="1"] [node name="P90" type="Node3D"] -scale = Vector3(0.3, 0.3, 0.3) +scale = Vector3(0.07, 0.07, 0.07) [node name="Model" parent="." instance=ExtResource("1")] diff --git a/assets/quaternius/weapons/pistol.tscn b/assets/quaternius/weapons/pistol.tscn index f030993..c5b9ad0 100644 --- a/assets/quaternius/weapons/pistol.tscn +++ b/assets/quaternius/weapons/pistol.tscn @@ -3,6 +3,6 @@ [ext_resource type="PackedScene" path="res://assets/quaternius/models/Pistol.glb" id="1"] [node name="Pistol" type="Node3D"] -scale = Vector3(0.3, 0.3, 0.3) +scale = Vector3(0.08, 0.08, 0.08) [node name="Model" parent="." instance=ExtResource("1")] diff --git a/assets/quaternius/weapons/revolver.tscn b/assets/quaternius/weapons/revolver.tscn index 2364770..f580016 100644 --- a/assets/quaternius/weapons/revolver.tscn +++ b/assets/quaternius/weapons/revolver.tscn @@ -3,6 +3,6 @@ [ext_resource type="PackedScene" path="res://assets/quaternius/models/Revolver.glb" id="1"] [node name="Revolver" type="Node3D"] -scale = Vector3(0.3, 0.3, 0.3) +scale = Vector3(0.08, 0.08, 0.08) [node name="Model" parent="." instance=ExtResource("1")] diff --git a/assets/quaternius/weapons/rifle.tscn b/assets/quaternius/weapons/rifle.tscn index 5100a71..744ec7d 100644 --- a/assets/quaternius/weapons/rifle.tscn +++ b/assets/quaternius/weapons/rifle.tscn @@ -3,6 +3,6 @@ [ext_resource type="PackedScene" path="res://assets/quaternius/models/Rifle.glb" id="1"] [node name="Rifle" type="Node3D"] -scale = Vector3(0.3, 0.3, 0.3) +scale = Vector3(0.07, 0.07, 0.07) [node name="Model" parent="." instance=ExtResource("1")] diff --git a/assets/quaternius/weapons/shotgun.tscn b/assets/quaternius/weapons/shotgun.tscn index 2941682..740aff3 100644 --- a/assets/quaternius/weapons/shotgun.tscn +++ b/assets/quaternius/weapons/shotgun.tscn @@ -3,6 +3,6 @@ [ext_resource type="PackedScene" path="res://assets/quaternius/models/Shotgun.glb" id="1"] [node name="Shotgun" type="Node3D"] -scale = Vector3(0.3, 0.3, 0.3) +scale = Vector3(0.08, 0.08, 0.08) [node name="Model" parent="." instance=ExtResource("1")] diff --git a/assets/quaternius/weapons/sniperrifle.tscn b/assets/quaternius/weapons/sniperrifle.tscn index 8bacd03..310580e 100644 --- a/assets/quaternius/weapons/sniperrifle.tscn +++ b/assets/quaternius/weapons/sniperrifle.tscn @@ -3,6 +3,6 @@ [ext_resource type="PackedScene" path="res://assets/quaternius/models/SniperRifle.glb" id="1"] [node name="SniperRifle" type="Node3D"] -scale = Vector3(0.3, 0.3, 0.3) +scale = Vector3(0.07, 0.07, 0.07) [node name="Model" parent="." instance=ExtResource("1")] diff --git a/project.godot b/project.godot index a68390f..5a1bb3a 100644 --- a/project.godot +++ b/project.godot @@ -145,6 +145,7 @@ weapon_reload={ weapon_next={ "deadzone": 0.5, "events": [Object(InputEventMouseButton,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"button_mask":0,"position":Vector2(0, 0),"global_position":Vector2(0, 0),"factor":1.0,"button_index":4,"canceled":false,"pressed":false,"double_click":false,"script":null) +, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":81,"key_label":0,"unicode":113,"location":0,"echo":false,"script":null) ] } weapon_prev={