added wall running and jumping
This commit is contained in:
@@ -1,9 +1,35 @@
|
||||
[gd_scene load_steps=13 format=4 uid="uid://neb8fxkrade0"]
|
||||
[gd_scene load_steps=15 format=4 uid="uid://neb8fxkrade0"]
|
||||
|
||||
[ext_resource type="Script" path="res://scripts/bullet_cam.gd" id="1_uvdg3"]
|
||||
[ext_resource type="Shader" path="res://assets/crtTest.gdshader" id="2_6gutm"]
|
||||
[ext_resource type="AudioStream" uid="uid://dqj4cx05f25jj" path="res://assets/Audio/punch-body-hard-SBA-300156881.wav" id="3_t6e3w"]
|
||||
|
||||
[sub_resource type="CameraAttributesPractical" id="CameraAttributesPractical_w2xv5"]
|
||||
auto_exposure_enabled = true
|
||||
|
||||
[sub_resource type="ShaderMaterial" id="ShaderMaterial_p1llk"]
|
||||
shader = ExtResource("2_6gutm")
|
||||
shader_parameter/overlay = true
|
||||
shader_parameter/scanlines_opacity = 0.4
|
||||
shader_parameter/scanlines_width = 0.25
|
||||
shader_parameter/grille_opacity = 0.3
|
||||
shader_parameter/resolution = Vector2(640, 480)
|
||||
shader_parameter/pixelate = false
|
||||
shader_parameter/roll = true
|
||||
shader_parameter/roll_speed = 8.0
|
||||
shader_parameter/roll_size = 15.0
|
||||
shader_parameter/roll_variation = 1.8
|
||||
shader_parameter/distort_intensity = 0.0
|
||||
shader_parameter/noise_opacity = 0.0
|
||||
shader_parameter/noise_speed = 5.0
|
||||
shader_parameter/static_noise_intensity = 0.0
|
||||
shader_parameter/aberration = 4.75e-08
|
||||
shader_parameter/brightness = 1.56
|
||||
shader_parameter/discolor = true
|
||||
shader_parameter/warp_amount = 0.0
|
||||
shader_parameter/clip_warp = true
|
||||
shader_parameter/vignette_intensity = 5.445
|
||||
shader_parameter/vignette_opacity = 0.094
|
||||
|
||||
[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_mfpbf"]
|
||||
resource_name = "bullet"
|
||||
@@ -101,6 +127,11 @@ transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 1.35947)
|
||||
attributes = SubResource("CameraAttributesPractical_w2xv5")
|
||||
fov = 150.0
|
||||
|
||||
[node name="ColorRect" type="ColorRect" parent="Camera3D"]
|
||||
material = SubResource("ShaderMaterial_p1llk")
|
||||
offset_right = 3840.0
|
||||
offset_bottom = 2160.0
|
||||
|
||||
[node name="Cylinder" type="MeshInstance3D" parent="."]
|
||||
transform = Transform3D(-1, -1.50996e-07, 6.60024e-15, 0, -4.37114e-08, -1, 1.50996e-07, -1, 4.37114e-08, 1.46364e-07, 0, -0.113697)
|
||||
cast_shadow = 0
|
||||
|
||||
@@ -220,7 +220,7 @@ transform = Transform3D(1, 0, 0, 0, 0.992332, 0.123601, 0, -0.123601, 0.992332,
|
||||
[node name="BulletRay" type="RayCast3D" parent="Head/Recoil/Camera3D"]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, -0.487738)
|
||||
target_position = Vector3(0, 0, -200)
|
||||
collision_mask = 233
|
||||
collision_mask = 105
|
||||
collide_with_areas = true
|
||||
script = ExtResource("10_ektr6")
|
||||
|
||||
@@ -313,9 +313,22 @@ libraries = {
|
||||
"": SubResource("AnimationLibrary_d0x8a")
|
||||
}
|
||||
|
||||
[node name="velocity_ray" type="RayCast3D" parent="."]
|
||||
transform = Transform3D(1, -2.21121e-11, 5.69206e-32, 2.21121e-11, 1, 0, -5.69206e-32, 1.25837e-42, 1, 0.000168126, -1.01843, -0.00105944)
|
||||
[node name="wall_ray1" type="RayCast3D" parent="."]
|
||||
transform = Transform3D(1, -4.26326e-11, -5.82077e-11, 3.6664e-11, 1, 0, 0, 0, 1, 8.1824e-07, -0.00495505, -5.15778e-06)
|
||||
target_position = Vector3(-1, 0, 0)
|
||||
|
||||
[node name="wall_ray2" type="RayCast3D" parent="."]
|
||||
transform = Transform3D(1, -4.26326e-11, -5.82077e-11, 3.6664e-11, 1, 0, 0, 0, 1, 8.1824e-07, -0.00495505, -5.15778e-06)
|
||||
target_position = Vector3(1, 0, 0)
|
||||
|
||||
[node name="wall_ray3" type="RayCast3D" parent="."]
|
||||
transform = Transform3D(1, -4.26326e-11, -5.82077e-11, 3.6664e-11, 1, 0, 0, 0, 1, 8.1824e-07, -0.00495505, -5.15778e-06)
|
||||
target_position = Vector3(0, 0, 1)
|
||||
|
||||
[node name="WallJumpTimer" type="Timer" parent="."]
|
||||
one_shot = true
|
||||
|
||||
[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_magnet" to="." method="_on_pick_up_magnet_body_entered"]
|
||||
[connection signal="timeout" from="WallJumpTimer" to="." method="_on_wall_jump_timer_timeout"]
|
||||
|
||||
@@ -11,7 +11,7 @@ config_version=5
|
||||
[application]
|
||||
|
||||
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.3", "Forward Plus")
|
||||
config/icon="res://icon.svg"
|
||||
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -1,4 +1,4 @@
|
||||
[gd_scene load_steps=123 format=4 uid="uid://dyop6vk3rgkkb"]
|
||||
[gd_scene load_steps=124 format=4 uid="uid://dyop6vk3rgkkb"]
|
||||
|
||||
[ext_resource type="Script" path="res://scripts/LevelManager.gd" id="1_orhgl"]
|
||||
[ext_resource type="Texture2D" uid="uid://dqs06ic3vjtwk" path="res://assets/Models/asphalt1.albedo.jpg" id="1_w4rag"]
|
||||
@@ -43,6 +43,7 @@
|
||||
[ext_resource type="PackedScene" uid="uid://d4suhr3allsj" path="res://assets/revolver2_pickup.tscn" id="42_2cdbd"]
|
||||
[ext_resource type="PackedScene" uid="uid://dws4iro7820fc" path="res://assets/pistol1_pickup.tscn" id="42_mmvms"]
|
||||
[ext_resource type="PackedScene" uid="uid://bj1y0fbjtul4a" path="res://post_processing.tscn" id="43_82hec"]
|
||||
[ext_resource type="PackedScene" uid="uid://ba77auqukaag" path="res://assets/houston_downtown.tscn" id="44_xigrv"]
|
||||
|
||||
[sub_resource type="ProceduralSkyMaterial" id="ProceduralSkyMaterial_nb6x7"]
|
||||
sky_top_color = Color(0.500562, 0.697334, 0.809889, 1)
|
||||
@@ -1609,3 +1610,6 @@ transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -2.93409, 5.69926, 1.22332)
|
||||
|
||||
[node name="PostProcessing" parent="." instance=ExtResource("43_82hec")]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -8.35692, 7.15345, 5.33085)
|
||||
|
||||
[node name="HoustonDowntown" parent="." instance=ExtResource("44_xigrv")]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -13.2553, 0)
|
||||
|
||||
@@ -51,7 +51,7 @@ func _input(event):
|
||||
|
||||
# Called when the node enters the scene tree for the first time.
|
||||
func _ready():
|
||||
Engine.time_scale = .01
|
||||
Engine.time_scale = .02
|
||||
player.gamespeed_controlled = true
|
||||
player.controlled_elsewhere = true
|
||||
player_cam_FOV = player.camera.fov
|
||||
@@ -78,7 +78,7 @@ func _physics_process(delta):
|
||||
if Input.is_action_pressed("sprint"):
|
||||
Engine.time_scale = .05
|
||||
else:
|
||||
Engine.time_scale = .01
|
||||
Engine.time_scale = .02
|
||||
|
||||
focus_on_target()
|
||||
|
||||
@@ -117,6 +117,7 @@ func focus_on_target():
|
||||
camera.attributes.dof_blur_far_enabled = true
|
||||
camera.attributes.dof_blur_far_distance = camera.global_position.distance_to(cam_ray.get_collision_point()) + 5.0
|
||||
camera.attributes.dof_blur_near_enabled = true
|
||||
camera.attributes.dof_blur_near_distance = camera.global_position.distance_to(cam_ray.get_collision_point()) - 10.0
|
||||
camera.attributes.dof_blur_amount = lerp(0.0,BLUR_AMOUNT,1.0 - Engine.time_scale)
|
||||
|
||||
func log_path(delta):
|
||||
@@ -130,17 +131,17 @@ func log_path(delta):
|
||||
record_id += 1
|
||||
|
||||
func despawn():
|
||||
var read_record = record_id - 1
|
||||
for i in bullet_path:
|
||||
if read_record > 1:
|
||||
camera.global_position = lerp(bullet_path[read_record]["global_position"],bullet_path[read_record-1]["global_position"],bullet_path[read_record]["delta"])
|
||||
await get_tree().create_timer(bullet_path[read_record]["delta"]).timeout
|
||||
read_record -= 1
|
||||
if read_record <= 0:
|
||||
player.camera.current = true
|
||||
player.controlled_elsewhere = false
|
||||
player.gamespeed_controlled = false
|
||||
##visible = false
|
||||
##collision_shape.disabled = true
|
||||
##await get_tree().create_timer(1).timeout
|
||||
queue_free()
|
||||
#var read_record = record_id - 1
|
||||
#for i in bullet_path:
|
||||
#if read_record > 1:
|
||||
#camera.global_position = lerp(bullet_path[read_record]["global_position"],bullet_path[read_record-1]["global_position"],bullet_path[read_record]["delta"])
|
||||
#await get_tree().create_timer(bullet_path[read_record]["delta"]).timeout
|
||||
#read_record -= 1
|
||||
#if read_record <= 0:
|
||||
player.camera.current = true
|
||||
player.controlled_elsewhere = false
|
||||
player.gamespeed_controlled = false
|
||||
##visible = false
|
||||
##collision_shape.disabled = true
|
||||
##await get_tree().create_timer(1).timeout
|
||||
queue_free()
|
||||
|
||||
@@ -73,7 +73,9 @@ var gun_is_holstered = false
|
||||
@onready var level_control = get_tree().current_scene
|
||||
@onready var interact_ray = $Head/Recoil/Camera3D/InteractRay
|
||||
@onready var bullet_ray = $Head/Recoil/Camera3D/BulletRay
|
||||
@onready var velocity_ray: RayCast3D = $velocity_ray
|
||||
@onready var wall_ray_1: RayCast3D = $wall_ray1
|
||||
@onready var wall_ray_2: RayCast3D = $wall_ray2
|
||||
@onready var wall_ray_3: RayCast3D = $wall_ray3
|
||||
@onready var hitmarker = load("res://hitmarker.tscn")
|
||||
var instance_bullet
|
||||
var instance_casing
|
||||
@@ -112,6 +114,10 @@ var held_key_check = 0.0
|
||||
|
||||
# Slow Down Variables
|
||||
var remaining_stamina : float = MAX_STAMINA
|
||||
|
||||
# Wall Jump
|
||||
var can_wall_jump = true
|
||||
|
||||
# Pickups
|
||||
var picked_up = false
|
||||
var picked_up_text
|
||||
@@ -156,6 +162,7 @@ var controlled_elsewhere = false
|
||||
@onready var hud: Control = $Head/Recoil/Camera3D/HUD
|
||||
@onready var clock_sound: AudioStreamPlayer = $Audio/ClockSound
|
||||
@onready var weapon_select_menu: Control = $Head/Recoil/Camera3D/WeaponSelect
|
||||
@onready var wall_jump_timer: Timer = $WallJumpTimer
|
||||
|
||||
|
||||
func _ready():
|
||||
@@ -208,7 +215,6 @@ func _physics_process(delta):
|
||||
|
||||
if !dead and !level_control.paused:
|
||||
|
||||
|
||||
# Add the gravity.
|
||||
if is_on_floor():
|
||||
double_jump = true
|
||||
@@ -226,7 +232,7 @@ func _physics_process(delta):
|
||||
weapon_dip_pos += JUMP_WEAPON_DIP
|
||||
crouched = false
|
||||
elif wall_jump():
|
||||
velocity += 2 * Vector3(-velocity.x,10,-velocity.z)
|
||||
velocity += Vector3(velocity.x * 5,10,velocity.z * 5)
|
||||
elif double_jump == true and !is_climbing:
|
||||
velocity.y += JUMP_VELOCITY
|
||||
double_jump = false
|
||||
@@ -249,7 +255,17 @@ func _physics_process(delta):
|
||||
velocity.x += direction.x * DASH_SPEED
|
||||
velocity.z += direction.z * DASH_SPEED
|
||||
air_dash -= 1
|
||||
|
||||
|
||||
if Input.is_action_pressed("move_left"):
|
||||
wall_ray_1.enabled = true
|
||||
else:
|
||||
wall_ray_1.enabled = false
|
||||
|
||||
if Input.is_action_pressed("move_right"):
|
||||
wall_ray_2.enabled = true
|
||||
else:
|
||||
wall_ray_2.enabled = false
|
||||
|
||||
if Input.is_action_just_pressed("crouch"):
|
||||
if crouched:
|
||||
if !crouch_check.is_colliding():
|
||||
@@ -290,6 +306,12 @@ func _physics_process(delta):
|
||||
else:
|
||||
velocity.x = lerp(velocity.x, direction.x * speed, delta * 6.5)
|
||||
velocity.z = lerp(velocity.z, direction.z * speed, delta * 6.5)
|
||||
## wall_run
|
||||
if wall_ray_1.is_colliding() or wall_ray_2.is_colliding():
|
||||
if abs(Vector2(velocity.x,velocity.y)) >= Vector2(5.0,5.0):
|
||||
velocity.y = clamp(velocity.y,-2,abs(velocity.y))
|
||||
#velocity.x += -velocity.x * .01 * delta
|
||||
#velocity.z += -velocity.z * .01 * delta
|
||||
|
||||
# Head bob
|
||||
t_bob += delta * velocity.length() * float(is_on_floor())
|
||||
@@ -560,14 +582,20 @@ func ladder_collide():
|
||||
gravity = default_gravity
|
||||
|
||||
func wall_jump():
|
||||
velocity_ray.rotation = velocity.normalized()
|
||||
print("VELOCITY NORMALIZED: ",velocity.normalized())
|
||||
print("VELOCITY RAY ROTATION: ", velocity_ray.rotation)
|
||||
if velocity_ray.is_colliding():
|
||||
return true
|
||||
print("CAN JUMP? ",can_wall_jump)
|
||||
if can_wall_jump == true:
|
||||
if wall_ray_1.is_colliding() or wall_ray_2.is_colliding() or wall_ray_3.is_colliding():
|
||||
can_wall_jump = false
|
||||
wall_jump_timer.start()
|
||||
return true
|
||||
else:
|
||||
return false
|
||||
else:
|
||||
return false
|
||||
|
||||
func _on_wall_jump_timer_timeout() -> void:
|
||||
can_wall_jump = true
|
||||
|
||||
## VARIOUS ACTIONS
|
||||
func flashlight_toggle():
|
||||
if flashlight_on:
|
||||
|
||||
Reference in New Issue
Block a user