tweaks to crouch etc
This commit is contained in:
@@ -13,7 +13,7 @@ dest_files=["res://.godot/imported/footsteps-tennis-shoes-walk-1.wav-fce690a551b
|
|||||||
[params]
|
[params]
|
||||||
|
|
||||||
force/8_bit=false
|
force/8_bit=false
|
||||||
force/mono=false
|
force/mono=true
|
||||||
force/max_rate=false
|
force/max_rate=false
|
||||||
force/max_rate_hz=44100
|
force/max_rate_hz=44100
|
||||||
edit/trim=false
|
edit/trim=false
|
||||||
|
|||||||
@@ -1269,7 +1269,7 @@ transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.100218, 24.4327, 46.4567)
|
|||||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.100218, 28.3013, 46.4567)
|
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.100218, 28.3013, 46.4567)
|
||||||
|
|
||||||
[node name="LadderCollisionCheck2" parent="." instance=ExtResource("14_gijx0")]
|
[node name="LadderCollisionCheck2" parent="." instance=ExtResource("14_gijx0")]
|
||||||
transform = Transform3D(1, 0, 0, 0, 1.88048, 0, 0, 0, 1, -0.0459655, 17.4816, 46.7744)
|
transform = Transform3D(1, 0, 0, 0, 1.88048, 0, 0, 0, 0.180683, -0.0459655, 17.4816, 46.5358)
|
||||||
|
|
||||||
[node name="pistol1_pickup" parent="." instance=ExtResource("17_buv6l")]
|
[node name="pistol1_pickup" parent="." instance=ExtResource("17_buv6l")]
|
||||||
transform = Transform3D(0.558498, -0.829506, 0, 0.829506, 0.558498, 0, 0, 0, 1, 35.2023, 17.3708, 122.41)
|
transform = Transform3D(0.558498, -0.829506, 0, 0.829506, 0.558498, 0, 0, 0, 1, 35.2023, 17.3708, 122.41)
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ stream_3/stream = ExtResource("6_qbbeb")
|
|||||||
|
|
||||||
[node name="casing" type="RigidBody3D" groups=["scene_rigidbody", "spawned"]]
|
[node name="casing" type="RigidBody3D" groups=["scene_rigidbody", "spawned"]]
|
||||||
collision_layer = 0
|
collision_layer = 0
|
||||||
collision_mask = 165
|
collision_mask = 37
|
||||||
mass = 0.1
|
mass = 0.1
|
||||||
continuous_cd = true
|
continuous_cd = true
|
||||||
contact_monitor = true
|
contact_monitor = true
|
||||||
@@ -44,6 +44,7 @@ autostart = true
|
|||||||
|
|
||||||
[node name="DropSound" type="AudioStreamPlayer3D" parent="."]
|
[node name="DropSound" type="AudioStreamPlayer3D" parent="."]
|
||||||
stream = SubResource("AudioStreamRandomizer_kdfna")
|
stream = SubResource("AudioStreamRandomizer_kdfna")
|
||||||
|
volume_db = -2.0
|
||||||
unit_size = 1.0
|
unit_size = 1.0
|
||||||
bus = &"SFX"
|
bus = &"SFX"
|
||||||
|
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
@@ -1,4 +1,4 @@
|
|||||||
[gd_scene load_steps=30 format=3 uid="uid://drwae3loscbw7"]
|
[gd_scene load_steps=33 format=3 uid="uid://drwae3loscbw7"]
|
||||||
|
|
||||||
[ext_resource type="Script" path="res://scripts/player.gd" id="1_x7wms"]
|
[ext_resource type="Script" path="res://scripts/player.gd" id="1_x7wms"]
|
||||||
[ext_resource type="Script" path="res://scripts/recoil.gd" id="3_405jc"]
|
[ext_resource type="Script" path="res://scripts/recoil.gd" id="3_405jc"]
|
||||||
@@ -21,6 +21,7 @@
|
|||||||
[ext_resource type="AudioStream" uid="uid://dqj4cx05f25jj" path="res://assets/Audio/punch-body-hard-SBA-300156881.wav" id="19_6jglu"]
|
[ext_resource type="AudioStream" uid="uid://dqj4cx05f25jj" path="res://assets/Audio/punch-body-hard-SBA-300156881.wav" id="19_6jglu"]
|
||||||
[ext_resource type="AudioStream" uid="uid://n3e7s3xucsi1" path="res://assets/Audio/Foley Inventory and Interactions/Foley Inventory and Interactions/Drop Item/Drop Jewelery B.wav" id="20_rvr83"]
|
[ext_resource type="AudioStream" uid="uid://n3e7s3xucsi1" path="res://assets/Audio/Foley Inventory and Interactions/Foley Inventory and Interactions/Drop Item/Drop Jewelery B.wav" id="20_rvr83"]
|
||||||
[ext_resource type="AudioStream" uid="uid://ig4e5tgbh87m" path="res://assets/Audio/Player Character SFX/footsteps-tennis-shoes-walk-1.wav" id="21_fsjho"]
|
[ext_resource type="AudioStream" uid="uid://ig4e5tgbh87m" path="res://assets/Audio/Player Character SFX/footsteps-tennis-shoes-walk-1.wav" id="21_fsjho"]
|
||||||
|
[ext_resource type="AudioStream" uid="uid://c7bwilypn74lc" path="res://assets/Audio/Foley Sports/Hockey/Ball Hit Leg.wav" id="22_c88rq"]
|
||||||
|
|
||||||
[sub_resource type="CanvasItemMaterial" id="CanvasItemMaterial_l5ga0"]
|
[sub_resource type="CanvasItemMaterial" id="CanvasItemMaterial_l5ga0"]
|
||||||
blend_mode = 1
|
blend_mode = 1
|
||||||
@@ -31,6 +32,10 @@ blend_mode = 1
|
|||||||
radius = 0.509802
|
radius = 0.509802
|
||||||
height = 2.03547
|
height = 2.03547
|
||||||
|
|
||||||
|
[sub_resource type="CapsuleShape3D" id="CapsuleShape3D_rw673"]
|
||||||
|
radius = 0.509802
|
||||||
|
height = 1.19106
|
||||||
|
|
||||||
[sub_resource type="LabelSettings" id="LabelSettings_n0odj"]
|
[sub_resource type="LabelSettings" id="LabelSettings_n0odj"]
|
||||||
font = ExtResource("3_mbuvp")
|
font = ExtResource("3_mbuvp")
|
||||||
font_size = 115
|
font_size = 115
|
||||||
@@ -72,8 +77,13 @@ random_pitch = 2.0
|
|||||||
streams_count = 1
|
streams_count = 1
|
||||||
stream_0/stream = ExtResource("21_fsjho")
|
stream_0/stream = ExtResource("21_fsjho")
|
||||||
|
|
||||||
|
[sub_resource type="AudioStreamRandomizer" id="AudioStreamRandomizer_u5cxn"]
|
||||||
|
random_pitch = 1.1
|
||||||
|
streams_count = 1
|
||||||
|
stream_0/stream = ExtResource("22_c88rq")
|
||||||
|
|
||||||
[node name="Player" type="CharacterBody3D" node_paths=PackedStringArray("weapon_holder") groups=["player"]]
|
[node name="Player" type="CharacterBody3D" node_paths=PackedStringArray("weapon_holder") groups=["player"]]
|
||||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1.11359, 0)
|
transform = Transform3D(1, 0.000164476, 0.000583754, -0.000165075, 0.999999, 0.00104027, -0.000583585, -0.00104036, 0.999999, 0, 1.11359, 0)
|
||||||
collision_layer = 6
|
collision_layer = 6
|
||||||
collision_mask = 11
|
collision_mask = 11
|
||||||
script = ExtResource("1_x7wms")
|
script = ExtResource("1_x7wms")
|
||||||
@@ -90,9 +100,17 @@ color = Color(0.470588, 0, 0, 0)
|
|||||||
visible = false
|
visible = false
|
||||||
mesh = SubResource("CapsuleMesh_n7uf3")
|
mesh = SubResource("CapsuleMesh_n7uf3")
|
||||||
|
|
||||||
[node name="CollisionShape3D" type="CollisionShape3D" parent="."]
|
[node name="StandingCollision" type="CollisionShape3D" parent="."]
|
||||||
shape = SubResource("CapsuleShape3D_ko22d")
|
shape = SubResource("CapsuleShape3D_ko22d")
|
||||||
|
|
||||||
|
[node name="CrouchingCollision" type="CollisionShape3D" parent="."]
|
||||||
|
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -0.421329, 0)
|
||||||
|
shape = SubResource("CapsuleShape3D_rw673")
|
||||||
|
|
||||||
|
[node name="CrouchCheck" type="RayCast3D" parent="CrouchingCollision"]
|
||||||
|
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.589976, 0)
|
||||||
|
target_position = Vector3(0, 0.9, 0)
|
||||||
|
|
||||||
[node name="Head" type="Node3D" parent="."]
|
[node name="Head" type="Node3D" parent="."]
|
||||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.889, 0)
|
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.889, 0)
|
||||||
|
|
||||||
@@ -257,6 +275,11 @@ pitch_scale = 1.5
|
|||||||
|
|
||||||
[node name="FootstepSound" type="AudioStreamPlayer3D" parent="Audio"]
|
[node name="FootstepSound" type="AudioStreamPlayer3D" parent="Audio"]
|
||||||
stream = SubResource("AudioStreamRandomizer_pxyjg")
|
stream = SubResource("AudioStreamRandomizer_pxyjg")
|
||||||
|
volume_db = 6.0
|
||||||
|
|
||||||
|
[node name="HitHead" type="AudioStreamPlayer3D" parent="Audio"]
|
||||||
|
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1.42626, 0)
|
||||||
|
stream = SubResource("AudioStreamRandomizer_u5cxn")
|
||||||
|
|
||||||
[connection signal="tree_entered" from="." to="." method="_on_tree_entered"]
|
[connection signal="tree_entered" from="." to="." method="_on_tree_entered"]
|
||||||
[connection signal="body_entered" from="pick_up_detection" to="." method="_on_pick_up_detection_body_entered"]
|
[connection signal="body_entered" from="pick_up_detection" to="." method="_on_pick_up_detection_body_entered"]
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ version_control/autoload_on_startup=true
|
|||||||
|
|
||||||
[editor_plugins]
|
[editor_plugins]
|
||||||
|
|
||||||
enabled=PackedStringArray("res://addons/proton_scatter/plugin.cfg", "res://addons/terrain_3d/plugin.cfg")
|
enabled=PackedStringArray("res://addons/proton_scatter/plugin.cfg")
|
||||||
|
|
||||||
[global_group]
|
[global_group]
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
[gd_scene load_steps=45 format=4 uid="uid://f7e0v1r6ra6c"]
|
[gd_scene load_steps=46 format=4 uid="uid://f7e0v1r6ra6c"]
|
||||||
|
|
||||||
[ext_resource type="Script" path="res://scripts/LevelManager.gd" id="1_saj4q"]
|
[ext_resource type="Script" path="res://scripts/LevelManager.gd" id="1_saj4q"]
|
||||||
[ext_resource type="PackedScene" uid="uid://b5eclfg0cmmal" path="res://assets/revolver_1.tscn" id="2_ntm2q"]
|
[ext_resource type="PackedScene" uid="uid://b5eclfg0cmmal" path="res://assets/revolver_1.tscn" id="2_ntm2q"]
|
||||||
@@ -25,6 +25,7 @@
|
|||||||
[ext_resource type="Material" uid="uid://dy2pswr330jnk" path="res://assets/materials/prototype/brick.tres" id="23_pyop4"]
|
[ext_resource type="Material" uid="uid://dy2pswr330jnk" path="res://assets/materials/prototype/brick.tres" id="23_pyop4"]
|
||||||
[ext_resource type="PackedScene" uid="uid://bycbdb5u5ewgl" path="res://assets/tree_2.tscn" id="24_od0q8"]
|
[ext_resource type="PackedScene" uid="uid://bycbdb5u5ewgl" path="res://assets/tree_2.tscn" id="24_od0q8"]
|
||||||
[ext_resource type="PackedScene" uid="uid://c7vrpfdh603kr" path="res://assets/bottle_1.tscn" id="25_fk5nr"]
|
[ext_resource type="PackedScene" uid="uid://c7vrpfdh603kr" path="res://assets/bottle_1.tscn" id="25_fk5nr"]
|
||||||
|
[ext_resource type="PackedScene" uid="uid://c6bpysq1tjhy4" path="res://vendingmahcine.tscn" id="26_rsia7"]
|
||||||
|
|
||||||
[sub_resource type="ProceduralSkyMaterial" id="ProceduralSkyMaterial_py8au"]
|
[sub_resource type="ProceduralSkyMaterial" id="ProceduralSkyMaterial_py8au"]
|
||||||
|
|
||||||
@@ -327,6 +328,14 @@ collision_layer = 257
|
|||||||
collision_mask = 257
|
collision_mask = 257
|
||||||
size = Vector3(30.1939, 1.6937, 36.37)
|
size = Vector3(30.1939, 1.6937, 36.37)
|
||||||
|
|
||||||
|
[node name="CSGBox3D6" type="CSGBox3D" parent="."]
|
||||||
|
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 8.07212, 1.87281, 18.7684)
|
||||||
|
material_override = ExtResource("3_pecld")
|
||||||
|
use_collision = true
|
||||||
|
collision_layer = 257
|
||||||
|
collision_mask = 257
|
||||||
|
size = Vector3(30.1939, 0.315722, 13.2553)
|
||||||
|
|
||||||
[node name="CSGBox3D2" type="CSGBox3D" parent="."]
|
[node name="CSGBox3D2" type="CSGBox3D" parent="."]
|
||||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -18.808, 1.35714, 0)
|
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -18.808, 1.35714, 0)
|
||||||
material_override = ExtResource("3_pecld")
|
material_override = ExtResource("3_pecld")
|
||||||
@@ -505,3 +514,6 @@ transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 33.8658, 0.909164, 9.63508)
|
|||||||
|
|
||||||
[node name="bottle7" parent="." instance=ExtResource("25_fk5nr")]
|
[node name="bottle7" parent="." instance=ExtResource("25_fk5nr")]
|
||||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 34.1407, 0.919677, 8.89591)
|
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 34.1407, 0.919677, 8.89591)
|
||||||
|
|
||||||
|
[node name="vendingmachine" parent="." instance=ExtResource("26_rsia7")]
|
||||||
|
transform = Transform3D(0.0288986, 0, 0.999582, 0, 1, 0, -0.999582, 0, 0.0288986, -18.6276, 0.0999999, 7.03353)
|
||||||
|
|||||||
@@ -27,7 +27,6 @@ func _ready():
|
|||||||
|
|
||||||
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
||||||
func _physics_process(delta):
|
func _physics_process(delta):
|
||||||
|
|
||||||
linear_velocity = transform.basis * Vector3(0, 0, -bullet_speed)
|
linear_velocity = transform.basis * Vector3(0, 0, -bullet_speed)
|
||||||
|
|
||||||
if bullet_target != null:
|
if bullet_target != null:
|
||||||
@@ -65,7 +64,4 @@ func _on_body_entered(body: Node) -> void:
|
|||||||
despawn()
|
despawn()
|
||||||
|
|
||||||
func despawn():
|
func despawn():
|
||||||
#visible = false
|
|
||||||
#collision_shape.disabled = true
|
|
||||||
#await get_tree().create_timer(1).timeout
|
|
||||||
queue_free()
|
queue_free()
|
||||||
|
|||||||
@@ -11,8 +11,10 @@ func _process(delta):
|
|||||||
|
|
||||||
func _on_body_entered(body):
|
func _on_body_entered(body):
|
||||||
if body.is_in_group("player"):
|
if body.is_in_group("player"):
|
||||||
|
body.velocity = Vector3(0,0,0)
|
||||||
body.is_climbing = true
|
body.is_climbing = true
|
||||||
body.global_position.y += .1
|
if body.global_position.y < global_position.y:
|
||||||
|
body.global_position.y += .2
|
||||||
|
|
||||||
|
|
||||||
func _on_body_exited(body):
|
func _on_body_exited(body):
|
||||||
|
|||||||
@@ -1,14 +1,17 @@
|
|||||||
extends CharacterBody3D
|
extends CharacterBody3D
|
||||||
|
|
||||||
|
const JUMP_VELOCITY = 5
|
||||||
const WALK_TRANSITION_SPEED = 7
|
const WALK_TRANSITION_SPEED = 7
|
||||||
const MAX_AIR_DASH = 1
|
const MAX_AIR_DASH = 1
|
||||||
const FLASHLIGHT_BRIGHTNESS = 30
|
const FLASHLIGHT_BRIGHTNESS = 30
|
||||||
const KICK_AMOUNT = 20
|
const KICK_AMOUNT = 20
|
||||||
const LAND_CAMERA_TILT : Vector3 = Vector3(-1,0,0)
|
const LAND_CAMERA_TILT : Vector3 = Vector3(-1,0,0)
|
||||||
const WALK_SPEED = 12.0
|
const WALK_SPEED = 12.0
|
||||||
const CROUCH_SPEED = 6.0
|
const CROUCH_SPEED = 3.0
|
||||||
const SPRINT_SPEED = 15.0
|
const SPRINT_SPEED = 15.0
|
||||||
const DASH_SPEED = 40
|
const DASH_SPEED = 40
|
||||||
|
const CROUCHED_POS = Vector3(0,-.1,0)
|
||||||
|
const STAND_POS = Vector3(0,0.889,0)
|
||||||
const SLOWSPEED = .1
|
const SLOWSPEED = .1
|
||||||
const MAX_STAMINA : float = 100
|
const MAX_STAMINA : float = 100
|
||||||
const STAMINA_DRAIN = 100 #multiplied times the delta when draining
|
const STAMINA_DRAIN = 100 #multiplied times the delta when draining
|
||||||
@@ -31,7 +34,6 @@ var mouse_input : Vector2
|
|||||||
@export_group("Player Movement")
|
@export_group("Player Movement")
|
||||||
|
|
||||||
@export var DASH_STAM_REQ = 10
|
@export var DASH_STAM_REQ = 10
|
||||||
@export var JUMP_VELOCITY = 6
|
|
||||||
@export var SENSITIVITY = .01
|
@export var SENSITIVITY = .01
|
||||||
@export var sensitivity_shift = true
|
@export var sensitivity_shift = true
|
||||||
var start_sensitivity
|
var start_sensitivity
|
||||||
@@ -76,10 +78,9 @@ var held_item_angular_damp_cache
|
|||||||
var held_item_gravity_cache
|
var held_item_gravity_cache
|
||||||
var held_item_mass_cache
|
var held_item_mass_cache
|
||||||
var held_item_collision_cache
|
var held_item_collision_cache
|
||||||
|
var hold_offset
|
||||||
var held_item_rotation = Vector3(0,0,0)
|
var held_item_rotation = Vector3(0,0,0)
|
||||||
var gamespeed_controlled = false
|
var gamespeed_controlled = false
|
||||||
var crouched_pos = Vector3(0,0,0)
|
|
||||||
var stand_pos = Vector3(0,0.889,0)
|
|
||||||
var crouched = false
|
var crouched = false
|
||||||
|
|
||||||
# Slow Down Variables
|
# Slow Down Variables
|
||||||
@@ -119,6 +120,10 @@ var controlled_elsewhere = false
|
|||||||
@onready var r_hand_test: MeshInstance3D = $Head/Recoil/Camera3D/WeaponHolder/RHandTest
|
@onready var r_hand_test: MeshInstance3D = $Head/Recoil/Camera3D/WeaponHolder/RHandTest
|
||||||
@onready var enemy_killed_audio: AudioStreamPlayer = $Audio/EnemyKilled
|
@onready var enemy_killed_audio: AudioStreamPlayer = $Audio/EnemyKilled
|
||||||
@onready var footstep_sound: AudioStreamPlayer3D = $Audio/FootstepSound
|
@onready var footstep_sound: AudioStreamPlayer3D = $Audio/FootstepSound
|
||||||
|
@onready var standing_collision: CollisionShape3D = $StandingCollision
|
||||||
|
@onready var crouching_collision: CollisionShape3D = $CrouchingCollision
|
||||||
|
@onready var crouch_check: RayCast3D = $CrouchingCollision/CrouchCheck
|
||||||
|
@onready var hit_head: AudioStreamPlayer3D = $Audio/HitHead
|
||||||
|
|
||||||
|
|
||||||
func _ready():
|
func _ready():
|
||||||
@@ -177,13 +182,23 @@ func _physics_process(delta):
|
|||||||
# Handle jump.
|
# Handle jump.
|
||||||
if Input.is_action_just_pressed("jump") and is_on_floor() and !is_climbing:
|
if Input.is_action_just_pressed("jump") and is_on_floor() and !is_climbing:
|
||||||
velocity.y += JUMP_VELOCITY
|
velocity.y += JUMP_VELOCITY
|
||||||
|
crouched = false
|
||||||
elif Input.is_action_just_pressed("jump") and double_jump == true and !is_climbing:
|
elif Input.is_action_just_pressed("jump") and double_jump == true and !is_climbing:
|
||||||
velocity.y += JUMP_VELOCITY
|
velocity.y += JUMP_VELOCITY
|
||||||
double_jump = false
|
double_jump = false
|
||||||
|
|
||||||
|
|
||||||
if Input.is_action_just_pressed("crouch"):
|
if Input.is_action_just_pressed("crouch"):
|
||||||
crouched = !crouched
|
if crouched:
|
||||||
|
if !crouch_check.is_colliding():
|
||||||
|
crouched = !crouched
|
||||||
|
recoil.add_recoil(Vector3(-.2,.01,.01),5,10)
|
||||||
|
else:
|
||||||
|
recoil.add_recoil(Vector3(-.2,.01,.01),20,10)
|
||||||
|
hit_head.play()
|
||||||
|
else:
|
||||||
|
crouched = !crouched
|
||||||
|
recoil.add_recoil(Vector3(.2,0,0),5,10)
|
||||||
|
|
||||||
|
|
||||||
# Get the input direction and handle the movement/deceleration.
|
# Get the input direction and handle the movement/deceleration.
|
||||||
@@ -371,12 +386,16 @@ func _physics_process(delta):
|
|||||||
|
|
||||||
func crouch(delta):
|
func crouch(delta):
|
||||||
if crouched:
|
if crouched:
|
||||||
if head.position != crouched_pos:
|
crouching_collision.disabled = false
|
||||||
head.position = lerp(head.position, crouched_pos, delta * 8)
|
standing_collision.disabled = true
|
||||||
|
if head.position != CROUCHED_POS:
|
||||||
|
head.position = lerp(head.position, CROUCHED_POS, delta * 8)
|
||||||
speed = CROUCH_SPEED
|
speed = CROUCH_SPEED
|
||||||
else:
|
else:
|
||||||
if head.position != stand_pos:
|
standing_collision.disabled = false
|
||||||
head.position = lerp(head.position, stand_pos, delta * 8)
|
crouching_collision.disabled = true
|
||||||
|
if head.position != STAND_POS:
|
||||||
|
head.position = lerp(head.position, STAND_POS, delta * 8)
|
||||||
speed = WALK_SPEED
|
speed = WALK_SPEED
|
||||||
|
|
||||||
func _headbob(time) -> Vector3:
|
func _headbob(time) -> Vector3:
|
||||||
@@ -422,10 +441,11 @@ func weapon_sway(delta):
|
|||||||
func weapon_bob(vel : float, delta):
|
func weapon_bob(vel : float, delta):
|
||||||
if weapon_holder:
|
if weapon_holder:
|
||||||
if vel > 2 and is_on_floor():
|
if vel > 2 and is_on_floor():
|
||||||
|
var speed_adjust = speed/WALK_SPEED
|
||||||
var bob_amount : float = 0.05
|
var bob_amount : float = 0.05
|
||||||
var bob_freq : float = 0.01
|
var bob_freq : float = 0.01 * speed_adjust
|
||||||
weapon_holder.position.y = lerp(weapon_holder.position.y, def_weapon_holder_pos.y + sin(Time.get_ticks_msec() * bob_freq) * bob_amount, 10 * delta)
|
weapon_holder.position.y = lerp(weapon_holder.position.y, def_weapon_holder_pos.y + sin(Time.get_ticks_msec() * bob_freq) * bob_amount, speed * delta)
|
||||||
weapon_holder.position.x = lerp(weapon_holder.position.x, def_weapon_holder_pos.x + sin(Time.get_ticks_msec() * bob_freq) * bob_amount, 10 * delta)
|
weapon_holder.position.x = lerp(weapon_holder.position.x, def_weapon_holder_pos.x + sin(Time.get_ticks_msec() * bob_freq) * bob_amount, speed * delta)
|
||||||
else:
|
else:
|
||||||
weapon_holder.position.y = lerp(weapon_holder.position.y, def_weapon_holder_pos.y, .1 * delta)
|
weapon_holder.position.y = lerp(weapon_holder.position.y, def_weapon_holder_pos.y, .1 * delta)
|
||||||
weapon_holder.position.x = lerp(weapon_holder.position.x, def_weapon_holder_pos.x, .1 * delta)
|
weapon_holder.position.x = lerp(weapon_holder.position.x, def_weapon_holder_pos.x, .1 * delta)
|
||||||
@@ -467,6 +487,7 @@ func grab_moveable(body):
|
|||||||
held_item_gravity_cache = body.gravity_scale
|
held_item_gravity_cache = body.gravity_scale
|
||||||
held_item_mass_cache = body.mass
|
held_item_mass_cache = body.mass
|
||||||
held_item_collision_cache = held_item.get_collision_layer_value(1)
|
held_item_collision_cache = held_item.get_collision_layer_value(1)
|
||||||
|
hold_offset = held_item.global_position - interact_ray.get_collision_point()
|
||||||
#change rigidbody settings
|
#change rigidbody settings
|
||||||
body.linear_damp = 0 #5
|
body.linear_damp = 0 #5
|
||||||
body.angular_damp = 0 #5
|
body.angular_damp = 0 #5
|
||||||
@@ -478,8 +499,7 @@ func hold_item(_delta):
|
|||||||
# Move Held Items
|
# Move Held Items
|
||||||
if held_item != null:
|
if held_item != null:
|
||||||
interact_ray.look_at(held_item.global_position, Vector3.UP)
|
interact_ray.look_at(held_item.global_position, Vector3.UP)
|
||||||
var hold_offset = held_item.global_position - interact_ray.get_collision_point()
|
var held_dir = (moveable_holder.global_position - held_item.global_position) #+ hold_offset
|
||||||
var held_dir = (moveable_holder.global_position - held_item.global_position) + hold_offset
|
|
||||||
held_item.linear_velocity = held_dir * 15
|
held_item.linear_velocity = held_dir * 15
|
||||||
held_item.look_at(moveable_rotation.global_position, Vector3.UP)
|
held_item.look_at(moveable_rotation.global_position, Vector3.UP)
|
||||||
|
|
||||||
@@ -499,6 +519,7 @@ func release_moveable():
|
|||||||
held_item.mass = held_item_mass_cache
|
held_item.mass = held_item_mass_cache
|
||||||
held_item.set_collision_layer_value(1,held_item_collision_cache)
|
held_item.set_collision_layer_value(1,held_item_collision_cache)
|
||||||
held_item = null
|
held_item = null
|
||||||
|
hold_offset = null
|
||||||
moveable_holder.rotation = Vector3(0,0,0)
|
moveable_holder.rotation = Vector3(0,0,0)
|
||||||
|
|
||||||
func hit(damage, fired_by, target_type):
|
func hit(damage, fired_by, target_type):
|
||||||
@@ -522,5 +543,6 @@ func save():
|
|||||||
"rot_y" : rotation.y,
|
"rot_y" : rotation.y,
|
||||||
"rot_z" : rotation.z,
|
"rot_z" : rotation.z,
|
||||||
"health" : level_control.health
|
"health" : level_control.health
|
||||||
|
|
||||||
}
|
}
|
||||||
return save_dict
|
return save_dict
|
||||||
|
|||||||
@@ -192,16 +192,9 @@ func spawn_casing():
|
|||||||
|
|
||||||
func bullet_fire():
|
func bullet_fire():
|
||||||
var instance_bullet
|
var instance_bullet
|
||||||
if hitscan_enabled:
|
instance_bullet = bullet.instantiate()
|
||||||
instance_bullet = bullet_fake.instantiate()
|
|
||||||
else:
|
|
||||||
instance_bullet = bullet.instantiate()
|
|
||||||
instance_bullet.position = barrel_raycast.global_position
|
instance_bullet.position = barrel_raycast.global_position
|
||||||
#shoot bullet from real gun if gun is folded up
|
instance_bullet.transform.basis = barrel_raycast.global_transform.basis
|
||||||
if player.gun_folded == false:
|
|
||||||
instance_bullet.transform.basis = barrel_raycast.global_transform.basis
|
|
||||||
else:
|
|
||||||
instance_bullet.transform.basis = barrel_raycast.global_transform.basis
|
|
||||||
instance_bullet.bullet_speed = bullet_speed
|
instance_bullet.bullet_speed = bullet_speed
|
||||||
instance_bullet.player_velocity = player.velocity * transform.basis
|
instance_bullet.player_velocity = player.velocity * transform.basis
|
||||||
instance_bullet.bullet_drop = bullet_drop
|
instance_bullet.bullet_drop = bullet_drop
|
||||||
@@ -211,7 +204,7 @@ func bullet_fire():
|
|||||||
instance_bullet.bullet_target = tracker
|
instance_bullet.bullet_target = tracker
|
||||||
instance_bullet.instance_bullethole = bullethole.instantiate()
|
instance_bullet.instance_bullethole = bullethole.instantiate()
|
||||||
instance_bullet.player_position = player.global_position
|
instance_bullet.player_position = player.global_position
|
||||||
get_tree().current_scene.add_child(instance_bullet)
|
get_tree().get_root().add_child(instance_bullet)
|
||||||
|
|
||||||
|
|
||||||
func swapped_out():
|
func swapped_out():
|
||||||
|
|||||||
Reference in New Issue
Block a user