added a second slot you can equip a weapon to

This commit is contained in:
Lexi Quinn 2023-11-28 16:52:15 +11:00
parent 66f7131c1b
commit d5d832f3f2
45 changed files with 722 additions and 104 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 KiB

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.9 KiB

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 939 B

Binary file not shown.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

After

Width:  |  Height:  |  Size: 1015 B

1
Assets/Textures/icon.svg Normal file
View File

@ -0,0 +1 @@
<svg height="128" width="128" xmlns="http://www.w3.org/2000/svg"><g transform="translate(32 32)"><path d="m-16-32c-8.86 0-16 7.13-16 15.99v95.98c0 8.86 7.13 15.99 16 15.99h96c8.86 0 16-7.13 16-15.99v-95.98c0-8.85-7.14-15.99-16-15.99z" fill="#363d52"/><path d="m-16-32c-8.86 0-16 7.13-16 15.99v95.98c0 8.86 7.13 15.99 16 15.99h96c8.86 0 16-7.13 16-15.99v-95.98c0-8.85-7.14-15.99-16-15.99zm0 4h96c6.64 0 12 5.35 12 11.99v95.98c0 6.64-5.35 11.99-12 11.99h-96c-6.64 0-12-5.35-12-11.99v-95.98c0-6.64 5.36-11.99 12-11.99z" fill-opacity=".4"/></g><g stroke-width="9.92746" transform="matrix(.10073078 0 0 .10073078 12.425923 2.256365)"><path d="m0 0s-.325 1.994-.515 1.976l-36.182-3.491c-2.879-.278-5.115-2.574-5.317-5.459l-.994-14.247-27.992-1.997-1.904 12.912c-.424 2.872-2.932 5.037-5.835 5.037h-38.188c-2.902 0-5.41-2.165-5.834-5.037l-1.905-12.912-27.992 1.997-.994 14.247c-.202 2.886-2.438 5.182-5.317 5.46l-36.2 3.49c-.187.018-.324-1.978-.511-1.978l-.049-7.83 30.658-4.944 1.004-14.374c.203-2.91 2.551-5.263 5.463-5.472l38.551-2.75c.146-.01.29-.016.434-.016 2.897 0 5.401 2.166 5.825 5.038l1.959 13.286h28.005l1.959-13.286c.423-2.871 2.93-5.037 5.831-5.037.142 0 .284.005.423.015l38.556 2.75c2.911.209 5.26 2.562 5.463 5.472l1.003 14.374 30.645 4.966z" fill="#fff" transform="matrix(4.162611 0 0 -4.162611 919.24059 771.67186)"/><path d="m0 0v-47.514-6.035-5.492c.108-.001.216-.005.323-.015l36.196-3.49c1.896-.183 3.382-1.709 3.514-3.609l1.116-15.978 31.574-2.253 2.175 14.747c.282 1.912 1.922 3.329 3.856 3.329h38.188c1.933 0 3.573-1.417 3.855-3.329l2.175-14.747 31.575 2.253 1.115 15.978c.133 1.9 1.618 3.425 3.514 3.609l36.182 3.49c.107.01.214.014.322.015v4.711l.015.005v54.325c5.09692 6.4164715 9.92323 13.494208 13.621 19.449-5.651 9.62-12.575 18.217-19.976 26.182-6.864-3.455-13.531-7.369-19.828-11.534-3.151 3.132-6.7 5.694-10.186 8.372-3.425 2.751-7.285 4.768-10.946 7.118 1.09 8.117 1.629 16.108 1.846 24.448-9.446 4.754-19.519 7.906-29.708 10.17-4.068-6.837-7.788-14.241-11.028-21.479-3.842.642-7.702.88-11.567.926v.006c-.027 0-.052-.006-.075-.006-.024 0-.049.006-.073.006v-.006c-3.872-.046-7.729-.284-11.572-.926-3.238 7.238-6.956 14.642-11.03 21.479-10.184-2.264-20.258-5.416-29.703-10.17.216-8.34.755-16.331 1.848-24.448-3.668-2.35-7.523-4.367-10.949-7.118-3.481-2.678-7.036-5.24-10.188-8.372-6.297 4.165-12.962 8.079-19.828 11.534-7.401-7.965-14.321-16.562-19.974-26.182 4.4426579-6.973692 9.2079702-13.9828876 13.621-19.449z" fill="#478cbf" transform="matrix(4.162611 0 0 -4.162611 104.69892 525.90697)"/><path d="m0 0-1.121-16.063c-.135-1.936-1.675-3.477-3.611-3.616l-38.555-2.751c-.094-.007-.188-.01-.281-.01-1.916 0-3.569 1.406-3.852 3.33l-2.211 14.994h-31.459l-2.211-14.994c-.297-2.018-2.101-3.469-4.133-3.32l-38.555 2.751c-1.936.139-3.476 1.68-3.611 3.616l-1.121 16.063-32.547 3.138c.015-3.498.06-7.33.06-8.093 0-34.374 43.605-50.896 97.781-51.086h.066.067c54.176.19 97.766 16.712 97.766 51.086 0 .777.047 4.593.063 8.093z" fill="#478cbf" transform="matrix(4.162611 0 0 -4.162611 784.07144 817.24284)"/><path d="m0 0c0-12.052-9.765-21.815-21.813-21.815-12.042 0-21.81 9.763-21.81 21.815 0 12.044 9.768 21.802 21.81 21.802 12.048 0 21.813-9.758 21.813-21.802" fill="#fff" transform="matrix(4.162611 0 0 -4.162611 389.21484 625.67104)"/><path d="m0 0c0-7.994-6.479-14.473-14.479-14.473-7.996 0-14.479 6.479-14.479 14.473s6.483 14.479 14.479 14.479c8 0 14.479-6.485 14.479-14.479" fill="#414042" transform="matrix(4.162611 0 0 -4.162611 367.36686 631.05679)"/><path d="m0 0c-3.878 0-7.021 2.858-7.021 6.381v20.081c0 3.52 3.143 6.381 7.021 6.381s7.028-2.861 7.028-6.381v-20.081c0-3.523-3.15-6.381-7.028-6.381" fill="#fff" transform="matrix(4.162611 0 0 -4.162611 511.99336 724.73954)"/><path d="m0 0c0-12.052 9.765-21.815 21.815-21.815 12.041 0 21.808 9.763 21.808 21.815 0 12.044-9.767 21.802-21.808 21.802-12.05 0-21.815-9.758-21.815-21.802" fill="#fff" transform="matrix(4.162611 0 0 -4.162611 634.78706 625.67104)"/><path d="m0 0c0-7.994 6.477-14.473 14.471-14.473 8.002 0 14.479 6.479 14.479 14.473s-6.477 14.479-14.479 14.479c-7.994 0-14.471-6.485-14.471-14.479" fill="#414042" transform="matrix(4.162611 0 0 -4.162611 656.64056 631.05679)"/></g></svg>

