replaced sprinting with mid air dash

This commit is contained in:
Derek
2024-08-10 21:49:40 -05:00
parent cb48827c8a
commit dad00cb0fa
6 changed files with 23 additions and 22 deletions

View File

@@ -58,7 +58,7 @@ fov = 15.0
target_position = Vector3(0, 0, -1) target_position = Vector3(0, 0, -1)
[node name="Timer" type="Timer" parent="."] [node name="Timer" type="Timer" parent="."]
wait_time = 0.4 wait_time = 0.2
one_shot = true one_shot = true
[node name="Whiteout" type="ColorRect" parent="."] [node name="Whiteout" type="ColorRect" parent="."]

View File

@@ -11,7 +11,7 @@ config_version=5
[application] [application]
config/name="First Person Test" config/name="First Person Test"
run/main_scene="res://scenes/test_level_2v2.tscn" run/main_scene="res://scenes/enemy_working_scene.tscn"
config/features=PackedStringArray("4.2", "Forward Plus") config/features=PackedStringArray("4.2", "Forward Plus")
config/icon="res://icon.svg" config/icon="res://icon.svg"

View File

@@ -1163,6 +1163,7 @@ _data = {
script = ExtResource("1_orhgl") script = ExtResource("1_orhgl")
player = NodePath("Player") player = NodePath("Player")
money = 10 money = 10
start_health = 10
gun_1 = ExtResource("2_6rjit") gun_1 = ExtResource("2_6rjit")
gun_2 = ExtResource("3_umpon") gun_2 = ExtResource("3_umpon")
health_drop_enabled = false health_drop_enabled = false

View File

@@ -1,9 +1,9 @@
extends Node3D extends Node3D
@export var MOVE_SPEED = 15 @export var MOVE_SPEED = 30
@export var CAMERA_LOOK_SPEED = 20 @export var CAMERA_LOOK_SPEED = 40
@export var FOV_CHANGE_SPEED = 20 @export var FOV_CHANGE_SPEED = 40
@onready var look_ray = $LookRay @onready var look_ray = $LookRay
@onready var camera = $Camera3D @onready var camera = $Camera3D
@@ -36,6 +36,7 @@ func _ready():
#highlight target #highlight target
if target != null: if target != null:
var taunt_spawn = ENEMY_TAUNT.instantiate() var taunt_spawn = ENEMY_TAUNT.instantiate()
taunt_spawn.text = taunt_spawn.taunts.pick_random()
target.add_child(taunt_spawn) target.add_child(taunt_spawn)
taunt_spawn.global_transform.origin = target.position + Vector3(0,2,0) taunt_spawn.global_transform.origin = target.position + Vector3(0,2,0)

View File

@@ -6,14 +6,8 @@ const SPEED = 3
const SCALE_SPEED = 80 const SCALE_SPEED = 80
var taunts = ["hows your gut now you big cup of dumdum juice?", var taunts = ["hows your gut now you big cup of dumdum juice?",
"you're all tit and no nipple",
"you might be the shit, but i'm the wet wipe",
"ruh roh raggy, retard!",
"you look gay when you die.",
"did i do that?", "did i do that?",
"eat a bag of dicks",
"schwing!", "schwing!",
"go fuck yourself",
"hee hee", "hee hee",
"stop trying", "stop trying",
"yowza!"] "yowza!"]
@@ -22,7 +16,6 @@ var taunts = ["hows your gut now you big cup of dumdum juice?",
func _ready(): func _ready():
scale.x = .5 scale.x = .5
scale.y = .5 scale.y = .5
text = taunts.pick_random()
# Called every frame. 'delta' is the elapsed time since the previous frame. # Called every frame. 'delta' is the elapsed time since the previous frame.

View File

@@ -15,8 +15,10 @@ var rng = RandomNumberGenerator.new()
@export var AUDIO = true @export var AUDIO = true
@export var dead_player : Resource @export var dead_player : Resource
@export_group("Player Movement") @export_group("Player Movement")
@export var WALK_SPEED = 7.0 @export var WALK_SPEED = 12.0
@export var SPRINT_SPEED = 15.0 @export var SPRINT_SPEED = 15.0
@export var DASH_SPEED = 40
@export var DASH_STAM_REQ = 10
@export var MAX_STAMINA = 1800 @export var MAX_STAMINA = 1800
@export var JUMP_VELOCITY = 10 @export var JUMP_VELOCITY = 10
@export var SENSITIVITY = .01 @export var SENSITIVITY = .01
@@ -122,22 +124,26 @@ func _physics_process(delta):
velocity.y += JUMP_VELOCITY velocity.y += JUMP_VELOCITY
double_jump = false double_jump = false
# Handle Sprint
if Input.is_action_pressed("sprint") and is_on_floor():
speed = SPRINT_SPEED
else:
speed = WALK_SPEED speed = WALK_SPEED
# Get the input direction and handle the movement/deceleration. # Get the input direction and handle the movement/deceleration.
var input_dir = Input.get_vector("move_left", "move_right", "move_up", "move_down") var input_dir = Input.get_vector("move_left", "move_right", "move_up", "move_down")
var direction = (self.transform.basis * Vector3(input_dir.x, 0, input_dir.y)).normalized() var direction = (self.transform.basis * Vector3(input_dir.x, 0, input_dir.y)).normalized()
# Handle Sprint
if Input.is_action_just_pressed("sprint") and !is_on_floor():
if remaining_stamina >= DASH_STAM_REQ:
velocity.x += direction.x * DASH_SPEED
velocity.z += direction.z * DASH_SPEED
remaining_stamina -= 180
if is_on_floor() and !is_climbing: if is_on_floor() and !is_climbing:
if direction: if direction:
velocity.x = direction.x * speed velocity.x = direction.x * speed
velocity.z = direction.z * speed velocity.z = direction.z * speed
else: else:
velocity.x = lerp(velocity.x, direction.x * speed, delta * 6.5) velocity.x = lerp(velocity.x, direction.x * speed, delta * 6.5) + (direction.x * DASH_SPEED)
velocity.z = lerp(velocity.z, direction.z * speed, delta * 6.5) velocity.z = lerp(velocity.z, direction.z * speed, delta * 6.5) + (direction.z * DASH_SPEED)
elif is_climbing: elif is_climbing:
gravity = 0.0 gravity = 0.0
if direction: if direction: