added a second slot you can equip a weapon to
This commit is contained in:
@ -1,13 +1,15 @@
|
||||
[gd_resource type="Resource" script_class="HeroClass" load_steps=6 format=3 uid="uid://dxonpv8qbyrjy"]
|
||||
[gd_resource type="Resource" script_class="HeroClass" load_steps=7 format=3 uid="uid://dxonpv8qbyrjy"]
|
||||
|
||||
[ext_resource type="Script" path="res://Scripts/Resources/hero_class.gd" id="1_aeu85"]
|
||||
[ext_resource type="Resource" uid="uid://b37r54q84vqoi" path="res://PCs/Universal/ClassCards/RocketLauncher/card_rocket_launcher.tres" id="1_uvyoy"]
|
||||
[ext_resource type="Resource" uid="uid://deer0awg4d18o" path="res://PCs/Universal/ClassCards/Assault/card_assault.tres" id="2_3yr5a"]
|
||||
[ext_resource type="Resource" uid="uid://ckm88acryitl4" path="res://PCs/Universal/ClassCards/Sniper/card_sniper.tres" id="3_wyb0n"]
|
||||
[ext_resource type="Texture2D" uid="uid://bvaif1sfn1ej4" path="res://PCs/Blue/blue_hand.png" id="4_srskc"]
|
||||
[ext_resource type="Texture2D" uid="uid://cnedls3i4gso" path="res://PCs/Blue/blue.png" id="5_qucwv"]
|
||||
|
||||
[resource]
|
||||
script = ExtResource("1_aeu85")
|
||||
hero_name = "Blue"
|
||||
texture = ExtResource("5_qucwv")
|
||||
deck = Array[Resource("res://Scripts/Resources/card.gd")]([ExtResource("1_uvyoy"), ExtResource("2_3yr5a"), ExtResource("3_wyb0n")])
|
||||
hand_texture = ExtResource("4_srskc")
|
||||
deck = Array[Resource("res://Scripts/Resources/card.gd")]([ExtResource("1_uvyoy"), ExtResource("2_3yr5a"), ExtResource("3_wyb0n"), ExtResource("2_3yr5a")])
|
||||
|
BIN
PCs/Blue/blue_hand.png
Normal file
BIN
PCs/Blue/blue_hand.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 880 B |
34
PCs/Blue/blue_hand.png.import
Normal file
34
PCs/Blue/blue_hand.png.import
Normal file
@ -0,0 +1,34 @@
|
||||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://bvaif1sfn1ej4"
|
||||
path="res://.godot/imported/blue_hand.png-a585f2de9387b9676662fa842a34d76a.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://PCs/Blue/blue_hand.png"
|
||||
dest_files=["res://.godot/imported/blue_hand.png-a585f2de9387b9676662fa842a34d76a.ctex"]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=0
|
||||
compress/high_quality=false
|
||||
compress/lossy_quality=0.7
|
||||
compress/hdr_compression=1
|
||||
compress/normal_map=0
|
||||
compress/channel_pack=0
|
||||
mipmaps/generate=false
|
||||
mipmaps/limit=-1
|
||||
roughness/mode=0
|
||||
roughness/src_normal=""
|
||||
process/fix_alpha_border=true
|
||||
process/premult_alpha=false
|
||||
process/normal_map_invert_y=false
|
||||
process/hdr_as_srgb=false
|
||||
process/hdr_clamp_exposure=false
|
||||
process/size_limit=0
|
||||
detect_3d/compress_to=1
|
BIN
PCs/Blue/blue_hand.png~
Normal file
BIN
PCs/Blue/blue_hand.png~
Normal file
Binary file not shown.
After Width: | Height: | Size: 1002 B |
@ -1,13 +1,15 @@
|
||||
[gd_resource type="Resource" script_class="HeroClass" load_steps=6 format=3 uid="uid://ogbkbf1v7j7l"]
|
||||
[gd_resource type="Resource" script_class="HeroClass" load_steps=7 format=3 uid="uid://ogbkbf1v7j7l"]
|
||||
|
||||
[ext_resource type="Script" path="res://Scripts/Resources/hero_class.gd" id="1_cpfpk"]
|
||||
[ext_resource type="Resource" uid="uid://ckm88acryitl4" path="res://PCs/Universal/ClassCards/Sniper/card_sniper.tres" id="1_hv6hq"]
|
||||
[ext_resource type="Resource" uid="uid://b37r54q84vqoi" path="res://PCs/Universal/ClassCards/RocketLauncher/card_rocket_launcher.tres" id="2_jdi4m"]
|
||||
[ext_resource type="Resource" uid="uid://deer0awg4d18o" path="res://PCs/Universal/ClassCards/Assault/card_assault.tres" id="3_f04lj"]
|
||||
[ext_resource type="Texture2D" uid="uid://wknia76l1hqo" path="res://PCs/Green/green_hand.png" id="4_jgbmi"]
|
||||
[ext_resource type="Texture2D" uid="uid://dyqh1uu4pocv1" path="res://PCs/Green/green.png" id="5_vhx4f"]
|
||||
|
||||
[resource]
|
||||
script = ExtResource("1_cpfpk")
|
||||
hero_name = "Green"
|
||||
texture = ExtResource("5_vhx4f")
|
||||
deck = Array[Resource("res://Scripts/Resources/card.gd")]([ExtResource("3_f04lj"), ExtResource("1_hv6hq"), ExtResource("2_jdi4m")])
|
||||
hand_texture = ExtResource("4_jgbmi")
|
||||
deck = Array[Resource("res://Scripts/Resources/card.gd")]([ExtResource("3_f04lj"), ExtResource("1_hv6hq"), ExtResource("2_jdi4m"), ExtResource("3_f04lj")])
|
||||
|
BIN
PCs/Green/green_hand.png
Normal file
BIN
PCs/Green/green_hand.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 880 B |
34
PCs/Green/green_hand.png.import
Normal file
34
PCs/Green/green_hand.png.import
Normal file
@ -0,0 +1,34 @@
|
||||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://wknia76l1hqo"
|
||||
path="res://.godot/imported/green_hand.png-c6f244e5176cca23ecae5c17f92862b8.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://PCs/Green/green_hand.png"
|
||||
dest_files=["res://.godot/imported/green_hand.png-c6f244e5176cca23ecae5c17f92862b8.ctex"]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=0
|
||||
compress/high_quality=false
|
||||
compress/lossy_quality=0.7
|
||||
compress/hdr_compression=1
|
||||
compress/normal_map=0
|
||||
compress/channel_pack=0
|
||||
mipmaps/generate=false
|
||||
mipmaps/limit=-1
|
||||
roughness/mode=0
|
||||
roughness/src_normal=""
|
||||
process/fix_alpha_border=true
|
||||
process/premult_alpha=false
|
||||
process/normal_map_invert_y=false
|
||||
process/hdr_as_srgb=false
|
||||
process/hdr_clamp_exposure=false
|
||||
process/size_limit=0
|
||||
detect_3d/compress_to=1
|
BIN
PCs/Green/green_hand.png~
Normal file
BIN
PCs/Green/green_hand.png~
Normal file
Binary file not shown.
After Width: | Height: | Size: 984 B |
@ -1,13 +1,15 @@
|
||||
[gd_resource type="Resource" script_class="HeroClass" load_steps=6 format=3 uid="uid://b5pc3frhx467q"]
|
||||
[gd_resource type="Resource" script_class="HeroClass" load_steps=7 format=3 uid="uid://b5pc3frhx467q"]
|
||||
|
||||
[ext_resource type="Script" path="res://Scripts/Resources/hero_class.gd" id="1_1wkap"]
|
||||
[ext_resource type="Resource" uid="uid://deer0awg4d18o" path="res://PCs/Universal/ClassCards/Assault/card_assault.tres" id="1_iiksa"]
|
||||
[ext_resource type="Resource" uid="uid://ckm88acryitl4" path="res://PCs/Universal/ClassCards/Sniper/card_sniper.tres" id="2_hkiwr"]
|
||||
[ext_resource type="Resource" uid="uid://b37r54q84vqoi" path="res://PCs/Universal/ClassCards/RocketLauncher/card_rocket_launcher.tres" id="3_ruhqi"]
|
||||
[ext_resource type="Texture2D" uid="uid://ctkixdue3o7ec" path="res://PCs/Red/red_hand.png" id="4_wnhdj"]
|
||||
[ext_resource type="Texture2D" uid="uid://cjqxkraykhxxk" path="res://PCs/Red/red.png" id="5_raux1"]
|
||||
|
||||
[resource]
|
||||
script = ExtResource("1_1wkap")
|
||||
hero_name = "Red"
|
||||
texture = ExtResource("5_raux1")
|
||||
deck = Array[Resource("res://Scripts/Resources/card.gd")]([ExtResource("2_hkiwr"), ExtResource("3_ruhqi"), ExtResource("1_iiksa")])
|
||||
hand_texture = ExtResource("4_wnhdj")
|
||||
deck = Array[Resource("res://Scripts/Resources/card.gd")]([ExtResource("2_hkiwr"), ExtResource("3_ruhqi"), ExtResource("1_iiksa"), ExtResource("1_iiksa")])
|
||||
|
BIN
PCs/Red/red_hand.png
Normal file
BIN
PCs/Red/red_hand.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 878 B |
34
PCs/Red/red_hand.png.import
Normal file
34
PCs/Red/red_hand.png.import
Normal file
@ -0,0 +1,34 @@
|
||||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://ctkixdue3o7ec"
|
||||
path="res://.godot/imported/red_hand.png-501814c1291e980a7fcbb99feaf873f0.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://PCs/Red/red_hand.png"
|
||||
dest_files=["res://.godot/imported/red_hand.png-501814c1291e980a7fcbb99feaf873f0.ctex"]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=0
|
||||
compress/high_quality=false
|
||||
compress/lossy_quality=0.7
|
||||
compress/hdr_compression=1
|
||||
compress/normal_map=0
|
||||
compress/channel_pack=0
|
||||
mipmaps/generate=false
|
||||
mipmaps/limit=-1
|
||||
roughness/mode=0
|
||||
roughness/src_normal=""
|
||||
process/fix_alpha_border=true
|
||||
process/premult_alpha=false
|
||||
process/normal_map_invert_y=false
|
||||
process/hdr_as_srgb=false
|
||||
process/hdr_clamp_exposure=false
|
||||
process/size_limit=0
|
||||
detect_3d/compress_to=1
|
BIN
PCs/Red/red_hand.png~
Normal file
BIN
PCs/Red/red_hand.png~
Normal file
Binary file not shown.
After Width: | Height: | Size: 878 B |
@ -21,7 +21,7 @@ value = 0.2
|
||||
[sub_resource type="Resource" id="Resource_8cirl"]
|
||||
script = ExtResource("1_qt3yl")
|
||||
key = "Energy"
|
||||
value = 2.0
|
||||
value = 1.0
|
||||
|
||||
[resource]
|
||||
script = ExtResource("1_gk542")
|
||||
|
@ -27,8 +27,10 @@ func _process(delta: float) -> void:
|
||||
|
||||
|
||||
func _physics_process(_delta: float) -> void:
|
||||
if trigger_held and time_since_firing >= current_time_between_shots:
|
||||
if trigger_held and current_energy >= energy_cost and time_since_firing >= current_time_between_shots:
|
||||
time_since_firing -= current_time_between_shots
|
||||
current_energy -= energy_cost
|
||||
energy_changed.emit(current_energy)
|
||||
shoot()
|
||||
networked_shoot.rpc()
|
||||
|
||||
|
@ -21,7 +21,7 @@ value = 20.0
|
||||
[sub_resource type="Resource" id="Resource_ogk1x"]
|
||||
script = ExtResource("1_vpmor")
|
||||
key = "Speed Multiplier"
|
||||
value = 2.5
|
||||
value = 3.0
|
||||
|
||||
[sub_resource type="Resource" id="Resource_wdp3h"]
|
||||
script = ExtResource("1_vpmor")
|
||||
@ -31,7 +31,7 @@ value = 4.0
|
||||
[sub_resource type="Resource" id="Resource_d1lvi"]
|
||||
script = ExtResource("1_vpmor")
|
||||
key = "Energy"
|
||||
value = 4.0
|
||||
value = 1.0
|
||||
|
||||
[resource]
|
||||
script = ExtResource("1_630yu")
|
||||
|
@ -53,6 +53,7 @@ func release_trigger():
|
||||
|
||||
func shoot():
|
||||
animator.play("shoot")
|
||||
recharging = false
|
||||
for target in targets:
|
||||
networked_spawn_rocket.rpc(get_tree().root.get_path_to(target), multiplayer.get_unique_id())
|
||||
targets.clear()
|
||||
|
181
PCs/hero.gd
181
PCs/hero.gd
@ -8,23 +8,31 @@ signal died
|
||||
@export var hero_class: HeroClass
|
||||
@export var camera : Camera3D
|
||||
@export var gun_camera : Camera3D
|
||||
@export var left_hand_sprite : Sprite3D
|
||||
@export var left_hand : Node3D
|
||||
@export var right_hand : Node3D
|
||||
@export var right_hand_animator : AnimationPlayer
|
||||
@export var edit_tool : EditTool
|
||||
@export var gauntlet_sprite : Sprite3D
|
||||
@export var sprite : EightDirectionSprite3D
|
||||
@export var hand_sprite : Sprite2D
|
||||
@export var interaction_raycast : RayCast3D
|
||||
@export var inventory : Inventory
|
||||
@export var card : CardInHand
|
||||
@export var gauntlet_card_1 : CardInHand
|
||||
@export var gauntlet_card_2 : CardInHand
|
||||
@export var pause_menu_scene : PackedScene
|
||||
@export var hud : HUD
|
||||
@export var movement : PlayerMovement
|
||||
@export var sprint_zoom_speed := 0.2
|
||||
@export var player_name_tag : Label
|
||||
@export var weapon_swap_timer : Timer
|
||||
|
||||
var equipped_card : Card
|
||||
var offhand_card : Card
|
||||
var weapon : Weapon
|
||||
var offhand_weapon : Weapon
|
||||
var weapons_active = false
|
||||
var paused := false
|
||||
var editing_mode := true
|
||||
var profile : PlayerProfile
|
||||
@ -50,6 +58,7 @@ func _ready() -> void:
|
||||
right_hand_animator.speed_scale = 0
|
||||
camera.make_current()
|
||||
sprite.queue_free()
|
||||
hand_sprite.texture = hero_class.hand_texture
|
||||
player_name_tag.queue_free()
|
||||
else:
|
||||
camera.set_visible(false)
|
||||
@ -103,11 +112,12 @@ func _process(delta: float) -> void:
|
||||
inventory.add(interaction_raycast.get_collider().pick_up())
|
||||
if Input.is_action_just_pressed("Equip In Gauntlet"):
|
||||
equip_weapon()
|
||||
if Input.is_action_just_pressed("Secondary Fire"):
|
||||
swap_weapons()
|
||||
if Input.is_action_just_pressed("Select Next Card"):
|
||||
inventory.increment_selected()
|
||||
if Input.is_action_just_pressed("Select Previous Card"):
|
||||
inventory.decrement_selected()
|
||||
|
||||
if Input.is_action_just_pressed("Primary Fire"):
|
||||
edit_tool.interact_key_held = true
|
||||
if Input.is_action_just_released("Primary Fire"):
|
||||
@ -116,18 +126,22 @@ func _process(delta: float) -> void:
|
||||
weapon.release_trigger()
|
||||
weapon.release_second_trigger()
|
||||
else:
|
||||
if weapon != null and Input.is_action_just_pressed("Primary Fire"):
|
||||
weapon.hold_trigger()
|
||||
if weapon != null and Input.is_action_just_released("Primary Fire"):
|
||||
weapon.release_trigger()
|
||||
if weapon != null and Input.is_action_pressed("Secondary Fire"):
|
||||
weapon.hold_second_trigger()
|
||||
if weapon != null and Input.is_action_just_released("Secondary Fire"):
|
||||
weapon.release_second_trigger()
|
||||
if weapon != null and Input.is_action_pressed("Primary Fire"):
|
||||
movement.can_sprint = false
|
||||
if weapon != null and Input.is_action_pressed("Secondary Fire"):
|
||||
movement.can_sprint = false
|
||||
if weapon and weapons_active:
|
||||
if Input.is_action_just_pressed("Primary Fire"):
|
||||
weapon.hold_trigger()
|
||||
if Input.is_action_just_released("Primary Fire"):
|
||||
weapon.release_trigger()
|
||||
if Input.is_action_pressed("Secondary Fire"):
|
||||
weapon.hold_second_trigger()
|
||||
if Input.is_action_just_released("Secondary Fire"):
|
||||
weapon.release_second_trigger()
|
||||
if Input.is_action_pressed("Primary Fire"):
|
||||
movement.can_sprint = false
|
||||
if Input.is_action_pressed("Secondary Fire"):
|
||||
movement.can_sprint = false
|
||||
if Input.is_action_just_pressed("Equip In Gauntlet"):
|
||||
if weapon and offhand_weapon:
|
||||
swap_weapons()
|
||||
|
||||
if movement.sprinting:
|
||||
movement.zoom_factor -= sprint_zoom_speed * delta
|
||||
@ -174,35 +188,49 @@ func pause():
|
||||
|
||||
|
||||
func enter_editing_mode(value):
|
||||
gauntlet_sprite.set_visible(true)
|
||||
weapons_active = false
|
||||
hud.set_wave_count(value + 1)
|
||||
hud.set_energy_visible(false)
|
||||
hud.set_offhand_energy_visible(false)
|
||||
editing_mode = true
|
||||
edit_tool.enabled = true
|
||||
check_left_hand_valid()
|
||||
if weapon != null:
|
||||
left_hand.set_visible(true)
|
||||
if weapon:
|
||||
weapon.release_trigger()
|
||||
weapon.set_visible(false)
|
||||
|
||||
|
||||
func exit_editing_mode(value):
|
||||
gauntlet_sprite.set_visible(false)
|
||||
weapons_active = false
|
||||
hud.set_wave_count(value)
|
||||
hud.set_energy_visible(true)
|
||||
if !weapon and offhand_weapon:
|
||||
swap_weapons()
|
||||
if weapon:
|
||||
hud.set_energy_visible(true)
|
||||
#weapon.set_visible(false)
|
||||
weapon.current_energy = weapon.max_energy
|
||||
weapon.energy_changed.emit(weapon.current_energy)
|
||||
if offhand_weapon:
|
||||
hud.set_offhand_energy_visible(true)
|
||||
offhand_weapon.current_energy = offhand_weapon.max_energy
|
||||
offhand_weapon.energy_changed.emit(offhand_weapon.current_energy)
|
||||
edit_tool.enabled = false
|
||||
edit_tool.delete_tower_preview()
|
||||
left_hand.set_visible(false)
|
||||
editing_mode = false
|
||||
if weapon:
|
||||
weapon.current_energy = weapon.max_energy
|
||||
weapon.energy_changed.emit(weapon.current_energy)
|
||||
weapon_swap_timer.start()
|
||||
|
||||
|
||||
func check_left_hand_valid():
|
||||
if !editing_mode:
|
||||
return
|
||||
if inventory.contents.size() == 0:
|
||||
left_hand.set_visible(false)
|
||||
left_hand_sprite.set_visible(false)
|
||||
#gauntlet.texture.region = Rect2(64, 0, 64, 64)
|
||||
else:
|
||||
left_hand.set_visible(true)
|
||||
left_hand_sprite.set_visible(true)
|
||||
#gauntlet.texture.region = Rect2(0, 0, 64, 64)
|
||||
card.set_card(inventory.selected_item)
|
||||
|
||||
@ -216,23 +244,107 @@ func equip_weapon():
|
||||
networked_equip_weapon.rpc(Data.cards.find(equipped_card))
|
||||
weapon = equipped_card.weapon_scene.instantiate()
|
||||
weapon.energy_changed.connect(hud.set_weapon_energy)
|
||||
weapon.name = "weapon"
|
||||
#weapon.name = "weapon"
|
||||
weapon.set_multiplayer_authority(multiplayer.get_unique_id())
|
||||
gauntlet_sprite.set_visible(false)
|
||||
#gauntlet_sprite.set_visible(false)
|
||||
gauntlet_card_1.set_card(equipped_card)
|
||||
gauntlet_card_1.view_weapon()
|
||||
gauntlet_card_1.set_visible(true)
|
||||
weapon.set_hero(self)
|
||||
weapon.set_visible(false)
|
||||
right_hand.add_child(weapon)
|
||||
check_left_hand_valid()
|
||||
|
||||
|
||||
func equip_in_offhand():
|
||||
if offhand_weapon != null:
|
||||
unequip_weapon()
|
||||
return
|
||||
if inventory.contents.size() > 0:
|
||||
offhand_card = inventory.remove()
|
||||
networked_equip_offhand_weapon.rpc(Data.cards.find(offhand_card))
|
||||
offhand_weapon = offhand_card.weapon_scene.instantiate()
|
||||
offhand_weapon.energy_changed.connect(hud.set_weapon_energy)
|
||||
#offhand_weapon.name = "weapon"
|
||||
offhand_weapon.set_multiplayer_authority(multiplayer.get_unique_id())
|
||||
#gauntlet_sprite.set_visible(false)
|
||||
gauntlet_card_2.set_card(offhand_card)
|
||||
gauntlet_card_2.view_weapon()
|
||||
gauntlet_card_2.set_visible(true)
|
||||
offhand_weapon.set_hero(self)
|
||||
offhand_weapon.set_visible(false)
|
||||
right_hand.add_child(offhand_weapon)
|
||||
check_left_hand_valid()
|
||||
|
||||
|
||||
func swap_weapons():
|
||||
if !editing_mode:
|
||||
weapons_active = false
|
||||
var temp = offhand_weapon
|
||||
var temp_card = offhand_card
|
||||
if weapon:
|
||||
offhand_weapon = weapon
|
||||
offhand_card = equipped_card
|
||||
offhand_weapon.set_visible(false)
|
||||
offhand_weapon.energy_changed.disconnect(hud.set_weapon_energy)
|
||||
offhand_weapon.energy_changed.connect(hud.set_offhand_energy)
|
||||
offhand_weapon.energy_changed.emit(offhand_weapon.current_energy)
|
||||
offhand_weapon.release_trigger()
|
||||
offhand_weapon.release_second_trigger()
|
||||
gauntlet_card_2.set_card(offhand_card)
|
||||
gauntlet_card_2.view_weapon()
|
||||
gauntlet_card_2.set_visible(true)
|
||||
else:
|
||||
offhand_weapon = null
|
||||
offhand_card = null
|
||||
gauntlet_card_2.set_visible(false)
|
||||
if temp:
|
||||
weapon = temp
|
||||
equipped_card = temp_card
|
||||
weapon.energy_changed.disconnect(hud.set_offhand_energy)
|
||||
weapon.energy_changed.connect(hud.set_weapon_energy)
|
||||
weapon.energy_changed.emit(weapon.current_energy)
|
||||
weapon.release_trigger()
|
||||
weapon.release_second_trigger()
|
||||
gauntlet_card_1.set_card(equipped_card)
|
||||
gauntlet_card_1.view_weapon()
|
||||
gauntlet_card_1.set_visible(true)
|
||||
else:
|
||||
weapon = null
|
||||
equipped_card = null
|
||||
gauntlet_card_1.set_visible(false)
|
||||
if !editing_mode:
|
||||
weapon_swap_timer.start()
|
||||
|
||||
|
||||
func _on_timer_timeout() -> void:
|
||||
weapons_active = true
|
||||
if weapon:
|
||||
weapon.set_visible(true)
|
||||
|
||||
|
||||
func unequip_weapon():
|
||||
networked_unequip_weapon.rpc()
|
||||
gauntlet_sprite.set_visible(true)
|
||||
gauntlet_card_1.set_visible(false)
|
||||
#gauntlet_sprite.set_visible(true)
|
||||
weapon.queue_free()
|
||||
weapon = null
|
||||
inventory.add(equipped_card)
|
||||
equipped_card = null
|
||||
check_left_hand_valid()
|
||||
|
||||
|
||||
func unequip_offhand_weapon():
|
||||
networked_unequip_offhand_weapon.rpc()
|
||||
gauntlet_card_2.set_visible(false)
|
||||
#gauntlet_sprite.set_visible(true)
|
||||
offhand_weapon.queue_free()
|
||||
offhand_weapon = null
|
||||
inventory.add(offhand_card)
|
||||
offhand_card = null
|
||||
check_left_hand_valid()
|
||||
|
||||
|
||||
#MULTIPLAYER NETWORKED FUNCTIONS
|
||||
@rpc("reliable")
|
||||
func networked_set_ready_state(state: bool):
|
||||
@ -244,13 +356,32 @@ func networked_equip_weapon(card_index):
|
||||
equipped_card = Data.cards[card_index]
|
||||
weapon = equipped_card.weapon_scene.instantiate()
|
||||
weapon.set_multiplayer_authority(multiplayer.get_remote_sender_id())
|
||||
weapon.name = "weapon"
|
||||
#weapon.name = "weapon"
|
||||
weapon.set_hero(self)
|
||||
right_hand.add_child(weapon)
|
||||
|
||||
|
||||
@rpc("reliable")
|
||||
func networked_equip_offhand_weapon(card_index):
|
||||
equipped_card = Data.cards[card_index]
|
||||
offhand_weapon = equipped_card.weapon_scene.instantiate()
|
||||
offhand_weapon.set_multiplayer_authority(multiplayer.get_remote_sender_id())
|
||||
#weapon.name = "weapon"
|
||||
offhand_weapon.set_hero(self)
|
||||
right_hand.add_child(offhand_weapon)
|
||||
|
||||
|
||||
@rpc("reliable")
|
||||
func networked_unequip_weapon():
|
||||
weapon.queue_free()
|
||||
weapon = null
|
||||
inventory.add(equipped_card)
|
||||
equipped_card = null
|
||||
|
||||
|
||||
@rpc("reliable")
|
||||
func networked_unequip_offhand_weapon():
|
||||
offhand_weapon.queue_free()
|
||||
offhand_weapon = null
|
||||
inventory.add(equipped_card)
|
||||
offhand_card = null
|
||||
|
116
PCs/hero.tscn
116
PCs/hero.tscn
@ -1,4 +1,4 @@
|
||||
[gd_scene load_steps=33 format=3 uid="uid://dxgxbtf68lcv5"]
|
||||
[gd_scene load_steps=36 format=3 uid="uid://dxgxbtf68lcv5"]
|
||||
|
||||
[ext_resource type="Script" path="res://PCs/hero.gd" id="1_pihpe"]
|
||||
[ext_resource type="Resource" uid="uid://b5pc3frhx467q" path="res://PCs/Red/red.tres" id="2_dbyo0"]
|
||||
@ -11,6 +11,7 @@
|
||||
[ext_resource type="Script" path="res://Scripts/inventory.gd" id="6_cf5ap"]
|
||||
[ext_resource type="Texture2D" uid="uid://cjqxkraykhxxk" path="res://PCs/Red/red.png" id="6_yyp8i"]
|
||||
[ext_resource type="Script" path="res://Scripts/HUD.gd" id="8_yl6ka"]
|
||||
[ext_resource type="Texture2D" uid="uid://ctkixdue3o7ec" path="res://PCs/Red/red_hand.png" id="9_gxh2h"]
|
||||
[ext_resource type="Script" path="res://Scripts/on_top_camera.gd" id="11_4sdwe"]
|
||||
[ext_resource type="Script" path="res://Scripts/minimap_cam.gd" id="12_3hpi3"]
|
||||
[ext_resource type="Texture2D" uid="uid://b6iego7256jf2" path="res://Assets/Textures/wavecounter.png" id="14_l34nu"]
|
||||
@ -24,11 +25,6 @@
|
||||
|
||||
[sub_resource type="CapsuleShape3D" id="CapsuleShape3D_jbu13"]
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_4d5kf"]
|
||||
resource_local_to_scene = true
|
||||
atlas = ExtResource("6_yyp8i")
|
||||
region = Rect2(0, 0, 96, 96)
|
||||
|
||||
[sub_resource type="Environment" id="Environment_ekmug"]
|
||||
|
||||
[sub_resource type="Animation" id="Animation_2q50p"]
|
||||
@ -51,10 +47,21 @@ _data = {
|
||||
[sub_resource type="ViewportTexture" id="ViewportTexture_8f12g"]
|
||||
viewport_path = NodePath("SubViewport/Head2/LeftHand/SubViewport")
|
||||
|
||||
[sub_resource type="ViewportTexture" id="ViewportTexture_v8f6r"]
|
||||
viewport_path = NodePath("SubViewport/Head2/LeftHand/SubViewport2")
|
||||
|
||||
[sub_resource type="ViewportTexture" id="ViewportTexture_xme80"]
|
||||
viewport_path = NodePath("SubViewport/Head2/LeftHand/SubViewport3")
|
||||
|
||||
[sub_resource type="Environment" id="Environment_cilxe"]
|
||||
background_mode = 1
|
||||
background_color = Color(0.282353, 0.615686, 0.278431, 1)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_4tsug"]
|
||||
resource_local_to_scene = true
|
||||
atlas = ExtResource("6_yyp8i")
|
||||
region = Rect2(0, 0, 96, 96)
|
||||
|
||||
[sub_resource type="ViewportTexture" id="ViewportTexture_m3ots"]
|
||||
viewport_path = NodePath("Nametag")
|
||||
|
||||
@ -79,26 +86,31 @@ shader_parameter/len = 0.015
|
||||
shader_parameter/spacing = 0.008
|
||||
shader_parameter/spread = 1.0
|
||||
|
||||
[node name="Hero" type="CharacterBody3D" node_paths=PackedStringArray("camera", "gun_camera", "left_hand", "right_hand", "right_hand_animator", "edit_tool", "gauntlet_sprite", "sprite", "interaction_raycast", "inventory", "card", "hud", "movement", "player_name_tag")]
|
||||
[node name="Hero" type="CharacterBody3D" node_paths=PackedStringArray("camera", "gun_camera", "left_hand_sprite", "left_hand", "right_hand", "right_hand_animator", "edit_tool", "gauntlet_sprite", "sprite", "hand_sprite", "interaction_raycast", "inventory", "card", "gauntlet_card_1", "gauntlet_card_2", "hud", "movement", "player_name_tag", "weapon_swap_timer")]
|
||||
collision_layer = 2
|
||||
collision_mask = 37
|
||||
script = ExtResource("1_pihpe")
|
||||
hero_class = ExtResource("2_dbyo0")
|
||||
camera = NodePath("ViewMovement/Head")
|
||||
gun_camera = NodePath("SubViewport/Head2")
|
||||
left_hand_sprite = NodePath("SubViewport/Head2/LeftHand/Sprite3D")
|
||||
left_hand = NodePath("SubViewport/Head2/LeftHand")
|
||||
right_hand = NodePath("SubViewport/Head2/RightHand")
|
||||
right_hand_animator = NodePath("SubViewport/Head2/RightHand/AnimationPlayer")
|
||||
edit_tool = NodePath("ViewMovement/Head/EditTool")
|
||||
gauntlet_sprite = NodePath("SubViewport/Head2/RightHand/Gauntlet")
|
||||
sprite = NodePath("EightDirectionSprite")
|
||||
hand_sprite = NodePath("SubViewport/Head2/LeftHand/SubViewport/Sprite2D")
|
||||
interaction_raycast = NodePath("ViewMovement/Head/RayCast3D")
|
||||
inventory = NodePath("Inventory")
|
||||
card = NodePath("SubViewport/Head2/LeftHand/SubViewport/Node2D")
|
||||
gauntlet_card_1 = NodePath("SubViewport/Head2/LeftHand/SubViewport2/Node2D")
|
||||
gauntlet_card_2 = NodePath("SubViewport/Head2/LeftHand/SubViewport3/Node2D")
|
||||
pause_menu_scene = ExtResource("3_avnsx")
|
||||
hud = NodePath("HUD")
|
||||
movement = NodePath("PlayerMovement")
|
||||
player_name_tag = NodePath("Nametag/Label")
|
||||
weapon_swap_timer = NodePath("Timer")
|
||||
|
||||
[node name="CollisionShape3D" type="CollisionShape3D" parent="."]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1, 0)
|
||||
@ -128,10 +140,6 @@ collision_mask = 24
|
||||
target_position = Vector3(0, 0, -100)
|
||||
collision_mask = 65535
|
||||
|
||||
[node name="EightDirectionSprite" parent="." instance=ExtResource("2_ib0t5")]
|
||||
transform = Transform3D(2, 0, 0, 0, 2, 0, 0, 0, 2, 0, 0.915529, 0)
|
||||
texture = SubResource("AtlasTexture_4d5kf")
|
||||
|
||||
[node name="SubViewport" type="SubViewport" parent="."]
|
||||
transparent_bg = true
|
||||
size = Vector2i(1920, 1080)
|
||||
@ -167,12 +175,46 @@ render_target_update_mode = 4
|
||||
|
||||
[node name="Node2D" parent="SubViewport/Head2/LeftHand/SubViewport" instance=ExtResource("4_mwtvp")]
|
||||
|
||||
[node name="Sprite2D" type="Sprite2D" parent="SubViewport/Head2/LeftHand/SubViewport"]
|
||||
texture_filter = 1
|
||||
position = Vector2(256, 256)
|
||||
scale = Vector2(8, 8)
|
||||
texture = ExtResource("9_gxh2h")
|
||||
|
||||
[node name="SubViewport2" type="SubViewport" parent="SubViewport/Head2/LeftHand"]
|
||||
transparent_bg = true
|
||||
render_target_update_mode = 4
|
||||
|
||||
[node name="Node2D" parent="SubViewport/Head2/LeftHand/SubViewport2" instance=ExtResource("4_mwtvp")]
|
||||
visible = false
|
||||
|
||||
[node name="SubViewport3" type="SubViewport" parent="SubViewport/Head2/LeftHand"]
|
||||
transparent_bg = true
|
||||
render_target_update_mode = 4
|
||||
|
||||
[node name="Node2D" parent="SubViewport/Head2/LeftHand/SubViewport3" instance=ExtResource("4_mwtvp")]
|
||||
visible = false
|
||||
|
||||
[node name="Sprite3D" type="Sprite3D" parent="SubViewport/Head2/LeftHand"]
|
||||
transform = Transform3D(0.45, 0, 0, 0, 0.45, 0, 0, 0, 0.45, 0.2, 0.19, 0)
|
||||
layers = 2
|
||||
texture_filter = 0
|
||||
texture = SubResource("ViewportTexture_8f12g")
|
||||
|
||||
[node name="Sprite3D2" type="Sprite3D" parent="SubViewport/Head2/LeftHand"]
|
||||
transform = Transform3D(0.35, 0, 0, 0, 0.35, 0, 0, 0, 0.35, 4.74969, -0.0599999, 0.0158834)
|
||||
layers = 2
|
||||
sorting_offset = 1.0
|
||||
texture_filter = 0
|
||||
texture = SubResource("ViewportTexture_v8f6r")
|
||||
|
||||
[node name="Sprite3D3" type="Sprite3D" parent="SubViewport/Head2/LeftHand"]
|
||||
transform = Transform3D(0.35, 0, 0, 0, 0.35, 0, 0, 0, 0.35, 6.03, -0.0599999, 0.0158834)
|
||||
layers = 2
|
||||
sorting_offset = 1.0
|
||||
texture_filter = 0
|
||||
texture = SubResource("ViewportTexture_xme80")
|
||||
|
||||
[node name="MiniMapViewport" type="SubViewport" parent="."]
|
||||
size = Vector2i(256, 256)
|
||||
render_target_update_mode = 4
|
||||
@ -186,12 +228,6 @@ size = 15.0
|
||||
script = ExtResource("12_3hpi3")
|
||||
anchor = NodePath("../..")
|
||||
|
||||
[node name="MinimapIcon" type="Sprite3D" parent="."]
|
||||
transform = Transform3D(4, 0, 0, 0, 0.0698095, 3.99939, 0, -3.99939, 0.0698095, 0, 2.86288, 0)
|
||||
layers = 4
|
||||
texture_filter = 0
|
||||
texture = ExtResource("15_nhlam")
|
||||
|
||||
[node name="Nametag" type="SubViewport" parent="."]
|
||||
transparent_bg = true
|
||||
size = Vector2i(300, 40)
|
||||
@ -207,6 +243,16 @@ text = "QUITE LONG PLAYER NAME"
|
||||
horizontal_alignment = 1
|
||||
vertical_alignment = 1
|
||||
|
||||
[node name="EightDirectionSprite" parent="." instance=ExtResource("2_ib0t5")]
|
||||
transform = Transform3D(2, 0, 0, 0, 2, 0, 0, 0, 2, 0, 0.915529, 0)
|
||||
texture = SubResource("AtlasTexture_4tsug")
|
||||
|
||||
[node name="MinimapIcon" type="Sprite3D" parent="."]
|
||||
transform = Transform3D(4, 0, 0, 0, 0.0698095, 3.99939, 0, -3.99939, 0.0698095, 0, 2.86288, 0)
|
||||
layers = 4
|
||||
texture_filter = 0
|
||||
texture = ExtResource("15_nhlam")
|
||||
|
||||
[node name="Sprite3D" type="Sprite3D" parent="."]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 2, 0)
|
||||
layers = 5
|
||||
@ -225,7 +271,7 @@ script = ExtResource("20_cfhw8")
|
||||
player = NodePath("..")
|
||||
head = NodePath("../ViewMovement")
|
||||
|
||||
[node name="HUD" type="CanvasLayer" parent="." node_paths=PackedStringArray("wave_count", "lives_count", "enemy_count", "currency_count", "crosshair", "minimap", "minimap_cam", "minimap_viewport", "fps_label", "hover_text", "enemy_sprites", "enemy_counts", "weapon_energy_bar")]
|
||||
[node name="HUD" type="CanvasLayer" parent="." node_paths=PackedStringArray("wave_count", "lives_count", "enemy_count", "currency_count", "crosshair", "minimap", "minimap_cam", "minimap_viewport", "fps_label", "hover_text", "enemy_sprites", "enemy_counts", "weapon_energy_bar", "offhand_energy_bar")]
|
||||
script = ExtResource("8_yl6ka")
|
||||
wave_count = NodePath("WaveCount")
|
||||
lives_count = NodePath("LivesCount")
|
||||
@ -239,7 +285,8 @@ fps_label = NodePath("Label")
|
||||
hover_text = NodePath("Label2")
|
||||
enemy_sprites = [NodePath("TextureRect4/TextureRect"), NodePath("TextureRect4/TextureRect2"), NodePath("TextureRect4/TextureRect3"), NodePath("TextureRect4/TextureRect4"), NodePath("TextureRect4/TextureRect5")]
|
||||
enemy_counts = [NodePath("TextureRect4/TextureRect/Label"), NodePath("TextureRect4/TextureRect2/Label2"), NodePath("TextureRect4/TextureRect3/Label3"), NodePath("TextureRect4/TextureRect4/Label4"), NodePath("TextureRect4/TextureRect5/Label5")]
|
||||
weapon_energy_bar = NodePath("TextureProgressBar")
|
||||
weapon_energy_bar = NodePath("PrimaryEnergyBar")
|
||||
offhand_energy_bar = NodePath("OffhandEnergyBar")
|
||||
|
||||
[node name="EnemyCount" type="Label" parent="HUD"]
|
||||
visible = false
|
||||
@ -501,9 +548,9 @@ grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
mouse_filter = 2
|
||||
|
||||
[node name="TextureProgressBar" type="TextureProgressBar" parent="HUD"]
|
||||
[node name="PrimaryEnergyBar" type="TextureProgressBar" parent="HUD"]
|
||||
visible = false
|
||||
anchors_preset = -1
|
||||
anchors_preset = 3
|
||||
anchor_left = 1.0
|
||||
anchor_top = 1.0
|
||||
anchor_right = 1.0
|
||||
@ -520,3 +567,30 @@ texture_under = ExtResource("21_apps2")
|
||||
texture_progress = ExtResource("21_apps2")
|
||||
tint_under = Color(0, 1, 1, 0.168627)
|
||||
tint_progress = Color(0, 1, 1, 1)
|
||||
|
||||
[node name="OffhandEnergyBar" type="TextureProgressBar" parent="HUD"]
|
||||
visible = false
|
||||
anchors_preset = 3
|
||||
anchor_left = 1.0
|
||||
anchor_top = 1.0
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
offset_left = -379.0
|
||||
offset_top = -50.0
|
||||
offset_bottom = -40.0
|
||||
grow_horizontal = 0
|
||||
grow_vertical = 0
|
||||
step = 0.01
|
||||
value = 100.0
|
||||
fill_mode = 1
|
||||
nine_patch_stretch = true
|
||||
texture_under = ExtResource("21_apps2")
|
||||
texture_progress = ExtResource("21_apps2")
|
||||
tint_under = Color(0, 1, 1, 0.168627)
|
||||
tint_progress = Color(0, 1, 1, 1)
|
||||
|
||||
[node name="Timer" type="Timer" parent="."]
|
||||
wait_time = 0.9
|
||||
one_shot = true
|
||||
|
||||
[connection signal="timeout" from="Timer" to="." method="_on_timer_timeout"]
|
||||
|
@ -10,9 +10,9 @@ class_name ViewMovement
|
||||
@export_category("Tilting")
|
||||
@export var enable_tilt := true
|
||||
|
||||
var head_bob_amplitude := 0.002
|
||||
var head_bob_amplitude := 0.001
|
||||
var head_bob_frequency := 0.015
|
||||
var tilt_amount := 0.04
|
||||
var tilt_amount := 0.03
|
||||
var head_bob_start_position : Vector3
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user