After

Width:  |  Height:  |  Size: 4.1 KiB

View File

@ -0,0 +1,37 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://d0qb8mrnp0swk"
path="res://.godot/imported/icon.svg-8c0dfe7377b8350deb604d8d5f0f7e7b.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://Assets/Textures/icon.svg"
dest_files=["res://.godot/imported/icon.svg-8c0dfe7377b8350deb604d8d5f0f7e7b.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
svg/scale=1.0
editor/scale_with_editor_scale=false
editor/convert_colors_with_editor_theme=false

Binary file not shown.

Before

Width:  |  Height:  |  Size: 641 B

After

Width:  |  Height:  |  Size: 534 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 641 B

View File

@ -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

Binary file not shown.

After

Width:  |  Height:  |  Size: 880 B

View 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

Binary file not shown.

After

Width:  |  Height:  |  Size: 1002 B

View File

@ -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

Binary file not shown.

After

Width:  |  Height:  |  Size: 880 B

View 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

Binary file not shown.

After

Width:  |  Height:  |  Size: 984 B

View File

@ -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

Binary file not shown.

After

Width:  |  Height:  |  Size: 878 B

View 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

Binary file not shown.

After

Width:  |  Height:  |  Size: 878 B

View File

@ -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")

View File

@ -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()

View File

@ -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")

View File

@ -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()

View File

@ -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

View File

@ -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"]

View File

@ -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

View File

@ -39,9 +39,10 @@ _data = {
"shoot": SubResource("Animation_0rgpe")
}
[node name="Weapon" type="Node3D" node_paths=PackedStringArray("animator")]
[node name="Weapon" type="Node3D" node_paths=PackedStringArray("animator", "recharge_timer")]
script = ExtResource("1_yo2gh")
animator = NodePath("AnimationPlayer")
recharge_timer = NodePath("Timer")
[node name="Sprite3D" type="Sprite3D" parent="."]
layers = 2
@ -52,3 +53,9 @@ texture_filter = 0
libraries = {
"": SubResource("AnimationLibrary_fs82p")
}
[node name="Timer" type="Timer" parent="."]
wait_time = 3.0
one_shot = true
[connection signal="timeout" from="Timer" to="." method="_on_timer_timeout"]

View File

@ -6,6 +6,7 @@
[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_36ot1"]
transparency = 1
depth_draw_mode = 1
[node name="EditTool" type="Node3D" node_paths=PackedStringArray("ray", "wall_preview", "progress_bar")]
script = ExtResource("1_yf8lt")

View File

@ -1,4 +1,4 @@
[gd_scene load_steps=6 format=3 uid="uid://ddbbwx0yy16lh"]
[gd_scene load_steps=10 format=3 uid="uid://ddbbwx0yy16lh"]
[ext_resource type="Script" path="res://Scripts/tower_base.gd" id="1_tghvd"]
[ext_resource type="Script" path="res://Scripts/inventory.gd" id="2_p5c7g"]
@ -8,13 +8,33 @@
[sub_resource type="BoxShape3D" id="BoxShape3D_lc72v"]
size = Vector3(1.1, 1.1, 1.1)
[node name="Node3D" type="StaticBody3D" node_paths=PackedStringArray("inventory", "block", "collider", "minimap_icon")]
[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_o3uwr"]
albedo_color = Color(0.462745, 0.439216, 0.415686, 1)
[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_1i074"]
albedo_color = Color(0.462745, 0.439216, 0.415686, 1)
[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_jt61s"]
albedo_color = Color(0.462745, 0.439216, 0.415686, 1)
[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_t32n1"]
albedo_color = Color(0.462745, 0.439216, 0.415686, 1)
[node name="Node3D" type="StaticBody3D" node_paths=PackedStringArray("inventory", "block", "collider", "minimap_icon", "north_mesh", "south_mesh", "east_mesh", "west_mesh", "north_collider", "south_collider", "east_collider", "west_collider")]
collision_layer = 17
script = ExtResource("1_tghvd")
inventory = NodePath("Inventory")
block = NodePath("MeshInstance3D")
collider = NodePath("CollisionShape3D")
minimap_icon = NodePath("Sprite3D")
minimap_icon = NodePath("MinimapIcon")
north_mesh = NodePath("North")
south_mesh = NodePath("South")
east_mesh = NodePath("East")
west_mesh = NodePath("West")
north_collider = NodePath("CollisionShape3D2")
south_collider = NodePath("CollisionShape3D3")
east_collider = NodePath("CollisionShape3D5")
west_collider = NodePath("CollisionShape3D4")
[node name="Inventory" type="Node" parent="."]
script = ExtResource("2_p5c7g")
@ -24,13 +44,89 @@ max_size = 1
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.55, 0)
shape = SubResource("BoxShape3D_lc72v")
[node name="Sprite3D" type="Sprite3D" parent="."]
transform = Transform3D(3.5, 0, 0, 0, -1.5299e-07, 3.5, 0, -3.5, -1.5299e-07, 0, 3.09462, 0)
[node name="MeshInstance3D" type="MeshInstance3D" parent="."]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.55, 0)
mesh = ExtResource("4_hosgw")
[node name="MinimapIcon" type="Sprite3D" parent="."]
transform = Transform3D(3.5, 0, 0, 0, -1.5299e-07, 3.5, 0, -3.5, -1.5299e-07, 0, 1.5, 0)
layers = 4
modulate = Color(0, 1, 0, 1)
texture_filter = 0
texture = ExtResource("3_01hk3")
[node name="MeshInstance3D" type="MeshInstance3D" parent="."]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.55, 0)
mesh = ExtResource("4_hosgw")
[node name="North" type="CSGBox3D" parent="."]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.5, 0.45, 0)
visible = false
size = Vector3(1, 0.9, 0.5)
material = SubResource("StandardMaterial3D_o3uwr")
[node name="NorthMinimapIcon" type="Sprite3D" parent="North"]
transform = Transform3D(3.5, 0, 0, 0, -6.7097e-08, 3.5, 0, -1.535, -1.5299e-07, 0.0251597, 1, 0)
layers = 4
modulate = Color(0, 1, 0, 1)
texture_filter = 0
texture = ExtResource("3_01hk3")
[node name="CollisionShape3D2" type="CollisionShape3D" parent="."]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.5, 0.55, 0)
visible = false
shape = SubResource("BoxShape3D_lc72v")
disabled = true
[node name="South" type="CSGBox3D" parent="."]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.5, 0.45, 0)
visible = false
size = Vector3(1, 0.9, 0.5)
material = SubResource("StandardMaterial3D_1i074")
[node name="SouthMinimapIcon" type="Sprite3D" parent="South"]
transform = Transform3D(3.5, 0, 0, 0, -6.7097e-08, 3.5, 0, -1.535, -1.5299e-07, -0.0251607, 1, 0)
layers = 4
modulate = Color(0, 1, 0, 1)
texture_filter = 0
texture = ExtResource("3_01hk3")
[node name="CollisionShape3D3" type="CollisionShape3D" parent="."]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.5, 0.55, 0)
visible = false
shape = SubResource("BoxShape3D_lc72v")
disabled = true
[node name="East" type="CSGBox3D" parent="."]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.45, -0.5)
visible = false
size = Vector3(0.5, 0.9, 1)
material = SubResource("StandardMaterial3D_jt61s")
[node name="EastMinimapIcon" type="Sprite3D" parent="East"]
transform = Transform3D(1.535, 0, 0, 0, -1.5299e-07, 3.5, 0, -3.5, -1.5299e-07, 0, 1, 0.0248078)
layers = 4
modulate = Color(0, 1, 0, 1)
texture_filter = 0
texture = ExtResource("3_01hk3")
[node name="CollisionShape3D5" type="CollisionShape3D" parent="."]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.55, -0.5)
visible = false
shape = SubResource("BoxShape3D_lc72v")
disabled = true
[node name="West" type="CSGBox3D" parent="."]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.45, 0.5)
visible = false
size = Vector3(0.5, 0.9, 1)
material = SubResource("StandardMaterial3D_t32n1")
[node name="WestMinimapIcon" type="Sprite3D" parent="West"]
transform = Transform3D(1.535, 0, 0, 0, -1.5299e-07, 3.5, 0, -3.5, -1.5299e-07, 0, 1, -0.0252527)
layers = 4
modulate = Color(0, 1, 0, 1)
texture_filter = 0
texture = ExtResource("3_01hk3")
[node name="CollisionShape3D4" type="CollisionShape3D" parent="."]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.55, 0.5)
visible = false
shape = SubResource("BoxShape3D_lc72v")
disabled = true

