fixed weapon spawning in and added per-weapon crosshair size

This commit is contained in:
derek
2025-03-18 16:14:20 -05:00
parent ba18dd30f5
commit 9802c0927e
10 changed files with 38 additions and 64 deletions

View File

@@ -21,7 +21,9 @@
[sub_resource type="Resource" id="Resource_gh6p6"] [sub_resource type="Resource" id="Resource_gh6p6"]
script = ExtResource("3_64qwm") script = ExtResource("3_64qwm")
asset = ExtResource("2_6ms5m") asset = ExtResource("2_6ms5m")
price = 1
ammo_type = 3 ammo_type = 3
special_bullet_name = ""
[sub_resource type="Resource" id="Resource_puk5e"] [sub_resource type="Resource" id="Resource_puk5e"]
script = ExtResource("5_yt5ea") script = ExtResource("5_yt5ea")
@@ -32,8 +34,8 @@ weapon_type = 0
reload_type = 0 reload_type = 0
bullet = SubResource("Resource_gh6p6") bullet = SubResource("Resource_gh6p6")
fire_mode = 0 fire_mode = 0
hitscan_range = 100.0
fov_zoom_amt = 0.98 fov_zoom_amt = 0.98
crosshair_radius = 100
ads = false ads = false
recoil_amount = Vector3(0.3, 0.05, 0.05) recoil_amount = Vector3(0.3, 0.05, 0.05)
kick_amount = 0.1 kick_amount = 0.1
@@ -43,9 +45,14 @@ bullet_damage = 1
smoke_enabled = false smoke_enabled = false
bullet_force_mod = 5.0 bullet_force_mod = 5.0
bullet_speed = 600 bullet_speed = 600
vibration_weak_magnitude = 0.1
vibration_strong_magnitude = 0.5
vibration_duration = 0.1
chamber_rot_amount = 60.0
shotgun_spread = Vector3(180, 180, 180) shotgun_spread = Vector3(180, 180, 180)
pellets_per_shot = 50 pellets_per_shot = 50
blast_power = 50.0 blast_power = 50.0
hitscan_range = 100.0
[sub_resource type="ShaderMaterial" id="ShaderMaterial_11x5l"] [sub_resource type="ShaderMaterial" id="ShaderMaterial_11x5l"]
resource_name = "blunderbus.stock" resource_name = "blunderbus.stock"

View File

@@ -1,40 +0,0 @@
[gd_scene load_steps=5 format=3 uid="uid://8kmjybgrobj1"]
[ext_resource type="Texture2D" uid="uid://dumgg4fq1ngbj" path="res://assets/UI/Crosshair/SVG/reticle_outer.svg" id="1_5bf65"]
[ext_resource type="Texture2D" uid="uid://cpe2ehq1vtj25" path="res://assets/UI/Crosshair/SVG/reticle_inner.svg" id="2_yawbq"]
[ext_resource type="Texture2D" uid="uid://h2tp42xntorm" path="res://assets/UI/Crosshair/SVG/Stamina_White.svg" id="3_spf5y"]
[sub_resource type="CanvasItemMaterial" id="CanvasItemMaterial_ytfhs"]
[node name="Crosshair" type="Control"]
layout_mode = 3
anchors_preset = 0
offset_right = 40.0
offset_bottom = 40.0
[node name="Crosshair" type="TextureRect" parent="." groups=["hud"]]
layout_mode = 0
offset_right = 396.0
offset_bottom = 396.0
texture = ExtResource("1_5bf65")
expand_mode = 3
stretch_mode = 4
[node name="CrosshairCenter" type="TextureRect" parent="." groups=["hud"]]
layout_mode = 0
offset_right = 396.0
offset_bottom = 396.0
scale = Vector2(0.02, 0.02)
texture = ExtResource("2_yawbq")
expand_mode = 3
stretch_mode = 4
[node name="StaminaBar" type="TextureProgressBar" parent="."]
material = SubResource("CanvasItemMaterial_ytfhs")
layout_mode = 0
offset_right = 370.0
offset_bottom = 370.0
scale = Vector2(0.3, 0.3)
value = 49.0
fill_mode = 5
texture_progress = ExtResource("3_spf5y")

View File

@@ -16,6 +16,7 @@ reload_type = 0
bullet = ExtResource("1_y4ehq") bullet = ExtResource("1_y4ehq")
fire_mode = 0 fire_mode = 0
fov_zoom_amt = 0.98 fov_zoom_amt = 0.98
crosshair_radius = 50
ads = false ads = false
recoil_amount = Vector3(0.05, 0.05, 0.05) recoil_amount = Vector3(0.05, 0.05, 0.05)
kick_amount = 0.1 kick_amount = 0.1

View File

@@ -12,6 +12,7 @@ weapon_type = 1
reload_type = 0 reload_type = 0
fire_mode = 1 fire_mode = 1
fov_zoom_amt = 0.98 fov_zoom_amt = 0.98
crosshair_radius = 100
ads = false ads = false
recoil_amount = Vector3(0, 0.05, 0.05) recoil_amount = Vector3(0, 0.05, 0.05)
kick_amount = 0.1 kick_amount = 0.1

View File

@@ -15,6 +15,7 @@ reload_type = 1
bullet = ExtResource("1_gphlx") bullet = ExtResource("1_gphlx")
fire_mode = 1 fire_mode = 1
fov_zoom_amt = 0.98 fov_zoom_amt = 0.98
crosshair_radius = 25
ads = false ads = false
recoil_amount = Vector3(0.2, 0.05, 0.05) recoil_amount = Vector3(0.2, 0.05, 0.05)
kick_amount = 0.1 kick_amount = 0.1

