more crosshair tweaks
This commit is contained in:
@@ -20,7 +20,7 @@ linear_damp = 0.1
|
||||
angular_damp = 0.1
|
||||
script = ExtResource("1_dxvh8")
|
||||
|
||||
[node name="casing2" type="Node3D" parent="." instance=ExtResource("2_ba08p")]
|
||||
[node name="casing2" parent="." instance=ExtResource("2_ba08p")]
|
||||
transform = Transform3D(0.00523599, 9.20396e-06, -1.49999, 1.49999, 0.00261793, 0.005236, 0.00261795, -1.5, -6.55667e-08, 0, 0, 0)
|
||||
|
||||
[node name="CollisionShape3D" type="CollisionShape3D" parent="."]
|
||||
@@ -28,7 +28,7 @@ transform = Transform3D(-0.00106233, -0.000701044, -0.999999, 0.999999, -0.00043
|
||||
shape = SubResource("CylinderShape3D_ejwa0")
|
||||
|
||||
[node name="Timer" type="Timer" parent="."]
|
||||
wait_time = 30.0
|
||||
wait_time = 10.0
|
||||
one_shot = true
|
||||
autostart = true
|
||||
|
||||
|
||||
@@ -38,6 +38,7 @@ fov_zoom_amt = 0.98
|
||||
crosshair_radius = 100
|
||||
ads = false
|
||||
recoil_amount = Vector3(0.3, 0.05, 0.05)
|
||||
crosshair_jump_amount = 100
|
||||
kick_amount = 0.1
|
||||
max_ammo = 1
|
||||
start_mags = 10
|
||||
|
||||
@@ -42,7 +42,7 @@ transform = Transform3D(-0.00106233, -0.000701004, -0.999999, 0.999999, -0.00043
|
||||
shape = SubResource("CylinderShape3D_ejwa0")
|
||||
|
||||
[node name="Timer" type="Timer" parent="."]
|
||||
wait_time = 30.0
|
||||
wait_time = 10.0
|
||||
one_shot = true
|
||||
autostart = true
|
||||
|
||||
|
||||
@@ -38,6 +38,7 @@ fov_zoom_amt = 0.98
|
||||
crosshair_radius = 100
|
||||
ads = false
|
||||
recoil_amount = Vector3(0.05, 0.05, 0.05)
|
||||
crosshair_jump_amount = 10
|
||||
kick_amount = 0.1
|
||||
max_ammo = 1
|
||||
start_mags = 3
|
||||
|
||||
@@ -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