View File

@ -1,8 +1,8 @@
extends Node3D
class_name AStarGraph3D
@export var grid_size := Vector2i(21, 13)
@export var point_gap := 1.2
@export var grid_size := Vector2i(15, 7)
@export var point_gap := 2.0
var non_build_locations = []
var astar := AStar3D.new()
@ -15,6 +15,8 @@ var astar := AStar3D.new()
var tower_base_scene = load("res://Scenes/tower_base.tscn")
var tower_frame_scene = load("res://Scenes/tower_frame.tscn")
var tower_bases = []
var tower_base_ids = {}
var tower_frames = []
var wall_id = 0
@ -46,18 +48,113 @@ func networked_toggle_point(point_id):
else:
astar.set_point_disabled(point_id, true)
find_path()
disable_path_tower_frames()
if is_multiplayer_authority():
networked_spawn_wall.rpc(astar.get_point_position(point_id), wall_id)
wall_id += 1
func get_north_point(point_id) -> int:
var x = point_id / grid_size.y
var y = point_id % grid_size.y
if x - 1 >= 0: #if the north point id could possibly exist as a neighbor
return (x - 1) * grid_size.y + y
return -1
func get_south_point(point_id) -> int:
var x = point_id / grid_size.y
var y = point_id % grid_size.y
if x + 1 <= grid_size.x - 1: #if the south point id could possibly exist as a neighbor
return (x + 1) * grid_size.y + y
return -1
func get_west_point(point_id) -> int:
var x = point_id / grid_size.y
var y = point_id % grid_size.y
if y + 1 <= grid_size.y - 1: #if the east point id could possibly exist as a neighbor
return x * grid_size.y + y + 1
return -1
func get_east_point(point_id) -> int:
var x = point_id / grid_size.y
var y = point_id % grid_size.y
if y - 1 >= 0: #if the west point id could possibly exist as a neighbor
return x * grid_size.y + y - 1
return -1
func count_valid_neighbours(point_id) -> int:
if !point_id:
return 0
var valid_neighbours = 0
var north_point = get_north_point(point_id)
var south_point = get_south_point(point_id)
var east_point = get_east_point(point_id)
var west_point = get_west_point(point_id)
if north_point and !astar.is_point_disabled(north_point):
valid_neighbours += 1
else: #add the spawn point which is always valid
valid_neighbours += 1
if south_point and !astar.is_point_disabled(south_point):
valid_neighbours += 1
else: #add the goal point which is always valid
valid_neighbours += 1
if east_point and !astar.is_point_disabled(east_point):
valid_neighbours += 1
if west_point and !astar.is_point_disabled(west_point):
valid_neighbours += 1
return valid_neighbours
func disable_all_tower_frames():
for frame in tower_frames:
frame.set_visible(false)
func enable_non_path_tower_frames():
for frame in tower_frames:
frame.set_visible(true)
disable_path_tower_frames()
func disable_path_tower_frames():
for id in astar.get_id_path(astar.get_point_count() - 2, astar.get_point_count() - 1):
if id < (grid_size.x * grid_size.y) and !test_path_if_point_toggled(id):
tower_frames[id].set_visible(false)
@rpc("reliable", "call_local")
func networked_spawn_wall(pos : Vector3, name_id : int):
var base = tower_base_scene.instantiate()
var base = tower_base_scene.instantiate() as TowerBase
base.position = pos
base.name = "Wall" + str(name_id)
var point_id = astar.get_closest_point(pos, true)
tower_base_ids[point_id] = base
tower_bases.append(base)
tower_path.add_child(base)
var north_point = get_north_point(point_id)
var south_point = get_south_point(point_id)
var east_point = get_east_point(point_id)
var west_point = get_west_point(point_id)
if north_point >= 0 and astar.is_point_disabled(north_point):
base.set_north_wall(true)
tower_base_ids[north_point].set_south_wall(true)
if south_point >= 0 and astar.is_point_disabled(south_point):
base.set_south_wall(true)
tower_base_ids[south_point].set_north_wall(true)
if east_point >= 0 and astar.is_point_disabled(east_point):
base.set_east_wall(true)
tower_base_ids[east_point].set_west_wall(true)
if west_point >= 0 and astar.is_point_disabled(west_point):
base.set_west_wall(true)
tower_base_ids[west_point].set_east_wall(true)
func build_random_maze(block_limit):
@ -102,6 +199,7 @@ func make_grid():
astar.add_point(int(x * grid_size.y + y), point_position)
var frame = tower_frame_scene.instantiate()
frame.position = point_position
tower_frames.append(frame)
add_child(frame)
for x in grid_size.x:

