more crosshair tweaks
This commit is contained in:
@@ -54,8 +54,11 @@ func _process(delta: float) -> void:
|
||||
func _draw() -> void:
|
||||
|
||||
#INNER RING
|
||||
draw_circle(Vector2.ZERO, inner_ring_radius + 2, Color(0,0,0,1))
|
||||
draw_circle(Vector2.ZERO, inner_ring_radius, Color(crosshair_color.r,crosshair_color.g,crosshair_color.b,1))
|
||||
#OUTER RING
|
||||
draw_circle(Vector2.ZERO, outer_ring_radius - 2, Color(0,0,0,crosshair_color.a),false,outer_ring_width,true)
|
||||
draw_circle(Vector2.ZERO, outer_ring_radius + 2, Color(0,0,0,crosshair_color.a),false,outer_ring_width,true)
|
||||
draw_circle(Vector2.ZERO, outer_ring_radius, crosshair_color,false,outer_ring_width,true)
|
||||
|
||||
if hud.player != null:
|
||||
@@ -64,6 +67,7 @@ func _draw() -> void:
|
||||
var stam_start_angle = 0 + stam_offset
|
||||
var stam_end_angle = TAU * (hud.player.remaining_stamina/hud.level_control.gamemode.max_stamina) + stam_offset
|
||||
var stam_width = (outer_ring_radius / 5) + 10
|
||||
draw_arc(Vector2(0,0),outer_ring_radius,stam_start_angle,stam_end_angle,100,Color(0,0,0,stamina_bar_color.a),stam_width + 4,true)
|
||||
draw_arc(Vector2(0,0),outer_ring_radius,stam_start_angle,stam_end_angle,100,stamina_bar_color,stam_width,true)
|
||||
|
||||
func outer_ring_fade() -> float:
|
||||
@@ -93,8 +97,8 @@ func crosshair_color_target():
|
||||
return ColorSwatch.FULL_WHITE
|
||||
|
||||
|
||||
func crosshair_size_change():
|
||||
crosshair_target += 10
|
||||
func crosshair_size_change(amount):
|
||||
crosshair_target += amount
|
||||
|
||||
func player_hit():
|
||||
crosshair_size_change()
|
||||
crosshair_size_change(20)
|
||||
|
||||
@@ -12,6 +12,7 @@ class_name weapon_resource
|
||||
@export var crosshair_radius = 50
|
||||
@export var ads : bool = false
|
||||
@export var recoil_amount : Vector3 = Vector3(.05,.05,.05)
|
||||
@export var crosshair_jump_amount : int = 10
|
||||
@export var kick_amount : float = .1
|
||||
@export var max_ammo = 15
|
||||
@export var start_mags = 3
|
||||
|
||||
@@ -103,38 +103,36 @@ func reload_finished():
|
||||
|
||||
|
||||
func shoot():
|
||||
if GameGlobals.gun_ammo.has(weapon_info.gun_name):
|
||||
if weapon_info.weapon_type == 0:
|
||||
if GameGlobals.gun_ammo[weapon_info.gun_name] > 0 and cycle_count > 0:
|
||||
if !anim_player.is_playing():
|
||||
GameGlobals.gun_ammo[weapon_info.gun_name] -= 1
|
||||
if weapon_info.fire_mode != 0:
|
||||
cycle_count -= 1
|
||||
#audio and anims
|
||||
anim_player.play("shoot")
|
||||
|
||||
elif !anim_player.is_playing() and cycle_count != 0:
|
||||
anim_player.play("empty")
|
||||
audio_empty.play()
|
||||
|
||||
elif weapon_info.weapon_type == 1:
|
||||
if weapon_info.weapon_type == 0:
|
||||
if GameGlobals.gun_ammo[weapon_info.gun_name] > 0 and cycle_count > 0:
|
||||
if !anim_player.is_playing():
|
||||
GameGlobals.gun_ammo[weapon_info.gun_name] -= 1
|
||||
if weapon_info.fire_mode != 0:
|
||||
cycle_count -= 1
|
||||
#audio and anims
|
||||
anim_player.play("shoot")
|
||||
vibration()
|
||||
player.recoil.add_recoil(Vector3(0,weapon_info.recoil_amount.y,weapon_info.recoil_amount.z),10,10)
|
||||
player.recoil.add_gun_recoil(weapon_info.recoil_amount.x)
|
||||
SignalBus.emit_signal("shot_fired")
|
||||
|
||||
elif weapon_info.weapon_type == 2:
|
||||
if !anim_player.is_playing():
|
||||
if tracker == null and Input.is_action_just_pressed("shoot"):
|
||||
check_track = true
|
||||
weapon_info.tracker_check_mesh.visible = true
|
||||
weapon_info.tracker_check_mesh.anim_player.play("check")
|
||||
if tracker != null and !check_track:
|
||||
anim_player.play("shoot")
|
||||
|
||||
elif !anim_player.is_playing() and cycle_count != 0:
|
||||
anim_player.play("empty")
|
||||
audio_empty.play()
|
||||
|
||||
elif weapon_info.weapon_type == 1:
|
||||
if !anim_player.is_playing():
|
||||
#audio and anims
|
||||
anim_player.play("shoot")
|
||||
vibration()
|
||||
player.recoil.add_recoil(Vector3(0,weapon_info.recoil_amount.y,weapon_info.recoil_amount.z),10,10)
|
||||
player.recoil.add_gun_recoil(weapon_info.recoil_amount.x)
|
||||
|
||||
elif weapon_info.weapon_type == 2:
|
||||
if !anim_player.is_playing():
|
||||
if tracker == null and Input.is_action_just_pressed("shoot"):
|
||||
check_track = true
|
||||
weapon_info.tracker_check_mesh.visible = true
|
||||
weapon_info.tracker_check_mesh.anim_player.play("check")
|
||||
if tracker != null and !check_track:
|
||||
anim_player.play("shoot")
|
||||
|
||||
func reload():
|
||||
match weapon_info.weapon_type:
|
||||
0:
|
||||
@@ -215,6 +213,7 @@ func tracker_checker(_delta):
|
||||
check_track = false
|
||||
|
||||
func shotgun_pellet_spawn():
|
||||
SignalBus.emit_signal("shot_fired",weapon_info.crosshair_jump_amount)
|
||||
audio_fire.play()
|
||||
spawn_casing()
|
||||
var pellets_remaining = weapon_info.pellets_per_shot
|
||||
@@ -263,6 +262,7 @@ func projectile_initialize():
|
||||
return instance_bullet
|
||||
|
||||
func bullet_fire():
|
||||
SignalBus.emit_signal("shot_fired",weapon_info.crosshair_jump_amount)
|
||||
audio_fire.play()
|
||||
get_tree().current_scene.add_child(projectile_initialize())
|
||||
spawn_casing()
|
||||
|
||||
Reference in New Issue
Block a user