more tweaks
This commit is contained in:
@@ -145,8 +145,7 @@ func die():
|
||||
get_tree().get_root().add_child(instance_dead)
|
||||
instance_dead.camera.current = true
|
||||
player.dead = true
|
||||
player.crt_filter.visible = true
|
||||
player.toggle_hud(false)
|
||||
player.toggle_hud(true)
|
||||
player.gun.visible = false
|
||||
player.crosshair.visible = false
|
||||
|
||||
|
||||
@@ -9,6 +9,7 @@ var bullet_force_mod = 1.0
|
||||
var distance_from_player
|
||||
var player_position
|
||||
var player_velocity
|
||||
var bullet_active = true
|
||||
|
||||
@onready var mesh = $Cylinder
|
||||
@onready var particles = $GPUParticles3D
|
||||
@@ -37,7 +38,7 @@ func _physics_process(delta):
|
||||
|
||||
func _on_body_entered(body: Node) -> void:
|
||||
|
||||
if !body.is_in_group("player"):
|
||||
if !body.is_in_group("player") and bullet_active:
|
||||
print("BODY HIT - " + str(body))
|
||||
|
||||
#Break Breakable Objects
|
||||
@@ -47,8 +48,6 @@ func _on_body_entered(body: Node) -> void:
|
||||
if body.is_in_group("switch"):
|
||||
body.hit()
|
||||
|
||||
mesh.visible = false
|
||||
|
||||
if ray.is_colliding() and !ray.get_collider().is_in_group("player"):
|
||||
#Bullet Hole Effect
|
||||
ray.get_collider().add_child(instance_bullethole)
|
||||
@@ -65,4 +64,8 @@ func _on_body_entered(body: Node) -> void:
|
||||
SignalBus.emit_signal("enemy_hit")
|
||||
ray.get_collider().hit(bullet_damage)
|
||||
|
||||
mesh.visible = false
|
||||
bullet_active = false
|
||||
particles.emitting = true
|
||||
await get_tree().create_timer(1).timeout
|
||||
queue_free()
|
||||
|
||||
@@ -410,4 +410,3 @@ func toggle_hud(hud_on):
|
||||
ammo_counter.visible = hud_on
|
||||
stamina_counter.visible = hud_on
|
||||
|
||||
hud_visible = !hud_visible
|
||||
|
||||
@@ -17,10 +17,14 @@ func _process(delta: float) -> void:
|
||||
basis = Quaternion.from_euler(current_rotation)
|
||||
|
||||
func add_recoil(recoil_amount,snap_change,speed_change) -> void:
|
||||
#set to provided snap/speed changes
|
||||
snap_amount = snap_change
|
||||
speed = speed_change
|
||||
|
||||
#vertical recoil and random L+R recoil within given range
|
||||
var recoil_x = recoil_amount.x
|
||||
var recoil_y = randf_range(-recoil_amount.y,recoil_amount.y)
|
||||
var recoil_z = randf_range(-recoil_amount.z,recoil_amount.z)
|
||||
|
||||
#add to target rotation
|
||||
target_rotation += Vector3(recoil_x, recoil_y, recoil_z)
|
||||
|
||||
@@ -11,6 +11,7 @@ var cycle_count
|
||||
@export_enum("Auto", "Single", "Burst") var fire_mode: int
|
||||
@export var fov_zoom_amt = .98
|
||||
@export var recoil_amount : Vector3 = Vector3(1,.1,.1)
|
||||
@export var recoil_speed_change : float = 4
|
||||
@export var max_ammo = 15
|
||||
@export var start_mags = 3
|
||||
@export var bullet_damage = 1
|
||||
@@ -156,7 +157,7 @@ func fire(delta):
|
||||
instance_bullet.player_velocity = player.velocity
|
||||
instance_bullet.instance_bullethole = bullethole.instantiate()
|
||||
get_tree().get_root().add_child(instance_bullet)
|
||||
player.recoil.add_recoil(recoil_amount,10,10)
|
||||
player.recoil.add_recoil(recoil_amount,10,recoil_speed_change)
|
||||
chamber.rotate_object_local(Vector3(0,-1,0),deg_to_rad(60))
|
||||
|
||||
func reload(delta):
|
||||
|
||||
Reference in New Issue
Block a user