View File

@ -17,12 +17,17 @@ var enemy_names = []
@export var enemy_sprites : Array[TextureRect]
@export var enemy_counts : Array[Label]
@export var weapon_energy_bar : TextureProgressBar
@export var offhand_energy_bar : TextureProgressBar
func set_energy_visible(value):
weapon_energy_bar.set_visible(value)
func set_offhand_energy_visible(value):
offhand_energy_bar.set_visible(value)
func _process(_delta: float) -> void:
fps_label.text = "FPS: " + str(Engine.get_frames_per_second())
@ -90,6 +95,10 @@ func set_weapon_energy(value):
weapon_energy_bar.value = value
func set_offhand_energy(value):
offhand_energy_bar.value = value
func maximise_minimap(anchor):
minimap_cam.anchor = anchor
minimap.set_anchors_and_offsets_preset(Control.PRESET_FULL_RECT)

View File

@ -3,4 +3,5 @@ class_name HeroClass
@export var hero_name : String = "Default"
@export var texture : Texture
@export var hand_texture : Texture
@export var deck : Array[Card]

View File

@ -5,6 +5,7 @@ signal energy_changed(energy)
@export var stats : CardText
@export var animator : AnimationPlayer
@export var recharge_timer : Timer
var damage_particle_scene = preload("res://Scenes/damage_particle.tscn")
var hero : Hero
@ -16,6 +17,10 @@ var damage := 0.0
var max_energy := 100.0
var current_energy := 100.0
var energy_cost := 1.0
var recharging := false
var recharge_speed := 0.0
var recharge_acceleration = 2.0
var recharge_max_speed = 20.0
func _ready() -> void:
@ -29,9 +34,13 @@ func set_hero(value):
func _process(delta: float) -> void:
current_energy += 5.0 * delta
if current_energy >= max_energy:
current_energy = max_energy
if recharging:
recharge_speed += recharge_acceleration * delta
if recharge_speed > recharge_max_speed:
recharge_speed = recharge_max_speed
current_energy += recharge_speed * delta
if current_energy >= max_energy:
current_energy = max_energy
energy_changed.emit(current_energy)
if time_since_firing < time_between_shots:
time_since_firing += delta
@ -52,6 +61,7 @@ func hold_trigger():
func release_trigger():
trigger_held = false
recharge_timer.start()
func hold_second_trigger():
@ -72,8 +82,14 @@ func spawn_damage_indicator(pos):
func shoot():
animator.play("shoot")
recharging = false
recharge_timer.stop()
@rpc
func networked_shoot():
animator.play("shoot")
func _on_timer_timeout() -> void:
recharging = true

