started fixing stamina

This commit is contained in:
derek
2024-11-07 16:52:36 -06:00
parent af72a0678a
commit a31e420330
3 changed files with 44 additions and 45 deletions

View File

@@ -322,21 +322,6 @@ size = Vector3(16.16, 0.645, 4.82)
[sub_resource type="ConcavePolygonShape3D" id="ConcavePolygonShape3D_jn2ik"]
data = PackedVector3Array(-8.08, 0.3225, 2.41, 8.08, 0.3225, 2.41, -8.08, -0.3225, 2.41, 8.08, 0.3225, 2.41, 8.08, -0.3225, 2.41, -8.08, -0.3225, 2.41, 8.08, 0.3225, -2.41, -8.08, 0.3225, -2.41, 8.08, -0.3225, -2.41, -8.08, 0.3225, -2.41, -8.08, -0.3225, -2.41, 8.08, -0.3225, -2.41, 8.08, 0.3225, 2.41, 8.08, 0.3225, -2.41, 8.08, -0.3225, 2.41, 8.08, 0.3225, -2.41, 8.08, -0.3225, -2.41, 8.08, -0.3225, 2.41, -8.08, 0.3225, -2.41, -8.08, 0.3225, 2.41, -8.08, -0.3225, -2.41, -8.08, 0.3225, 2.41, -8.08, -0.3225, 2.41, -8.08, -0.3225, -2.41, 8.08, 0.3225, 2.41, -8.08, 0.3225, 2.41, 8.08, 0.3225, -2.41, -8.08, 0.3225, 2.41, -8.08, 0.3225, -2.41, 8.08, 0.3225, -2.41, -8.08, -0.3225, 2.41, 8.08, -0.3225, 2.41, -8.08, -0.3225, -2.41, 8.08, -0.3225, 2.41, 8.08, -0.3225, -2.41, -8.08, -0.3225, -2.41)
[sub_resource type="Animation" id="Animation_ygmb7"]
resource_name = "open"
tracks/0/type = "value"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath(".:position")
tracks/0/interp = 2
tracks/0/loop_wrap = true
tracks/0/keys = {
"times": PackedFloat32Array(0, 1),
"transitions": PackedFloat32Array(1, 1),
"update": 0,
"values": [Vector3(0, 8.64712, -4.97979), Vector3(0, 8.64712, -8.696)]
}
[sub_resource type="Animation" id="Animation_ju5y1"]
length = 0.001
tracks/0/type = "value"
@@ -367,6 +352,21 @@ tracks/0/keys = {
"values": [Vector3(0, 8.64712, -8.696), Vector3(0, 8.64712, -4.97979)]
}
[sub_resource type="Animation" id="Animation_ygmb7"]
resource_name = "open"
tracks/0/type = "value"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath(".:position")
tracks/0/interp = 2
tracks/0/loop_wrap = true
tracks/0/keys = {
"times": PackedFloat32Array(0, 1),
"transitions": PackedFloat32Array(1, 1),
"update": 0,
"values": [Vector3(0, 8.64712, -4.97979), Vector3(0, 8.64712, -8.696)]
}
[sub_resource type="AnimationLibrary" id="AnimationLibrary_3smhb"]
_data = {
"RESET": SubResource("Animation_ju5y1"),
@@ -383,21 +383,6 @@ size = Vector3(4.28, 3.97, 0.49)
[sub_resource type="ConcavePolygonShape3D" id="ConcavePolygonShape3D_g1eis"]
data = PackedVector3Array(-2.14, 1.985, 0.245, 2.14, 1.985, 0.245, -2.14, -1.985, 0.245, 2.14, 1.985, 0.245, 2.14, -1.985, 0.245, -2.14, -1.985, 0.245, 2.14, 1.985, -0.245, -2.14, 1.985, -0.245, 2.14, -1.985, -0.245, -2.14, 1.985, -0.245, -2.14, -1.985, -0.245, 2.14, -1.985, -0.245, 2.14, 1.985, 0.245, 2.14, 1.985, -0.245, 2.14, -1.985, 0.245, 2.14, 1.985, -0.245, 2.14, -1.985, -0.245, 2.14, -1.985, 0.245, -2.14, 1.985, -0.245, -2.14, 1.985, 0.245, -2.14, -1.985, -0.245, -2.14, 1.985, 0.245, -2.14, -1.985, 0.245, -2.14, -1.985, -0.245, 2.14, 1.985, 0.245, -2.14, 1.985, 0.245, 2.14, 1.985, -0.245, -2.14, 1.985, 0.245, -2.14, 1.985, -0.245, 2.14, 1.985, -0.245, -2.14, -1.985, 0.245, 2.14, -1.985, 0.245, -2.14, -1.985, -0.245, 2.14, -1.985, 0.245, 2.14, -1.985, -0.245, -2.14, -1.985, -0.245)
[sub_resource type="Animation" id="Animation_a3htr"]
resource_name = "open"
tracks/0/type = "value"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath(".:position")
tracks/0/interp = 2
tracks/0/loop_wrap = true
tracks/0/keys = {
"times": PackedFloat32Array(0, 1),
"transitions": PackedFloat32Array(1, 1),
"update": 0,
"values": [Vector3(0, 1.94405, 4.78278), Vector3(0, 5.43481, 4.78278)]
}
[sub_resource type="Animation" id="Animation_jbusa"]
length = 0.001
tracks/0/type = "value"
@@ -428,6 +413,21 @@ tracks/0/keys = {
"values": [Vector3(0, 5.43481, 4.78278), Vector3(0, 1.94405, 4.78278)]
}
[sub_resource type="Animation" id="Animation_a3htr"]
resource_name = "open"
tracks/0/type = "value"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath(".:position")
tracks/0/interp = 2
tracks/0/loop_wrap = true
tracks/0/keys = {
"times": PackedFloat32Array(0, 1),
"transitions": PackedFloat32Array(1, 1),
"update": 0,
"values": [Vector3(0, 1.94405, 4.78278), Vector3(0, 5.43481, 4.78278)]
}
[sub_resource type="AnimationLibrary" id="AnimationLibrary_hkwf6"]
_data = {
"RESET": SubResource("Animation_jbusa"),

View File

@@ -67,7 +67,7 @@ script = ExtResource("1_fcu8x")
enemy_type = 1
damage = 3.0
pushback = 15.0
taunts = ["anybody got a toothpick?", "now that's what i call stake night", "now i gotta clean all this off"]
taunts = Array[String](["anybody got a toothpick?", "now that's what i call stake night", "now i gotta clean all this off"])
[node name="Spikes1" type="MeshInstance3D" parent="."]
mesh = SubResource("ArrayMesh_atemo")

View File

@@ -1,6 +1,6 @@
extends CharacterBody3D
const WALK_TRANSITION_SPEED = 8
const WALK_TRANSITION_SPEED = 7
const MAX_AIR_DASH = 1
const FLASHLIGHT_BRIGHTNESS = 30
const KICK_AMOUNT = 20
@@ -8,8 +8,9 @@ const LAND_CAMERA_TILT : Vector3 = Vector3(-1,0,0)
const WALK_SPEED = 12.0
const SPRINT_SPEED = 15.0
const DASH_SPEED = 40
const SLOWSPEED = .15
const STAMINA_DRAIN = 100
const SLOWSPEED = .1
const MAX_STAMINA : float = 100
const STAMINA_DRAIN = 200
var speed
var double_jump = true
@@ -27,7 +28,6 @@ var mouse_input : Vector2
@export_group("Player Movement")
@export var DASH_STAM_REQ = 10
@export var MAX_STAMINA = 1800
@export var JUMP_VELOCITY = 6
@export var SENSITIVITY = .01
@export var sensitivity_shift = true
@@ -77,7 +77,7 @@ var held_item_mass_cache
var held_item_rotation = Vector3(0,0,0)
# Slow Down Variables
var remaining_stamina = MAX_STAMINA
var remaining_stamina : float = MAX_STAMINA
# Pickups
var picked_up = false
var picked_up_text
@@ -241,26 +241,25 @@ func _physics_process(delta):
# Game Speed
if !level_control.paused:
if Input.is_action_pressed("slow_down") and remaining_stamina >0:
Engine.time_scale = lerp(0, 1, SLOWSPEED)
if Input.is_action_pressed("slow_down") and remaining_stamina > 0 :
Engine.time_scale = lerp(Engine.time_scale, SLOWSPEED, delta * 20)
gun.random_spread_amt = 0
AudioServer.set_bus_effect_enabled(0,0,true)
camera.fov = lerp(camera.fov, camera.fov * gun.fov_zoom_amt, delta * 100)
if sensitivity_shift == true:
SENSITIVITY = lerp(SENSITIVITY, SENSITIVITY * .998, delta * 100)
if remaining_stamina >0:
remaining_stamina -= 1000 * delta
if remaining_stamina > 0:
remaining_stamina = clamp(remaining_stamina - (delta * STAMINA_DRAIN),0,MAX_STAMINA)
else:
Engine.time_scale = 1
Engine.time_scale = lerp(Engine.time_scale, 1.0, delta * 50)
gun.random_spread_amt = gun.random_spread_start
AudioServer.set_bus_effect_enabled(0,0,false)
if sensitivity_shift == true:
camera.fov = lerp(camera.fov, BASE_FOV, delta * .5)
SENSITIVITY = start_sensitivity
if remaining_stamina < MAX_STAMINA:
remaining_stamina += STAMINA_DRAIN * delta
elif remaining_stamina > MAX_STAMINA * 1.01:
remaining_stamina -= (STAMINA_DRAIN)/2 * delta
if remaining_stamina < MAX_STAMINA and !Input.is_action_pressed("slow_down"):
remaining_stamina = clamp(remaining_stamina + (delta * STAMINA_DRAIN/10), 0, MAX_STAMINA)
# Reloading
if Input.is_action_just_pressed("reload"):