added crown, tweaks with muzzle smoke
This commit is contained in:
@@ -88,7 +88,6 @@ func shoot(delta):
|
||||
if level_control.ammo_current[gun_index] > 0:
|
||||
if !anim_player.is_playing():
|
||||
anim_player.play("shoot")
|
||||
barrel_smoke(fire_smoke,true)
|
||||
elif !anim_player.is_playing() and cycle_count != 0:
|
||||
anim_player.play("empty")
|
||||
audio_empty.play()
|
||||
@@ -98,6 +97,9 @@ func fire():
|
||||
audio_fire.pitch_scale = 1 + rng.randf_range(-fire_pitch_scale_amt,fire_pitch_scale_amt)
|
||||
audio_fire.play()
|
||||
pellet_spawn()
|
||||
fire_smoke.restart()
|
||||
fire_smoke.emitting = true
|
||||
smoke_timer.start()
|
||||
player.recoil.add_recoil(Vector3(0,recoil_amount.y,recoil_amount.z),10,10)
|
||||
player.recoil.add_gun_recoil(recoil_amount.x)
|
||||
player.velocity += player.bullet_ray.global_basis * Vector3(0,0, kick_amount)
|
||||
@@ -134,15 +136,13 @@ func pellet_spawn():
|
||||
instance_bullet.player_position = player.global_position
|
||||
get_tree().get_root().add_child(instance_bullet)
|
||||
pellets_remaining -= 1
|
||||
|
||||
func barrel_smoke(particle_system, emitting_state):
|
||||
particle_system.emitting = emitting_state
|
||||
smoke_timer.start()
|
||||
|
||||
func swapped_out():
|
||||
queue_free()
|
||||
|
||||
|
||||
func _on_smoke_timer_timeout() -> void:
|
||||
barrel_smoke(smoke, false)
|
||||
barrel_smoke(fire_smoke, false)
|
||||
smoke.restart()
|
||||
smoke.emitting = true
|
||||
smoke_timer.stop()
|
||||
|
||||
|
||||
@@ -17,6 +17,7 @@ const DEAD_CAM_FOV = 50.0
|
||||
@onready var dead_mask = preload("res://assets/dead_mask.tscn")
|
||||
@onready var animation_player = $AnimationPlayer
|
||||
@onready var cam_target: Node3D = $CamTarget
|
||||
@onready var crown = preload("res://assets/crown.tscn")
|
||||
|
||||
var focus_dist
|
||||
var target : Node
|
||||
@@ -52,6 +53,9 @@ func _ready():
|
||||
taunt_spawn.global_transform.origin = target.global_position + Vector3(0,2,0)
|
||||
taunt_node = taunt_spawn
|
||||
|
||||
var crown_spawn = crown.instantiate()
|
||||
target.add_child(crown_spawn)
|
||||
crown_spawn.global_transform.origin = target.global_position + Vector3(0,2,0)
|
||||
|
||||
for i in target.outline_meshes:
|
||||
i.visible = true
|
||||
|
||||
@@ -11,6 +11,7 @@ extends Node3D
|
||||
@export var max_ammo = 15
|
||||
@export var start_mags = 3
|
||||
@export var bullet_damage = 1
|
||||
@export var smoke_enabled : bool = false
|
||||
@export var bullet_force_mod = 5.0
|
||||
@export var bullet_speed = 150
|
||||
@export var bullet_drop = .3
|
||||
@@ -38,6 +39,7 @@ extends Node3D
|
||||
|
||||
@onready var player = get_tree().current_scene.player
|
||||
@onready var level_control = get_tree().current_scene
|
||||
@onready var muzzle_smoke = preload("res://assets/muzzle_smoke.tscn")
|
||||
@onready var ammo_current
|
||||
|
||||
var start_position
|
||||
@@ -95,6 +97,8 @@ func shoot(delta):
|
||||
bullet_fire()
|
||||
hitscan_fire()
|
||||
spawn_casing()
|
||||
if smoke_enabled:
|
||||
spawn_muzzle_smoke()
|
||||
player.recoil.add_recoil(Vector3(0,recoil_amount.y,recoil_amount.z),10,10)
|
||||
player.recoil.add_gun_recoil(recoil_amount.x)
|
||||
#player.velocity += player.bullet_ray.global_basis * Vector3(0,0, kick_amount)
|
||||
@@ -130,6 +134,12 @@ func spawn_casing():
|
||||
instance_casing.player_velocity = player.velocity * transform.basis
|
||||
get_tree().get_root().add_child(instance_casing)
|
||||
|
||||
func spawn_muzzle_smoke():
|
||||
var instance_smoke = muzzle_smoke.instantiate()
|
||||
instance_smoke.global_transform.basis = barrel_raycast.global_transform.basis
|
||||
|
||||
add_child(instance_smoke)
|
||||
|
||||
func bullet_fire():
|
||||
var instance_bullet
|
||||
if hitscan_enabled:
|
||||
|
||||
16
scripts/muzzle_smoke.gd
Normal file
16
scripts/muzzle_smoke.gd
Normal file
@@ -0,0 +1,16 @@
|
||||
extends Node3D
|
||||
|
||||
@onready var fire_smoke: GPUParticles3D = $fire_smoke
|
||||
|
||||
# Called when the node enters the scene tree for the first time.
|
||||
func _ready() -> void:
|
||||
fire_smoke.emitting = true
|
||||
|
||||
|
||||
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
||||
func _process(delta: float) -> void:
|
||||
pass
|
||||
|
||||
|
||||
func _on_timer_timeout() -> void:
|
||||
queue_free()
|
||||
@@ -175,6 +175,9 @@ func _physics_process(delta):
|
||||
|
||||
speed = WALK_SPEED #the fuck is this line doing
|
||||
|
||||
if Input.is_action_just_pressed("crouch"):
|
||||
velocity.y -= JUMP_VELOCITY * 4
|
||||
|
||||
# Get the input direction and handle the movement/deceleration.
|
||||
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()
|
||||
|
||||
@@ -130,7 +130,7 @@ func _on_area_3d_body_part_hit(dam,bullet_damage):
|
||||
func _on_prefire_timer_timeout():
|
||||
fire(barrel_1)
|
||||
smoke.emitting = true
|
||||
await get_tree().create_timer(.5).timeout
|
||||
#await get_tree().create_timer(.5).timeout # makes it too hard lol
|
||||
fire(barrel_2)
|
||||
smoke_2.emitting = true
|
||||
turret_material.emission_enabled = false
|
||||
|
||||
Reference in New Issue
Block a user