View File

@ -27,6 +27,8 @@ var interact_hold_time := 0.4
func _ready() -> void:
wall_preview.set_material(build_preview_material)
build_preview_material.albedo_color = Color.GREEN
build_preview_material.albedo_color.a = 0.8
wall_preview.toggle_collision()
@ -73,12 +75,12 @@ func _process(delta: float) -> void:
if obstacle_last_point != point_id:
obstacle_last_point = point_id
if Game.level.a_star_graph_3d.test_path_if_point_toggled(point_id):
build_preview_material.albedo_color = Color.GREEN
build_preview_material.albedo_color.a = 0.8
#build_preview_material.albedo_color = Color.GREEN
#build_preview_material.albedo_color.a = 0.8
valid_point = true
else:
build_preview_material.albedo_color = Color.RED
build_preview_material.albedo_color.a = 0.8
#build_preview_material.albedo_color = Color.RED
#build_preview_material.albedo_color.a = 0.8
valid_point = false
else:
ray_collider = null
@ -86,6 +88,8 @@ func _process(delta: float) -> void:
is_looking_at_tower_base = false
delete_tower_preview()
wall_preview.set_visible(false)
if !valid_point:
wall_preview.set_visible(false)
func spawn_tower_preview():

View File

@ -69,12 +69,26 @@ func parse_command(text : String, peer_id : int):
if text.substr(1, 7) == "prosper":
for id in connected_players_nodes:
connected_players_nodes[id].currency += 50
if text.substr(1, 8) == "set_wave":
if is_multiplayer_authority():
networked_set_wave.rpc(int(text.substr(10)))
else:
chatbox.append_message("SERVER", Color.TOMATO, "Unable to set wave")
# if text.substr(1, 17) == "show tower ranges":
# pass
# if text.substr(1, 20) = "show gauntlet ranges":
# pass
@rpc("reliable", "call_local")
func networked_set_wave(wave_number):
chatbox.append_message("SERVER", Color.TOMATO, "Set to wave " + str(wave_number))
for player in connected_players_nodes:
connected_players_nodes[player].hud.set_wave_count(wave_number)
wave = wave_number
set_upcoming_wave()
func spawn_level():
level = level_scene.instantiate() as Level
for x in level.enemy_spawns:
@ -123,6 +137,7 @@ func spawn_enemy_wave():
wave += 1
level.a_star_graph_3d.find_path()
level.a_star_graph_3d.visualized_path.disable_visualization()
level.a_star_graph_3d.disable_all_tower_frames()
for spawn in level.enemy_spawns:
spawn.spawn_wave(upcoming_wave)
wave_started.emit(wave)
@ -191,6 +206,7 @@ func end_wave():
connected_players_nodes[peer_id].currency += ceili(pot / connected_players_nodes.size())
connected_players_nodes[peer_id].ready_state = false
level.a_star_graph_3d.visualized_path.enable_visualization()
level.a_star_graph_3d.enable_non_path_tower_frames()
if is_multiplayer_authority():
if randf() <= shop_chance:
networked_spawn_shop.rpc()

