Minor tweaks and bug fixes
This commit is contained in:
@@ -133,7 +133,7 @@ func die():
|
||||
var deadmsg = DEAD_ANNOUNCE.instantiate()
|
||||
get_parent().add_child(deadmsg)
|
||||
var instance_dead = dead_player.instantiate()
|
||||
instance_dead.global_position = player.global_position
|
||||
instance_dead.global_position = player.camera.global_position
|
||||
instance_dead.transform.basis = player.global_transform.basis
|
||||
#instance_dead.camera.rotation = player.camera.rotation
|
||||
instance_dead.target = last_hit
|
||||
|
||||
@@ -14,6 +14,7 @@ const DEAD_CAM_FOV = 50.0
|
||||
@onready var level_control = get_tree().current_scene
|
||||
@onready var whiteout = $Whiteout
|
||||
@onready var ENEMY_TAUNT = preload("res://assets/enemy_taunt.tscn")
|
||||
@onready var dead_mask = preload("res://assets/dead_mask.tscn")
|
||||
@onready var animation_player = $AnimationPlayer
|
||||
@onready var cam_target: Node3D = $CamTarget
|
||||
|
||||
@@ -53,6 +54,14 @@ func _ready():
|
||||
|
||||
for i in target.outline_meshes:
|
||||
i.visible = true
|
||||
|
||||
## Get Distance from player to target in meters
|
||||
#var distance_to_target = global_position.distance_to(target.global_position)
|
||||
#var instance_dead_mask = dead_mask.instantiate()
|
||||
##instance_dead_mask.scale *= Vector3(10,10,10)
|
||||
#instance_dead_mask.transform.basis = transform.basis
|
||||
#instance_dead_mask.global_position = global_position
|
||||
#get_tree().current_scene.add_child(instance_dead_mask)
|
||||
|
||||
#set whiteout to size of screen
|
||||
var viewportWidth = get_viewport().size.x
|
||||
@@ -98,6 +107,8 @@ func _process(delta):
|
||||
look_ray.look_at(Vector3(level_control.player.global_position), Vector3.UP)
|
||||
camera.rotation = lerp(camera.rotation,look_ray.rotation,delta * CAMERA_LOOK_SPEED)
|
||||
animation_player.play("whiteout")
|
||||
3:
|
||||
animation_player.play("whiteout")
|
||||
|
||||
|
||||
func _on_timer_timeout():
|
||||
|
||||
@@ -17,6 +17,8 @@ extends Node3D
|
||||
@export var fire_pitch_scale_amt = .2
|
||||
@export_group("Gun Assets")
|
||||
@export_subgroup("Main Assets")
|
||||
@export var r_hand_location : Node
|
||||
@export var l_hand_location : Node
|
||||
@export var flare_light : Node
|
||||
@export var bullet : Resource
|
||||
@export var bullet_fake : Resource
|
||||
|
||||
@@ -109,6 +109,8 @@ var pickupmsg
|
||||
@onready var crt_filter: ColorRect = $Head/Recoil/Camera3D/crtFilter
|
||||
@onready var moveable_holder: Node3D = $Head/MoveableHolder
|
||||
@onready var stand_check: RayCast3D = $StandCheck
|
||||
@onready var r_hand_test: MeshInstance3D = $Head/Recoil/Camera3D/WeaponHolder/RHandTest
|
||||
@onready var l_hand_test: MeshInstance3D = $Head/Recoil/Camera3D/WeaponHolder/LHandTest
|
||||
|
||||
|
||||
func _ready():
|
||||
@@ -160,6 +162,7 @@ func _physics_process(delta):
|
||||
if abs(velocity.y) >= .1:
|
||||
moving_fast = true
|
||||
|
||||
|
||||
# Handle jump.
|
||||
if Input.is_action_just_pressed("jump") and is_on_floor() and !is_climbing:
|
||||
velocity.y += JUMP_VELOCITY
|
||||
@@ -312,23 +315,28 @@ func _physics_process(delta):
|
||||
else:
|
||||
held_item_rotation.y -= deg_to_rad(45)
|
||||
|
||||
# Weapon Swap Number 1
|
||||
if Input.is_action_just_pressed("numb_1") and !gun.anim_player.is_playing():
|
||||
# Weapon Swap by Numbers
|
||||
if Input.is_action_just_pressed("numb_1"):
|
||||
weapon_select(0)
|
||||
|
||||
if Input.is_action_just_pressed("numb_2") and !gun.anim_player.is_playing():
|
||||
if Input.is_action_just_pressed("numb_2"):
|
||||
weapon_select(1)
|
||||
|
||||
if Input.is_action_just_pressed("numb_3") and !gun.anim_player.is_playing():
|
||||
if Input.is_action_just_pressed("numb_3"):
|
||||
weapon_select(2)
|
||||
|
||||
|
||||
if Input.is_action_just_pressed("numb_4") and !gun.anim_player.is_playing():
|
||||
if Input.is_action_just_pressed("numb_4"):
|
||||
weapon_select(3)
|
||||
|
||||
if Input.is_action_just_pressed("numb_5") and !gun.anim_player.is_playing():
|
||||
if Input.is_action_just_pressed("numb_5"):
|
||||
weapon_select(4)
|
||||
|
||||
if Input.is_action_just_pressed("numb_6"):
|
||||
weapon_select(5)
|
||||
if Input.is_action_just_pressed("numb_7"):
|
||||
weapon_select(6)
|
||||
if Input.is_action_just_pressed("numb_8"):
|
||||
weapon_select(7)
|
||||
if Input.is_action_just_pressed("numb_9"):
|
||||
weapon_select(8)
|
||||
if Input.is_action_just_pressed("numb_0"):
|
||||
weapon_select(9)
|
||||
|
||||
# Move Held Items
|
||||
if held_item != null:
|
||||
var held_force_dir = moveable_holder.global_position - held_item.global_position
|
||||
@@ -360,12 +368,10 @@ func _physics_process(delta):
|
||||
if interact_ray.is_colliding():
|
||||
if interact_ray.get_collider().is_in_group("scene_rigidbody"):
|
||||
kick_audio.play()
|
||||
interact_ray.get_collider().linear_velocity += transform.basis * Vector3(0,0, -KICK_AMOUNT)
|
||||
interact_ray.get_collider().linear_velocity += interact_ray.global_transform.basis * Vector3(0,0, -KICK_AMOUNT)
|
||||
if held_item != null:
|
||||
release_moveable()
|
||||
|
||||
|
||||
|
||||
if level_control.health <= 0:
|
||||
level_control.die()
|
||||
|
||||
@@ -391,7 +397,6 @@ func _on_pick_up_detection_body_entered(body):
|
||||
|
||||
|
||||
func ladder_collide(is_climbing):
|
||||
|
||||
if is_climbing == true:
|
||||
gravity = 0.0
|
||||
else:
|
||||
@@ -425,9 +430,10 @@ func weapon_bob(vel : float, delta):
|
||||
weapon_holder.position.x = lerp(weapon_holder.position.x, def_weapon_holder_pos.x, .1 * delta)
|
||||
|
||||
func weapon_select(gun_id):
|
||||
if level_control.held_guns.size() >= (gun_id + 1) and level_control.current_gun_index != gun_id:
|
||||
gun.anim_player.play("swap_out")
|
||||
level_control.gun_spawn(gun_id)
|
||||
if !gun.anim_player.is_playing():
|
||||
if level_control.held_guns.size() >= (gun_id + 1) and level_control.current_gun_index != gun_id:
|
||||
gun.anim_player.play("swap_out")
|
||||
level_control.gun_spawn(gun_id)
|
||||
|
||||
func enemy_hit():
|
||||
var hitmarker_spawn = hitmarker.instantiate()
|
||||
|
||||
@@ -23,6 +23,8 @@ var cycle_count
|
||||
@export var fire_pitch_scale_amt = .2
|
||||
@export_group("Gun Assets")
|
||||
@export_subgroup("Main Assets")
|
||||
@export var r_hand_location : Node
|
||||
@export var l_hand_location : Node
|
||||
@export var chamber : Node
|
||||
@export var bullet : Resource
|
||||
@export var bullethole : Resource
|
||||
@@ -170,7 +172,7 @@ func reload(delta):
|
||||
if anim_player.is_playing() and anim_player.current_animation == "reload":
|
||||
level_control.ammo_current[gun_index] = 0
|
||||
|
||||
func spawn_casings():
|
||||
func spawn_casings():
|
||||
for i in casing_array:
|
||||
i.visible = false
|
||||
if casings_chamber_last > 0:
|
||||
|
||||
Reference in New Issue
Block a user