dead camera much improved and has the ability to step through multiple stages
This commit is contained in:
@@ -32,6 +32,6 @@ process/hdr_as_srgb=false
|
||||
process/hdr_clamp_exposure=false
|
||||
process/size_limit=0
|
||||
detect_3d/compress_to=1
|
||||
svg/scale=1.0
|
||||
svg/scale=2.0
|
||||
editor/scale_with_editor_scale=false
|
||||
editor/convert_colors_with_editor_theme=false
|
||||
|
||||
@@ -56,8 +56,12 @@ emission_energy_multiplier = 4.0
|
||||
|
||||
[sub_resource type="ParticleProcessMaterial" id="ParticleProcessMaterial_3wvag"]
|
||||
direction = Vector3(0, 0, 1)
|
||||
initial_velocity_min = 3.0
|
||||
initial_velocity_max = 5.0
|
||||
initial_velocity_min = 1.0
|
||||
initial_velocity_max = 2.0
|
||||
collision_mode = 1
|
||||
collision_friction = 1.0
|
||||
collision_bounce = 1.0
|
||||
collision_use_scale = true
|
||||
|
||||
[sub_resource type="BoxMesh" id="BoxMesh_qy3jk"]
|
||||
size = Vector3(0.025, 0.025, 0.025)
|
||||
@@ -74,6 +78,7 @@ emission_energy_multiplier = 8.0
|
||||
size = Vector3(0.04, 0.04, 0.04)
|
||||
|
||||
[sub_resource type="CylinderShape3D" id="CylinderShape3D_tqvit"]
|
||||
margin = 0.001
|
||||
height = 1.5
|
||||
radius = 0.055
|
||||
|
||||
|
||||
@@ -1,7 +1,10 @@
|
||||
[gd_scene load_steps=6 format=3 uid="uid://by7qyyhyurlw"]
|
||||
[gd_scene load_steps=7 format=3 uid="uid://by7qyyhyurlw"]
|
||||
|
||||
[ext_resource type="Script" path="res://scripts/dead_cam.gd" id="1_qxtd8"]
|
||||
|
||||
[sub_resource type="SphereShape3D" id="SphereShape3D_qnbpl"]
|
||||
radius = 0.25
|
||||
|
||||
[sub_resource type="CameraAttributesPractical" id="CameraAttributesPractical_2gkpp"]
|
||||
dof_blur_far_enabled = true
|
||||
dof_blur_near_enabled = true
|
||||
@@ -50,7 +53,15 @@ _data = {
|
||||
[node name="DeadCam" type="Node3D" groups=["spawned"]]
|
||||
script = ExtResource("1_qxtd8")
|
||||
|
||||
[node name="Camera3D" type="Camera3D" parent="."]
|
||||
[node name="CameraRigid" type="RigidBody3D" parent="."]
|
||||
collision_mask = 33
|
||||
gravity_scale = 0.0
|
||||
continuous_cd = true
|
||||
|
||||
[node name="CollisionShape3D" type="CollisionShape3D" parent="CameraRigid"]
|
||||
shape = SubResource("SphereShape3D_qnbpl")
|
||||
|
||||
[node name="Camera3D" type="Camera3D" parent="CameraRigid"]
|
||||
attributes = SubResource("CameraAttributesPractical_2gkpp")
|
||||
fov = 15.0
|
||||
|
||||
@@ -58,8 +69,7 @@ fov = 15.0
|
||||
target_position = Vector3(0, 0, -1)
|
||||
|
||||
[node name="Timer" type="Timer" parent="."]
|
||||
wait_time = 0.25
|
||||
one_shot = true
|
||||
wait_time = 0.3
|
||||
|
||||
[node name="Whiteout" type="ColorRect" parent="."]
|
||||
material = SubResource("CanvasItemMaterial_m5ien")
|
||||
@@ -72,4 +82,6 @@ libraries = {
|
||||
"": SubResource("AnimationLibrary_jsgjq")
|
||||
}
|
||||
|
||||
[node name="CamTarget" type="Node3D" parent="."]
|
||||
|
||||
[connection signal="timeout" from="Timer" to="." method="_on_timer_timeout"]
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
[gd_scene load_steps=27 format=3 uid="uid://drwae3loscbw7"]
|
||||
[gd_scene load_steps=26 format=3 uid="uid://drwae3loscbw7"]
|
||||
|
||||
[ext_resource type="Script" path="res://scripts/player.gd" id="1_x7wms"]
|
||||
[ext_resource type="PackedScene" uid="uid://dcmno6wafk5hg" path="res://assets/dead_player.tscn" id="2_4hoys"]
|
||||
@@ -10,7 +10,6 @@
|
||||
[ext_resource type="Script" path="res://scripts/StaminaCounter.gd" id="6_bgi8o"]
|
||||
[ext_resource type="Script" path="res://scripts/UIScreenAdjust.gd" id="7_pnp4a"]
|
||||
[ext_resource type="AudioStream" uid="uid://bki17g7j4kqn4" path="res://assets/Audio/PickupSound Mixdown 3.wav" id="8_dwqsx"]
|
||||
[ext_resource type="Texture2D" uid="uid://dhgyj08g1ge2o" path="res://assets/UI/SVG/hitmarkersvg.svg" id="8_kupqh"]
|
||||
[ext_resource type="AudioStream" uid="uid://dyd272r7n2ecd" path="res://assets/Audio/footsteps-shoes-jump-land-beach-sand-SBA-300118001.wav" id="10_tn0pn"]
|
||||
[ext_resource type="AudioStream" uid="uid://bl8yg1d3bsxs3" path="res://assets/Audio/constant-natural-strong-wind-looping-SBA-300062687.wav" id="11_he7p5"]
|
||||
[ext_resource type="AudioStream" uid="uid://cy150nsjqp7lt" path="res://assets/Audio/grunt-male-SBA-300282985.wav" id="12_f51u4"]
|
||||
@@ -38,21 +37,21 @@ shadow_color = Color(0, 0, 0, 1)
|
||||
[sub_resource type="ShaderMaterial" id="ShaderMaterial_ubnx7"]
|
||||
shader = ExtResource("14_v5svg")
|
||||
shader_parameter/overlay = true
|
||||
shader_parameter/scanlines_opacity = 0.05
|
||||
shader_parameter/scanlines_width = 0.5
|
||||
shader_parameter/grille_opacity = 0.05
|
||||
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 = 1.0
|
||||
shader_parameter/roll_size = 11.0
|
||||
shader_parameter/roll_variation = 2.8
|
||||
shader_parameter/distort_intensity = 0.002
|
||||
shader_parameter/noise_opacity = 0.015
|
||||
shader_parameter/roll_size = 15.0
|
||||
shader_parameter/roll_variation = 1.8
|
||||
shader_parameter/distort_intensity = 0.003
|
||||
shader_parameter/noise_opacity = 0.16
|
||||
shader_parameter/noise_speed = 5.0
|
||||
shader_parameter/static_noise_intensity = 0.005
|
||||
shader_parameter/aberration = 0.00300005
|
||||
shader_parameter/brightness = 1.4
|
||||
shader_parameter/aberration = 0.00400005
|
||||
shader_parameter/brightness = 1.69
|
||||
shader_parameter/discolor = true
|
||||
shader_parameter/warp_amount = 0.0
|
||||
shader_parameter/clip_warp = true
|
||||
@@ -152,18 +151,20 @@ hit_back_faces = false
|
||||
transform = Transform3D(1, 0, 0, 0, 0.992332, 0.123601, 0, -0.123601, 0.992332, 0, -0.921646, -0.000722691)
|
||||
|
||||
[node name="Crosshair" type="TextureRect" parent="Head/Recoil/Camera3D" groups=["hud"]]
|
||||
offset_right = 40.0
|
||||
offset_bottom = 40.0
|
||||
anchors_preset = 8
|
||||
anchor_left = 0.5
|
||||
anchor_top = 0.5
|
||||
anchor_right = 0.5
|
||||
anchor_bottom = 0.5
|
||||
offset_left = -20.0
|
||||
offset_top = -20.0
|
||||
offset_right = 20.0
|
||||
offset_bottom = 20.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
texture = ExtResource("6_5m60e")
|
||||
script = ExtResource("7_pnp4a")
|
||||
|
||||
[node name="Hitmarker" type="TextureRect" parent="Head/Recoil/Camera3D"]
|
||||
visible = false
|
||||
offset_right = 49.285
|
||||
offset_bottom = 40.0
|
||||
texture = ExtResource("8_kupqh")
|
||||
script = ExtResource("7_pnp4a")
|
||||
|
||||
[node name="BulletRay" type="RayCast3D" parent="Head/Recoil/Camera3D"]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, -0.462246)
|
||||
target_position = Vector3(0, 0, -200)
|
||||
@@ -188,7 +189,6 @@ offset_right = 0.0
|
||||
offset_bottom = 0.0
|
||||
|
||||
[node name="crtFilter" type="ColorRect" parent="Head/Recoil/Camera3D"]
|
||||
visible = false
|
||||
material = SubResource("ShaderMaterial_ubnx7")
|
||||
offset_right = 3840.0
|
||||
offset_bottom = 2160.0
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
[ext_resource type="Texture2D" uid="uid://c54kwbix1mo58" path="res://assets/Models/spider1.turret.png" id="3_npupg"]
|
||||
[ext_resource type="Texture2D" uid="uid://cvi0upsh0e1mu" path="res://assets/Models/spider1.turret.roughness1.png" id="4_hb265"]
|
||||
[ext_resource type="PackedScene" uid="uid://bbxibqxuiyqic" path="res://assets/stamina_pickup.tscn" id="4_p0ci7"]
|
||||
[ext_resource type="Texture2D" uid="uid://r7awur11yerj" path="res://assets/Models/spider1.gunbarrel.albedo.png" id="5_dtcjr"]
|
||||
[ext_resource type="Texture2D" uid="uid://b4s3w1qnqcmgq" path="res://assets/Models/spider1.gunbarrel.albedo.png" id="5_dtcjr"]
|
||||
[ext_resource type="PackedScene" uid="uid://bmbv6ujc00jhk" path="res://assets/ammo_pickup.tscn" id="5_k1lw4"]
|
||||
[ext_resource type="PackedScene" uid="uid://c1sypdvjjuww" path="res://assets/money_pickup.tscn" id="6_ihv2y"]
|
||||
[ext_resource type="Script" path="res://scripts/EnemyTarget.gd" id="7_8vkma"]
|
||||
|
||||
80
hitmarker.tscn
Normal file
80
hitmarker.tscn
Normal file
@@ -0,0 +1,80 @@
|
||||
[gd_scene load_steps=6 format=3 uid="uid://bweve8chonij3"]
|
||||
|
||||
[ext_resource type="Texture2D" uid="uid://dhgyj08g1ge2o" path="res://assets/UI/SVG/hitmarkersvg.svg" id="1_sja31"]
|
||||
[ext_resource type="Script" path="res://scripts/hitmarker.gd" id="2_8qjsl"]
|
||||
|
||||
[sub_resource type="Animation" id="Animation_gb8xo"]
|
||||
resource_name = "hit"
|
||||
length = 0.05
|
||||
step = 0.01
|
||||
tracks/0/type = "value"
|
||||
tracks/0/imported = false
|
||||
tracks/0/enabled = true
|
||||
tracks/0/path = NodePath(".:scale")
|
||||
tracks/0/interp = 2
|
||||
tracks/0/loop_wrap = true
|
||||
tracks/0/keys = {
|
||||
"times": PackedFloat32Array(0.05),
|
||||
"transitions": PackedFloat32Array(1),
|
||||
"update": 0,
|
||||
"values": [Vector2(1, 1)]
|
||||
}
|
||||
tracks/1/type = "method"
|
||||
tracks/1/imported = false
|
||||
tracks/1/enabled = true
|
||||
tracks/1/path = NodePath(".")
|
||||
tracks/1/interp = 1
|
||||
tracks/1/loop_wrap = true
|
||||
tracks/1/keys = {
|
||||
"times": PackedFloat32Array(0.05),
|
||||
"transitions": PackedFloat32Array(1),
|
||||
"values": [{
|
||||
"args": [],
|
||||
"method": &"anim_end"
|
||||
}]
|
||||
}
|
||||
|
||||
[sub_resource type="Animation" id="Animation_162up"]
|
||||
length = 0.001
|
||||
tracks/0/type = "value"
|
||||
tracks/0/imported = false
|
||||
tracks/0/enabled = true
|
||||
tracks/0/path = NodePath(".:scale")
|
||||
tracks/0/interp = 1
|
||||
tracks/0/loop_wrap = true
|
||||
tracks/0/keys = {
|
||||
"times": PackedFloat32Array(0),
|
||||
"transitions": PackedFloat32Array(1),
|
||||
"update": 0,
|
||||
"values": [Vector2(1, 1)]
|
||||
}
|
||||
|
||||
[sub_resource type="AnimationLibrary" id="AnimationLibrary_bki25"]
|
||||
_data = {
|
||||
"RESET": SubResource("Animation_162up"),
|
||||
"hit": SubResource("Animation_gb8xo")
|
||||
}
|
||||
|
||||
[node name="Hitmarker" type="TextureRect"]
|
||||
anchors_preset = 8
|
||||
anchor_left = 0.5
|
||||
anchor_top = 0.5
|
||||
anchor_right = 0.5
|
||||
anchor_bottom = 0.5
|
||||
offset_left = -33.5
|
||||
offset_top = -33.5
|
||||
offset_right = 33.5
|
||||
offset_bottom = 33.5
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
pivot_offset = Vector2(33, 33)
|
||||
size_flags_horizontal = 4
|
||||
size_flags_vertical = 4
|
||||
texture = ExtResource("1_sja31")
|
||||
script = ExtResource("2_8qjsl")
|
||||
|
||||
[node name="AnimationPlayer" type="AnimationPlayer" parent="."]
|
||||
libraries = {
|
||||
"": SubResource("AnimationLibrary_bki25")
|
||||
}
|
||||
autoplay = "hit"
|
||||
@@ -130,8 +130,6 @@ func cleared():
|
||||
clearedmsg.queue_free()
|
||||
|
||||
func die():
|
||||
Engine.time_scale = .05
|
||||
AudioServer.set_bus_effect_enabled(0,0,true)
|
||||
var deadmsg = DEAD_ANNOUNCE.instantiate()
|
||||
get_parent().add_child(deadmsg)
|
||||
var instance_dead = dead_player.instantiate()
|
||||
@@ -147,6 +145,7 @@ func die():
|
||||
player.dead = true
|
||||
player.toggle_hud(true)
|
||||
player.gun.visible = false
|
||||
player.health_indicator.color = Color(0.471, 0, 0, 0)
|
||||
player.crosshair.visible = false
|
||||
|
||||
|
||||
|
||||
@@ -16,4 +16,3 @@ func _ready():
|
||||
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
||||
func _process(delta):
|
||||
position = Vector2(viewportWidth/2 - (size.x/2), viewportHeight/2 - (size.y/2))
|
||||
|
||||
|
||||
@@ -1,29 +1,39 @@
|
||||
extends Node3D
|
||||
|
||||
|
||||
const DEAD_CAM_FOV = 50.0
|
||||
|
||||
@export var MOVE_SPEED = 30
|
||||
@export var CAMERA_LOOK_SPEED = 20
|
||||
@export var FOV_CHANGE_SPEED = 40
|
||||
|
||||
@onready var look_ray = $LookRay
|
||||
@onready var camera = $Camera3D
|
||||
@onready var camera = $CameraRigid/Camera3D
|
||||
@onready var camera_rigid: RigidBody3D = $CameraRigid
|
||||
@onready var timer = $Timer
|
||||
@onready var level_control = get_tree().current_scene
|
||||
@onready var whiteout = $Whiteout
|
||||
const ENEMY_TAUNT = preload("res://assets/enemy_taunt.tscn")
|
||||
@onready var ENEMY_TAUNT = preload("res://assets/enemy_taunt.tscn")
|
||||
@onready var animation_player = $AnimationPlayer
|
||||
@onready var cam_target: Node3D = $CamTarget
|
||||
|
||||
var focus_dist
|
||||
var target : Node
|
||||
var focus_target
|
||||
var respawn_position
|
||||
var respawn_rotation
|
||||
var taunt_node
|
||||
var respawn_fov
|
||||
const DEAD_CAM_FOV = 50.0
|
||||
var respawn = false
|
||||
var anim_step = 0
|
||||
|
||||
# Called when the node enters the scene tree for the first time.
|
||||
func _ready():
|
||||
|
||||
|
||||
Engine.time_scale = .05
|
||||
AudioServer.set_bus_effect_enabled(0,0,true)
|
||||
|
||||
#set FOV
|
||||
camera.fov = respawn_fov
|
||||
|
||||
@@ -31,7 +41,7 @@ func _ready():
|
||||
level_control.player.stamina_counter.visible = false
|
||||
|
||||
#start timer
|
||||
timer.start()
|
||||
timer.start(.3)
|
||||
|
||||
#highlight target
|
||||
if target != null:
|
||||
@@ -39,6 +49,7 @@ func _ready():
|
||||
taunt_spawn.text = taunt_spawn.taunts.pick_random()
|
||||
target.add_child(taunt_spawn)
|
||||
taunt_spawn.global_transform.origin = target.position + Vector3(0,2,0)
|
||||
taunt_node = taunt_spawn
|
||||
|
||||
|
||||
for i in target.outline_meshes:
|
||||
@@ -61,24 +72,43 @@ func _process(delta):
|
||||
camera.attributes.dof_blur_near_distance = focus_dist - 2
|
||||
|
||||
if target == null:
|
||||
respawn = true
|
||||
anim_step = 3
|
||||
|
||||
# Move towards and look at target
|
||||
if respawn == false:
|
||||
#calculate move direction
|
||||
var target_pos_adjusted = Vector3(target.position.x -4,target.position.y + 4,target.position.z -4)
|
||||
position = lerp(position,target_pos_adjusted,delta * MOVE_SPEED)
|
||||
look_ray.look_at(Vector3(target.global_position), Vector3.UP)
|
||||
camera.rotation = lerp(camera.rotation,look_ray.rotation,delta * CAMERA_LOOK_SPEED)
|
||||
camera.fov = lerp(camera.fov, 40.0, delta * 5)
|
||||
|
||||
elif respawn == true:
|
||||
animation_player.play("whiteout")
|
||||
camera_rigid.global_position = lerp(camera_rigid.global_position,cam_target.global_position, delta * 100)
|
||||
|
||||
match anim_step:
|
||||
0:
|
||||
#Show enemy that killed player
|
||||
var target_pos_adjusted = Vector3(target.position.x -4,target.position.y + 4,target.position.z -4)
|
||||
cam_target.global_position = lerp(cam_target.global_position,target_pos_adjusted,delta * MOVE_SPEED)
|
||||
look_ray.global_position = target_pos_adjusted
|
||||
look_ray.look_at(Vector3(target.global_position), Vector3.UP)
|
||||
camera.rotation = lerp(camera.rotation,look_ray.rotation,delta * CAMERA_LOOK_SPEED)
|
||||
camera.fov = lerp(camera.fov, 40.0, delta * 5)
|
||||
1:
|
||||
#aim at player from enemy
|
||||
Engine.time_scale = .1
|
||||
AudioServer.set_bus_effect_enabled(0,0,true)
|
||||
taunt_node.visible = false
|
||||
var target_pos_adjusted = Vector3(target.position.x,target.position.y + 2.1,target.position.z)
|
||||
cam_target.global_position = lerp(cam_target.global_position,target_pos_adjusted,delta * MOVE_SPEED)
|
||||
look_ray.global_position = target.global_position
|
||||
look_ray.look_at(Vector3(level_control.player.global_position), Vector3.UP)
|
||||
camera.rotation = lerp(camera.rotation,look_ray.rotation,delta * CAMERA_LOOK_SPEED)
|
||||
camera.fov = lerp(camera.fov, 110.0, delta * 100)
|
||||
2:
|
||||
var target_pos_adjusted = Vector3(target.position.x,target.position.y + 2.1,target.position.z)
|
||||
cam_target.global_position = lerp(cam_target.global_position,target_pos_adjusted,delta * MOVE_SPEED)
|
||||
look_ray.global_position = target.global_position
|
||||
look_ray.look_at(Vector3(level_control.player.global_position), Vector3.UP)
|
||||
camera.rotation = lerp(camera.rotation,look_ray.rotation,delta * CAMERA_LOOK_SPEED)
|
||||
camera.fov = lerp(camera.fov, 110.0, delta * 100)
|
||||
animation_player.play("whiteout")
|
||||
|
||||
|
||||
func _on_timer_timeout():
|
||||
respawn = true
|
||||
|
||||
anim_step += 1
|
||||
print("ANIM STEP " +str(anim_step))
|
||||
|
||||
func reload_level():
|
||||
get_tree().reload_current_scene()
|
||||
|
||||
13
scripts/hitmarker.gd
Normal file
13
scripts/hitmarker.gd
Normal file
@@ -0,0 +1,13 @@
|
||||
extends TextureRect
|
||||
|
||||
|
||||
# Called when the node enters the scene tree for the first time.
|
||||
func _ready():
|
||||
pass
|
||||
|
||||
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
||||
func _process(delta):
|
||||
pass
|
||||
|
||||
func anim_end():
|
||||
queue_free()
|
||||
@@ -56,6 +56,7 @@ var gun : Node
|
||||
@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 hitmarker = load("res://hitmarker.tscn")
|
||||
var instance_bullet
|
||||
var instance_casing
|
||||
var instance_mag
|
||||
@@ -85,7 +86,6 @@ var dead_announce = load("res://assets/dead_announce.tscn")
|
||||
var pickupmsg
|
||||
|
||||
@onready var crosshair = $Head/Recoil/Camera3D/Crosshair
|
||||
@onready var hitmarker: TextureRect = $Head/Recoil/Camera3D/Hitmarker
|
||||
@onready var head = $Head
|
||||
@onready var camera = $Head/Recoil/Camera3D
|
||||
@onready var world_environment = $"../WorldEnvironment"
|
||||
@@ -122,6 +122,8 @@ func _ready():
|
||||
health_indicator.size = Vector2(viewportWidth,viewportHeight)
|
||||
health_indicator.color = Color(0.471, 0, 0, 0)
|
||||
|
||||
crt_filter.visible = false
|
||||
|
||||
#turn off audio if unchecked in player
|
||||
if AUDIO == false:
|
||||
AudioServer.set_bus_volume_db(0,-80)
|
||||
@@ -397,9 +399,8 @@ func weapon_select(gun_id):
|
||||
level_control.gun_spawn(gun_id)
|
||||
|
||||
func enemy_hit():
|
||||
hitmarker.visible = true
|
||||
await get_tree().create_timer(.1).timeout
|
||||
hitmarker.visible = false
|
||||
var hitmarker_spawn = hitmarker.instantiate()
|
||||
camera.add_child(hitmarker_spawn)
|
||||
|
||||
func toggle_hud(hud_on):
|
||||
|
||||
|
||||
Reference in New Issue
Block a user