View File

@ -13,6 +13,7 @@ func _ready() -> void:
bg_level.a_star_graph_3d.find_path()
bg_level.a_star_graph_3d.build_random_maze(50)
bg_level.a_star_graph_3d.place_random_towers(20)
bg_level.a_star_graph_3d.disable_all_tower_frames()
var new_wave = WaveManager.generate_wave(400, bg_level.enemy_pool)
for spawn in bg_level.enemy_spawns:
spawn.signal_for_after_enemy_died = enemy_died
@ -20,7 +21,7 @@ func _ready() -> void:
spawn.signal_for_when_enemy_spawns.connect(increase_enemy_count)
spawn.spawn_wave(new_wave)
func enemy_died(some_arg):
func enemy_died(_some_arg):
pass
func damage_goal():
pass

View File

@ -52,7 +52,7 @@ func randomize_cards():
choice_buttons[x+5].press_cost = price_dict[chosen_card.rarity]
choice_buttons[x+5].hover_text = "Spend $" + str(choice_buttons[x+5].press_cost) + " to acquire " + chosen_card.title + "?"
for x in choice_colliders:
x.disabled = false
x.set_deferred("disabled", false)
for x in choice_sprites:
x.set_visible(true)

View File

@ -5,6 +5,14 @@ class_name TowerBase
@export var block : Node3D
@export var collider : CollisionShape3D
@export var minimap_icon : Sprite3D
@export var north_mesh : CSGBox3D
@export var south_mesh : CSGBox3D
@export var east_mesh : CSGBox3D
@export var west_mesh : CSGBox3D
@export var north_collider : CollisionShape3D
@export var south_collider : CollisionShape3D
@export var east_collider : CollisionShape3D
@export var west_collider : CollisionShape3D
var tower = null
var has_card : bool :
@ -34,6 +42,26 @@ func toggle_collision():
collider.disabled = !collider.disabled
func set_north_wall(value : bool):
north_mesh.set_visible(value)
north_collider.disabled = !value
func set_south_wall(value : bool):
south_mesh.set_visible(value)
south_collider.disabled = !value
func set_east_wall(value : bool):
east_mesh.set_visible(value)
east_collider.disabled = !value
func set_west_wall(value : bool):
west_mesh.set_visible(value)
west_collider.disabled = !value
@rpc("reliable", "call_local", "any_peer")
func networked_spawn_tower():
tower = inventory.selected_item.turret_scene.instantiate() as Tower

