Added slight weapon bounce, and more machete tweaks

This commit is contained in:
derek
2025-01-29 15:35:21 -06:00
parent 211b27e87b
commit f5546531a5
4 changed files with 25 additions and 3 deletions

View File

@@ -497,7 +497,7 @@ _surfaces = [{
blend_shape_mode = 0
shadow_mesh = SubResource("ArrayMesh_hlv3g")
[node name="item_pickup" type="RigidBody3D" groups=["item_pickup", "magnet", "persist", "scene_rigidbody"]]
[node name="item_pickup" type="RigidBody3D" groups=["item_pickup", "magnet", "persist", "scene_rigidbody", "spawned"]]
collision_layer = 16
collision_mask = 17
continuous_cd = true

View File

@@ -225,7 +225,6 @@ void fragment() {
}
"
graph_offset = Vector2(-813.719, 152.658)
modes/blend = 1
modes/cull = 2
varyings/WorldPos = "0,4"

View File

@@ -1,4 +1,4 @@
[gd_scene load_steps=25 format=4 uid="uid://bshuvj6xeaiiq"]
[gd_scene load_steps=26 format=4 uid="uid://bshuvj6xeaiiq"]
[ext_resource type="Script" path="res://scripts/melee_weapon.gd" id="1_afuhq"]
[ext_resource type="Texture2D" uid="uid://dtjnn8f8165dg" path="res://assets/Models/SubstancePainterTest/machete.blade_BaseColor.png" id="1_n1eld"]
@@ -131,6 +131,24 @@ tracks/1/interp = 1
tracks/1/loop_wrap = true
tracks/1/keys = PackedFloat32Array()
[sub_resource type="Animation" id="Animation_8gebu"]
resource_name = "inspect"
length = 3.0
tracks/0/type = "position_3d"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath("MacheteHandle")
tracks/0/interp = 2
tracks/0/loop_wrap = true
tracks/0/keys = PackedFloat32Array(0, 1, 0, 0, 0, 0.5, 1, -0.264724, 0, -0.0729126, 0.866667, 1, -0.264724, -0.0190706, -0.0729126, 1.8, 1, -0.264724, 0.259574, -0.0729126, 2.4, 1, -0.264724, 0.311364, -0.0729126, 3, 1, 0, 0, 0)
tracks/1/type = "rotation_3d"
tracks/1/imported = false
tracks/1/enabled = true
tracks/1/path = NodePath("MacheteHandle")
tracks/1/interp = 2
tracks/1/loop_wrap = true
tracks/1/keys = PackedFloat32Array(0, 1, 0, 0, 0, 1, 0.5, 1, -0.240367, 0.179593, 0.368453, 0.879893, 0.866667, 1, -0.234693, 0.195898, 0.397912, 0.864991, 1.8, 1, 0.685914, -0.47533, 0.516472, 0.191937, 2.4, 1, 0.663875, -0.432926, 0.605089, 0.0755786, 3, 1, 0, 0, 0, 1)
[sub_resource type="AudioStreamRandomizer" id="AudioStreamRandomizer_t3joi"]
random_pitch = 1.1
random_volume_offset_db = 2.0
@@ -239,6 +257,7 @@ tracks/2/keys = {
[sub_resource type="AnimationLibrary" id="AnimationLibrary_gmno4"]
_data = {
"RESET": SubResource("Animation_bmneo"),
"inspect": SubResource("Animation_8gebu"),
"shoot": SubResource("Animation_0mcf4"),
"swap_in": SubResource("Animation_xlf2w"),
"swap_out": SubResource("Animation_u7d31")

View File

@@ -1,6 +1,7 @@
extends CharacterBody3D
const JUMP_VELOCITY = 5
const JUMP_WEAPON_DIP = Vector3(0,-5,0)
const WALK_TRANSITION_SPEED = 7
const MAX_AIR_DASH = 1
const FLASHLIGHT_BRIGHTNESS = 30
@@ -79,6 +80,7 @@ var bullet_damage
var def_weapon_holder_pos : Vector3
var weapon_holder_start_rot
var weapon_holder_start_pos
var weapon_dip_pos = Vector3(0,0,0)
var gun_folded = false
var recoiling_fade = 0
var bullet_destination
@@ -214,6 +216,7 @@ func _physics_process(delta):
# Handle jump.
if Input.is_action_just_pressed("jump") and is_on_floor() and !is_climbing:
velocity.y += JUMP_VELOCITY
weapon_dip_pos += JUMP_WEAPON_DIP
crouched = false
elif Input.is_action_just_pressed("jump") and double_jump == true and !is_climbing:
velocity.y += JUMP_VELOCITY
@@ -705,6 +708,7 @@ func weapon_sway(delta):
func weapon_bob(vel : float, delta):
if weapon_holder:
weapon_holder.global_position.y += -clamp(velocity.y * .15,-1,1) * delta
if vel > 2 and is_on_floor():
var speed_adjust = speed/WALK_SPEED
var bob_amount : float = 0.05