View File

@@ -153,7 +153,6 @@ alignment = 2
layout_mode = 2 layout_mode = 2
theme = ExtResource("1_22trs") theme = ExtResource("1_22trs")
theme_override_constants/outline_size = 15 theme_override_constants/outline_size = 15
text = "XXX"
horizontal_alignment = 2 horizontal_alignment = 2
[node name="Label" type="Label" parent="WobbleItems/GunInfo/VBoxContainer/AmmoCounter"] [node name="Label" type="Label" parent="WobbleItems/GunInfo/VBoxContainer/AmmoCounter"]
@@ -166,5 +165,4 @@ layout_mode = 2
theme = ExtResource("1_22trs") theme = ExtResource("1_22trs")
theme_override_colors/font_shadow_color = Color(0, 0, 0, 1) theme_override_colors/font_shadow_color = Color(0, 0, 0, 1)
theme_override_constants/outline_size = 15 theme_override_constants/outline_size = 15
text = "YYY"
horizontal_alignment = 2 horizontal_alignment = 2

View File

@@ -32,9 +32,15 @@ func _process(delta: float) -> void:
position = hud.viewportCenter position = hud.viewportCenter
var velocity_adjust = clamp(hud.player.velocity.length() * .1,1,3) var velocity_adjust = clamp(hud.player.velocity.length() * .1,1,3)
var crosshair_radius
if hud.player.gun != null:
crosshair_radius = hud.player.gun.weapon_info.crosshair_radius
else:
crosshair_radius = OUTER_RING_START_RADIUS
# Crosshair # Crosshair
outer_ring_radius = lerp(outer_ring_radius,(OUTER_RING_START_RADIUS + crosshair_target) * velocity_adjust,delta * SIZE_SNAP_AMT) outer_ring_radius = lerp(outer_ring_radius,(crosshair_radius + crosshair_target) * velocity_adjust,delta * SIZE_SNAP_AMT)
crosshair_target = lerp(crosshair_target,0.0,delta * SIZE_RETURN_AMT) crosshair_target = lerp(crosshair_target,0.0,delta * SIZE_RETURN_AMT)
#if stamina is 25%, change colors to red #if stamina is 25%, change colors to red

View File

@@ -557,7 +557,6 @@ func ladder_collide():
gravity = level_control.gamemode.gravity gravity = level_control.gamemode.gravity
func wall_jump(): func wall_jump():
print("CAN JUMP? ",can_wall_jump)
if can_wall_jump == true: if can_wall_jump == true:
if wall_ray_1.is_colliding() or wall_ray_2.is_colliding() or wall_ray_3.is_colliding(): if wall_ray_1.is_colliding() or wall_ray_2.is_colliding() or wall_ray_3.is_colliding():
can_wall_jump = false can_wall_jump = false

View File

@@ -17,25 +17,25 @@ func _process(delta):
pass pass
func picked_up(): func picked_up():
var spawn_gun = gun_resource.instantiate() var spawn_gun = gun_resource.instantiate()
var gun_held = false var gun_held = false
#check if gun is owned #check if gun is owned
for i in GameGlobals.held_guns: for i in GameGlobals.held_guns:
if i == gun_resource: if i == gun_resource:
gun_held = true gun_held = true
if spawn_gun.weapon_info.weapon_type == 0: if spawn_gun.weapon_info.weapon_type == 0:
add_ammo(gun_held,spawn_gun.weapon_info.gun_name,spawn_gun.weapon_info.bullet.ammo_type,spawn_gun.weapon_info.bullet.special_bullet_name,spawn_gun.weapon_info.max_ammo,spawn_gun.weapon_info.start_mags) add_ammo(!gun_held,spawn_gun.weapon_info.gun_name,spawn_gun.weapon_info.bullet.ammo_type,spawn_gun.weapon_info.bullet.special_bullet_name,spawn_gun.weapon_info.max_ammo,spawn_gun.weapon_info.start_mags)
if !gun_held: if !gun_held:
GameGlobals.held_guns.append(gun_resource) GameGlobals.held_guns.append(gun_resource)
var instance_gun = gun_resource.instantiate() var instance_gun = gun_resource.instantiate()
var weapon_id = GameGlobals.held_guns.size() - 1 var weapon_id = GameGlobals.held_guns.size() - 1
if level_control.player.gun != null: if level_control.player.gun != null:
level_control.player.gun.anim_player.play("swap_out") level_control.player.gun.anim_player.play("swap_out")
level_control.gun_spawn(weapon_id) level_control.gun_spawn(weapon_id)
SignalBus.emit_signal("weapon_list_changed") SignalBus.emit_signal("weapon_list_changed")
queue_free() queue_free()
func add_ammo(new_gun,gun_name,ammo_type,special_bullet_name,max_ammo,start_mags): func add_ammo(new_gun,gun_name,ammo_type,special_bullet_name,max_ammo,start_mags):
if new_gun: if new_gun:

View File

@@ -9,6 +9,7 @@ class_name weapon_resource
@export var bullet : bullet_resource @export var bullet : bullet_resource
@export_enum("Auto", "Single", "Burst") var fire_mode: int @export_enum("Auto", "Single", "Burst") var fire_mode: int
@export var fov_zoom_amt = .98 @export var fov_zoom_amt = .98
@export var crosshair_radius = 50
@export var ads : bool = false @export var ads : bool = false
@export var recoil_amount : Vector3 = Vector3(.05,.05,.05) @export var recoil_amount : Vector3 = Vector3(.05,.05,.05)
@export var kick_amount : float = .1 @export var kick_amount : float = .1