View File

@ -14,7 +14,7 @@
[sub_resource type="SphereShape3D" id="SphereShape3D_21dgw"]
[sub_resource type="AtlasTexture" id="AtlasTexture_0bx6y"]
[sub_resource type="AtlasTexture" id="AtlasTexture_o3ikr"]
resource_local_to_scene = true
atlas = ExtResource("3_naknq")
region = Rect2(0, 0, 32, 32)
@ -44,7 +44,7 @@ script = ExtResource("2_j8yin")
[node name="DirectionSprite" parent="." instance=ExtResource("2_o7jmg")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.642479, 0)
pixel_size = 0.04
texture = SubResource("AtlasTexture_0bx6y")
texture = SubResource("AtlasTexture_o3ikr")
[node name="Sprite3D" type="Sprite3D" parent="."]
transform = Transform3D(0.2, 0, 0, 0, 0.2, 0, 0, 0, 0.2, 0, 1.20821, 0)

View File

@ -67,7 +67,7 @@ size = Vector3(58.5693, 9.50003, 1)
size = Vector3(29, 10, 1)
[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_iqnu2"]
transparency = 1
transparency = 4
cull_mode = 2
albedo_texture = ExtResource("15_61y1c")
uv1_scale = Vector3(8, 29, 1)
@ -92,7 +92,9 @@ size = Vector2(2, 18)
size = Vector3(18, 5, 2)
[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_u3k34"]
transparency = 1
transparency = 2
alpha_scissor_threshold = 0.5
alpha_antialiasing_mode = 0
cull_mode = 2
albedo_texture = ExtResource("15_61y1c")
uv1_scale = Vector3(2, 8, 0)
@ -885,8 +887,6 @@ transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 1, 1, 1)
[node name="AStarGraph3D" type="Node3D" parent="." node_paths=PackedStringArray("start", "end", "spawner", "visualized_path", "tower_path")]
script = ExtResource("11_07ukk")
grid_size = Vector2i(15, 7)
point_gap = 2.0
start = NodePath("../GroundSpawn")
end = NodePath("../EnemyGoal")
spawner = NodePath("../GroundSpawn")

File diff suppressed because one or more lines are too long

View File

@ -1,13 +0,0 @@
[gd_scene load_steps=4 format=3 uid="uid://cbspcgdno2u5g"]
[ext_resource type="PackedScene" uid="uid://dx0ixlcxcxpcg" path="res://funbox.glb" id="1_s5q5d"]
[ext_resource type="Texture2D" uid="uid://bmor4v4j7krgh" path="res://funboxtex.png" id="2_e8jej"]
[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_ppe8m"]
albedo_texture = ExtResource("2_e8jej")
texture_filter = 0
[node name="funbox" instance=ExtResource("1_s5q5d")]
[node name="Cube" parent="." index="0"]
surface_material_override/0 = SubResource("StandardMaterial3D_ppe8m")