generalized card vs item, cleaned up some headbob stuff, added the ability to refund a wall block

This commit is contained in:
Lexi Quinn 2023-12-08 03:05:11 +11:00
parent dfeddc08e0
commit 1e3e380b90
31 changed files with 286 additions and 186 deletions

View File

@ -1,23 +1,17 @@
[gd_resource type="Resource" script_class="Card" load_steps=8 format=3 uid="uid://deer0awg4d18o"]
[gd_resource type="Resource" script_class="Card" load_steps=6 format=3 uid="uid://deer0awg4d18o"]
[ext_resource type="Script" path="res://Scripts/Resources/card.gd" id="1_yqa4b"]
[ext_resource type="Texture2D" uid="uid://celay30i4soud" path="res://PCs/Universal/ClassCards/Assault/g_assault.png" id="2_a8may"]
[ext_resource type="PackedScene" uid="uid://2eehfcrsednw" path="res://PCs/Universal/ClassCards/Assault/weapon_assault.tscn" id="3_28y3b"]
[ext_resource type="Resource" uid="uid://bdmsiw45xxhiv" path="res://PCs/Universal/ClassCards/Assault/tower_stats.tres" id="3_ks0jw"]
[ext_resource type="PackedScene" uid="uid://bbfm4i4xlkwdr" path="res://PCs/Universal/ClassCards/Assault/tower_assault.tscn" id="4_5nu32"]
[ext_resource type="Resource" uid="uid://smctw4ogm4rx" path="res://PCs/Universal/ClassCards/Assault/weapon_stats.tres" id="4_est7t"]
[sub_resource type="AtlasTexture" id="AtlasTexture_q0mw6"]
atlas = ExtResource("2_a8may")
region = Rect2(0, 0, 64, 64)
[resource]
script = ExtResource("1_yqa4b")
title = "Assault"
rarity = 0
faction = 0
sprite = SubResource("AtlasTexture_q0mw6")
turret_scene = ExtResource("4_5nu32")
weapon_scene = ExtResource("3_28y3b")
weapon_stats = ExtResource("4_est7t")
tower_stats = ExtResource("3_ks0jw")
display_name = "Assault"

View File

@ -1,23 +1,17 @@
[gd_resource type="Resource" script_class="Card" load_steps=8 format=3 uid="uid://bywwtjdjsgdsj"]
[gd_resource type="Resource" script_class="Card" load_steps=6 format=3 uid="uid://bywwtjdjsgdsj"]
[ext_resource type="Script" path="res://Scripts/Resources/card.gd" id="1_nobd8"]
[ext_resource type="Texture2D" uid="uid://dnlplq8duves3" path="res://PCs/Universal/ClassCards/Blowdart/blowdart.png" id="2_jglqy"]
[ext_resource type="PackedScene" uid="uid://cy05ssd52exf0" path="res://PCs/Universal/ClassCards/Blowdart/weapon_blowdart.tscn" id="3_shm45"]
[ext_resource type="Resource" uid="uid://cfbap4o68urti" path="res://PCs/Universal/ClassCards/Blowdart/tower_stats.tres" id="3_t7ppb"]
[ext_resource type="PackedScene" uid="uid://cq5q6c28pwi47" path="res://PCs/Universal/ClassCards/Blowdart/tower_blowdart.tscn" id="4_wvh75"]
[ext_resource type="Resource" uid="uid://c6e50linnk2i7" path="res://PCs/Universal/ClassCards/Blowdart/weapon_stats.tres" id="4_x71t4"]
[sub_resource type="AtlasTexture" id="AtlasTexture_jl74p"]
atlas = ExtResource("2_jglqy")
region = Rect2(0, 0, 64, 64)
[resource]
script = ExtResource("1_nobd8")
title = "Blowdart"
rarity = 1
faction = 0
sprite = SubResource("AtlasTexture_jl74p")
turret_scene = ExtResource("4_wvh75")
weapon_scene = ExtResource("3_shm45")
weapon_stats = ExtResource("4_x71t4")
tower_stats = ExtResource("3_t7ppb")
display_name = "Blowdart"

View File

@ -1,23 +1,17 @@
[gd_resource type="Resource" script_class="Card" load_steps=8 format=3 uid="uid://blgngx360vff1"]
[gd_resource type="Resource" script_class="Card" load_steps=6 format=3 uid="uid://blgngx360vff1"]
[ext_resource type="Script" path="res://Scripts/Resources/card.gd" id="1_qtxcq"]
[ext_resource type="Texture2D" uid="uid://3qcdx7n440sc" path="res://PCs/Universal/ClassCards/BombLauncher/grenade_launcher.png" id="2_qpxaq"]
[ext_resource type="Resource" uid="uid://8eaecilvan23" path="res://PCs/Universal/ClassCards/BombLauncher/tower_stats.tres" id="3_gknxe"]
[ext_resource type="PackedScene" uid="uid://c3fqlkytyc62u" path="res://PCs/Universal/ClassCards/BombLauncher/weapon_bomb_launcher.tscn" id="3_s56j6"]
[ext_resource type="Resource" uid="uid://co6eorobj1xuu" path="res://PCs/Universal/ClassCards/BombLauncher/weapon_stats.tres" id="4_s74ea"]
[ext_resource type="PackedScene" uid="uid://d2cch7qrwocg8" path="res://PCs/Universal/ClassCards/BombLauncher/tower_bomb_launcher.tscn" id="4_vc8pe"]
[sub_resource type="AtlasTexture" id="AtlasTexture_rat6o"]
atlas = ExtResource("2_qpxaq")
region = Rect2(0, 0, 64, 64)
[resource]
script = ExtResource("1_qtxcq")
title = "Bomb Launcher"
rarity = 0
faction = 0
sprite = SubResource("AtlasTexture_rat6o")
turret_scene = ExtResource("4_vc8pe")
weapon_scene = ExtResource("3_s56j6")
weapon_stats = ExtResource("4_s74ea")
tower_stats = ExtResource("3_gknxe")
display_name = "Bomb Launcher"

View File

@ -1,23 +1,17 @@
[gd_resource type="Resource" script_class="Card" load_steps=8 format=3 uid="uid://bibx2my7igspq"]
[gd_resource type="Resource" script_class="Card" load_steps=6 format=3 uid="uid://bibx2my7igspq"]
[ext_resource type="Script" path="res://Scripts/Resources/card.gd" id="1_qktm8"]
[ext_resource type="Texture2D" uid="uid://mwgpnnm3g3re" path="res://PCs/Universal/ClassCards/Fireball/fireball.png" id="2_lfltq"]
[ext_resource type="Resource" uid="uid://dnvqghpwyuw84" path="res://PCs/Universal/ClassCards/Fireball/tower_stats.tres" id="3_1l6fp"]
[ext_resource type="PackedScene" uid="uid://dnwjfb4fexr0o" path="res://PCs/Universal/ClassCards/Fireball/weapon_fireball.tscn" id="3_4c0mu"]
[ext_resource type="PackedScene" uid="uid://dwwgvgn0ds8tk" path="res://PCs/Universal/ClassCards/Fireball/tower_fireball.tscn" id="4_e3adw"]
[ext_resource type="Resource" uid="uid://dhwhwicgpw7yh" path="res://PCs/Universal/ClassCards/Fireball/weapon_stats.tres" id="4_folo6"]
[sub_resource type="AtlasTexture" id="AtlasTexture_wvh1s"]
atlas = ExtResource("2_lfltq")
region = Rect2(0, 0, 64, 64)
[resource]
script = ExtResource("1_qktm8")
title = "Fireball"
rarity = 3
faction = 0
sprite = SubResource("AtlasTexture_wvh1s")
turret_scene = ExtResource("4_e3adw")
weapon_scene = ExtResource("3_4c0mu")
weapon_stats = ExtResource("4_folo6")
tower_stats = ExtResource("3_1l6fp")
display_name = "Fireball"

View File

@ -1,23 +1,17 @@
[gd_resource type="Resource" script_class="Card" load_steps=8 format=3 uid="uid://dg4pjt47q8xpw"]
[gd_resource type="Resource" script_class="Card" load_steps=6 format=3 uid="uid://dg4pjt47q8xpw"]
[ext_resource type="Script" path="res://Scripts/Resources/card.gd" id="1_xmwih"]
[ext_resource type="Texture2D" uid="uid://oblavj8vj30n" path="res://PCs/Universal/ClassCards/GlueLauncher/glue_gun.png" id="2_ocjdv"]
[ext_resource type="Resource" uid="uid://cdtjbxs21peqg" path="res://PCs/Universal/ClassCards/Flamethrower/tower_stats.tres" id="3_sjxkl"]
[ext_resource type="PackedScene" uid="uid://dhv7m4lky7bd8" path="res://PCs/Universal/ClassCards/Flamethrower/weapon_flamethrower.tscn" id="4_800j1"]
[ext_resource type="PackedScene" uid="uid://dkoj1766ygo3f" path="res://PCs/Universal/ClassCards/Flamethrower/tower_flamethrower.tscn" id="4_rgkdc"]
[ext_resource type="Resource" uid="uid://yjknwdimtm8g" path="res://PCs/Universal/ClassCards/Flamethrower/weapon_stats.tres" id="5_qi4e4"]
[sub_resource type="AtlasTexture" id="AtlasTexture_bcolm"]
atlas = ExtResource("2_ocjdv")
region = Rect2(0, 0, 64, 64)
[resource]
script = ExtResource("1_xmwih")
title = "Flamethrower"
rarity = 2
faction = 0
sprite = SubResource("AtlasTexture_bcolm")
turret_scene = ExtResource("4_rgkdc")
weapon_scene = ExtResource("4_800j1")
weapon_stats = ExtResource("5_qi4e4")
tower_stats = ExtResource("3_sjxkl")
display_name = "Flamethrower"

View File

@ -1,23 +1,17 @@
[gd_resource type="Resource" script_class="Card" load_steps=8 format=3 uid="uid://cvto66tp7rrst"]
[gd_resource type="Resource" script_class="Card" load_steps=6 format=3 uid="uid://cvto66tp7rrst"]
[ext_resource type="Script" path="res://Scripts/Resources/card.gd" id="1_5html"]
[ext_resource type="Texture2D" uid="uid://bjh6e8t8br6rq" path="res://PCs/Universal/ClassCards/Gatling/gatling.png" id="2_rof1s"]
[ext_resource type="Resource" uid="uid://nxl5wabgl36t" path="res://PCs/Universal/ClassCards/Gatling/tower_stats.tres" id="3_4hykq"]
[ext_resource type="PackedScene" uid="uid://dkxi1ssoa44jn" path="res://PCs/Universal/ClassCards/Gatling/weapon_gatling.tscn" id="3_wkjyf"]
[ext_resource type="Resource" uid="uid://cj2x1jvo8l4ot" path="res://PCs/Universal/ClassCards/Gatling/weapon_stats.tres" id="4_76fd1"]
[ext_resource type="PackedScene" uid="uid://bjuc3x7u3f271" path="res://PCs/Universal/ClassCards/Gatling/tower_gatling.tscn" id="4_thk7u"]
[sub_resource type="AtlasTexture" id="AtlasTexture_rwa4l"]
atlas = ExtResource("2_rof1s")
region = Rect2(0, 0, 64, 64)
[resource]
script = ExtResource("1_5html")
title = "Gatling"
rarity = 0
faction = 0
sprite = SubResource("AtlasTexture_rwa4l")
turret_scene = ExtResource("4_thk7u")
weapon_scene = ExtResource("3_wkjyf")
weapon_stats = ExtResource("4_76fd1")
tower_stats = ExtResource("3_4hykq")
display_name = "Gatling"

View File

@ -1,23 +1,17 @@
[gd_resource type="Resource" script_class="Card" load_steps=8 format=3 uid="uid://fwsg5av1egp2"]
[gd_resource type="Resource" script_class="Card" load_steps=6 format=3 uid="uid://fwsg5av1egp2"]
[ext_resource type="Script" path="res://Scripts/Resources/card.gd" id="1_tdu8a"]
[ext_resource type="Texture2D" uid="uid://oblavj8vj30n" path="res://PCs/Universal/ClassCards/GlueLauncher/glue_gun.png" id="2_lh4dk"]
[ext_resource type="Resource" uid="uid://boj1ho5x0sxtq" path="res://PCs/Universal/ClassCards/GlueLauncher/weapon_stats.tres" id="3_dukui"]
[ext_resource type="Resource" uid="uid://bvkwgmbxje0dp" path="res://PCs/Universal/ClassCards/GlueLauncher/tower_stats.tres" id="3_e5fta"]
[ext_resource type="PackedScene" uid="uid://bb44pintbwdcf" path="res://PCs/Universal/ClassCards/GlueLauncher/tower_glue_launcher.tscn" id="4_xcrut"]
[ext_resource type="PackedScene" uid="uid://takm6diuy71m" path="res://PCs/Universal/ClassCards/GlueLauncher/weapon_glue_launcher.tscn" id="5_l3c38"]
[sub_resource type="AtlasTexture" id="AtlasTexture_7gjas"]
atlas = ExtResource("2_lh4dk")
region = Rect2(0, 0, 64, 64)
[resource]
script = ExtResource("1_tdu8a")
title = "Glue Launcher"
rarity = 1
faction = 0
sprite = SubResource("AtlasTexture_7gjas")
turret_scene = ExtResource("4_xcrut")
weapon_scene = ExtResource("5_l3c38")
weapon_stats = ExtResource("3_dukui")
tower_stats = ExtResource("3_e5fta")
display_name = "Glue Launcher"

View File

@ -1,23 +1,17 @@
[gd_resource type="Resource" script_class="Card" load_steps=8 format=3 uid="uid://cb1uqjl1387kk"]
[gd_resource type="Resource" script_class="Card" load_steps=6 format=3 uid="uid://cb1uqjl1387kk"]
[ext_resource type="Script" path="res://Scripts/Resources/card.gd" id="1_cmmto"]
[ext_resource type="Texture2D" uid="uid://mqo5qcghfit8" path="res://PCs/Universal/ClassCards/Icicle/icicle.png" id="2_w5fi7"]
[ext_resource type="Resource" uid="uid://d34bfj5togyyt" path="res://PCs/Universal/ClassCards/Icicle/tower_stats.tres" id="3_p8y0m"]
[ext_resource type="PackedScene" uid="uid://v3iuf4lt2iff" path="res://PCs/Universal/ClassCards/Icicle/weapon_icicle.tscn" id="3_ve3rv"]
[ext_resource type="PackedScene" uid="uid://miawrarbb1up" path="res://PCs/Universal/ClassCards/Icicle/tower_icicle.tscn" id="4_vgqev"]
[ext_resource type="Resource" uid="uid://ckjmym1ofww4" path="res://PCs/Universal/ClassCards/Icicle/weapon_stats.tres" id="4_yv37w"]
[sub_resource type="AtlasTexture" id="AtlasTexture_7due4"]
atlas = ExtResource("2_w5fi7")
region = Rect2(0, 0, 64, 64)
[resource]
script = ExtResource("1_cmmto")
title = "Icicle"
rarity = 3
faction = 0
sprite = SubResource("AtlasTexture_7due4")
turret_scene = ExtResource("4_vgqev")
weapon_scene = ExtResource("3_ve3rv")
weapon_stats = ExtResource("4_yv37w")
tower_stats = ExtResource("3_p8y0m")
display_name = "Icicle"

View File

@ -1,23 +1,17 @@
[gd_resource type="Resource" script_class="Card" load_steps=8 format=3 uid="uid://b3o112jw3loiu"]
[gd_resource type="Resource" script_class="Card" load_steps=6 format=3 uid="uid://b3o112jw3loiu"]
[ext_resource type="Script" path="res://Scripts/Resources/card.gd" id="1_0ciid"]
[ext_resource type="Texture2D" uid="uid://oblavj8vj30n" path="res://PCs/Universal/ClassCards/GlueLauncher/glue_gun.png" id="2_as4jg"]
[ext_resource type="Resource" uid="uid://cssdyxk8oefsd" path="res://PCs/Universal/ClassCards/Reactor/tower_stats.tres" id="3_7vuex"]
[ext_resource type="PackedScene" uid="uid://yymj42pp6v1t" path="res://PCs/Universal/ClassCards/Reactor/weapon_reactor.tscn" id="3_de72q"]
[ext_resource type="PackedScene" uid="uid://dqrkn0vp2tmrh" path="res://PCs/Universal/ClassCards/Reactor/tower_reactor.tscn" id="4_1krig"]
[ext_resource type="Resource" uid="uid://ipfr7emuarbj" path="res://PCs/Universal/ClassCards/Reactor/weapon_stats.tres" id="4_wilo7"]
[sub_resource type="AtlasTexture" id="AtlasTexture_7aw4q"]
atlas = ExtResource("2_as4jg")
region = Rect2(0, 0, 64, 64)
[resource]
script = ExtResource("1_0ciid")
title = "Reactor"
rarity = 4
faction = 0
sprite = SubResource("AtlasTexture_7aw4q")
turret_scene = ExtResource("4_1krig")
weapon_scene = ExtResource("3_de72q")
weapon_stats = ExtResource("4_wilo7")
tower_stats = ExtResource("3_7vuex")
display_name = "Reactor"

View File

@ -1,23 +1,17 @@
[gd_resource type="Resource" script_class="Card" load_steps=8 format=3 uid="uid://ds8qx4ggmqetk"]
[gd_resource type="Resource" script_class="Card" load_steps=6 format=3 uid="uid://ds8qx4ggmqetk"]
[ext_resource type="Script" path="res://Scripts/Resources/card.gd" id="1_84afc"]
[ext_resource type="Texture2D" uid="uid://oblavj8vj30n" path="res://PCs/Universal/ClassCards/GlueLauncher/glue_gun.png" id="2_kdslp"]
[ext_resource type="Resource" uid="uid://st0qrut5nxrm" path="res://PCs/Universal/ClassCards/Refrigerator/tower_stats.tres" id="3_bihii"]
[ext_resource type="PackedScene" uid="uid://b0vi11kj3lxng" path="res://PCs/Universal/ClassCards/Refrigerator/weapon_refrigerator.tscn" id="4_0oufq"]
[ext_resource type="PackedScene" uid="uid://bqaynyhxdr4to" path="res://PCs/Universal/ClassCards/Refrigerator/tower_refrigerator.tscn" id="4_7x6qx"]
[ext_resource type="Resource" uid="uid://5l758yxfpi1e" path="res://PCs/Universal/ClassCards/Refrigerator/weapon_stats.tres" id="5_dqmyh"]
[sub_resource type="AtlasTexture" id="AtlasTexture_fuxlt"]
atlas = ExtResource("2_kdslp")
region = Rect2(0, 0, 64, 64)
[resource]
script = ExtResource("1_84afc")
title = "Refrigerator"
rarity = 1
faction = 0
sprite = SubResource("AtlasTexture_fuxlt")
turret_scene = ExtResource("4_7x6qx")
weapon_scene = ExtResource("4_0oufq")
weapon_stats = ExtResource("5_dqmyh")
tower_stats = ExtResource("3_bihii")
display_name = "Refrigerator"

View File

@ -1,23 +1,17 @@
[gd_resource type="Resource" script_class="Card" load_steps=8 format=3 uid="uid://b37r54q84vqoi"]
[gd_resource type="Resource" script_class="Card" load_steps=6 format=3 uid="uid://b37r54q84vqoi"]
[ext_resource type="Script" path="res://Scripts/Resources/card.gd" id="1_ly0o5"]
[ext_resource type="Texture2D" uid="uid://by1y15lm0bppe" path="res://PCs/Universal/ClassCards/RocketLauncher/rocket_launcher.png" id="2_iqnic"]
[ext_resource type="Resource" uid="uid://c65rq455ma8f6" path="res://PCs/Universal/ClassCards/RocketLauncher/tower_stats.tres" id="3_06my6"]
[ext_resource type="PackedScene" uid="uid://bdp7icdejayvr" path="res://PCs/Universal/ClassCards/RocketLauncher/weapon_rocket_launcher.tscn" id="3_qo5gv"]
[ext_resource type="Resource" uid="uid://d2yo07m2mp2mp" path="res://PCs/Universal/ClassCards/RocketLauncher/weapon_stats.tres" id="4_cmvfg"]
[ext_resource type="PackedScene" uid="uid://b3q0f6w30nwsh" path="res://PCs/Universal/ClassCards/RocketLauncher/tower_rocket_launcher.tscn" id="4_hff2k"]
[sub_resource type="AtlasTexture" id="AtlasTexture_u80vk"]
atlas = ExtResource("2_iqnic")
region = Rect2(0, 0, 64, 64)
[resource]
script = ExtResource("1_ly0o5")
title = "Rocket Launcher"
rarity = 0
faction = 0
sprite = SubResource("AtlasTexture_u80vk")
turret_scene = ExtResource("4_hff2k")
weapon_scene = ExtResource("3_qo5gv")
weapon_stats = ExtResource("4_cmvfg")
tower_stats = ExtResource("3_06my6")
display_name = "Rocket Launcher"

View File

@ -1,23 +1,17 @@
[gd_resource type="Resource" script_class="Card" load_steps=8 format=3 uid="uid://ckm88acryitl4"]
[gd_resource type="Resource" script_class="Card" load_steps=6 format=3 uid="uid://ckm88acryitl4"]
[ext_resource type="Script" path="res://Scripts/Resources/card.gd" id="1_5vmtk"]
[ext_resource type="Texture2D" uid="uid://cv2eycs1j0ho7" path="res://PCs/Universal/ClassCards/Sniper/g_sniper.png" id="2_go86x"]
[ext_resource type="Resource" uid="uid://eb0by6ba1d43" path="res://PCs/Universal/ClassCards/Sniper/tower_stats.tres" id="3_6i55t"]
[ext_resource type="PackedScene" uid="uid://bd65e03fscyxr" path="res://PCs/Universal/ClassCards/Sniper/weapon_sniper.tscn" id="3_qfpvu"]
[ext_resource type="Resource" uid="uid://3y7n1vdvf822" path="res://PCs/Universal/ClassCards/Sniper/weapon_stats.tres" id="4_7kvq1"]
[ext_resource type="PackedScene" uid="uid://bt4qbc5lp4nhr" path="res://PCs/Universal/ClassCards/Sniper/tower_sniper.tscn" id="4_k5nhs"]
[sub_resource type="AtlasTexture" id="AtlasTexture_fckie"]
atlas = ExtResource("2_go86x")
region = Rect2(0, 0, 64, 64)
[resource]
script = ExtResource("1_5vmtk")
title = "Sniper"
rarity = 1
faction = 0
sprite = SubResource("AtlasTexture_fckie")
turret_scene = ExtResource("4_k5nhs")
weapon_scene = ExtResource("3_qfpvu")
weapon_stats = ExtResource("4_7kvq1")
tower_stats = ExtResource("3_6i55t")
display_name = "Sniper"

View File

@ -29,8 +29,8 @@ signal died
@export var weapon_swap_timer : Timer
@export var ears : AudioListener3D
var equipped_card : Card
var offhand_card : Card
var equipped_card
var offhand_card
var weapon : Weapon
var offhand_weapon : Weapon
var weapons_active = false
@ -175,18 +175,20 @@ func _unhandled_input(event: InputEvent) -> void:
hud.add_child(menu)
func add_card(card: Card):
inventory.add(card)
func unpause():
paused = false
movement.paused = false
Input.mouse_mode = Input.MOUSE_MODE_CAPTURED
movement.set_process(true)
movement.set_physics_process(true)
func pause():
paused = true
movement.paused = true
Input.mouse_mode = Input.MOUSE_MODE_VISIBLE
movement.set_process(false)
movement.set_physics_process(false)
func enter_editing_mode(value):

View File

@ -1,4 +1,4 @@
[gd_scene load_steps=36 format=3 uid="uid://dxgxbtf68lcv5"]
[gd_scene load_steps=37 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"]
@ -86,6 +86,14 @@ shader_parameter/len = 0.015
shader_parameter/spacing = 0.008
shader_parameter/spread = 1.0
[sub_resource type="SceneReplicationConfig" id="SceneReplicationConfig_tsiqi"]
properties/0/path = NodePath(".:position")
properties/0/spawn = true
properties/0/replication_mode = 2
properties/1/path = NodePath(".:rotation")
properties/1/spawn = true
properties/1/replication_mode = 2
[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", "ears")]
collision_layer = 2
collision_mask = 37
@ -113,6 +121,9 @@ player_name_tag = NodePath("NametagViewport/Label")
weapon_swap_timer = NodePath("WeaponSwapTimer")
ears = NodePath("AudioListener3D")
[node name="AudioListener3D" type="AudioListener3D" parent="."]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1.5, 0)
[node name="CollisionShape3D" type="CollisionShape3D" parent="."]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1, 0)
shape = SubResource("CapsuleShape3D_jbu13")
@ -231,7 +242,7 @@ anchor = NodePath("../..")
[node name="NametagViewport" type="SubViewport" parent="."]
transparent_bg = true
size = Vector2i(300, 40)
size = Vector2i(1000, 40)
render_target_update_mode = 4
[node name="Label" type="Label" parent="NametagViewport"]
@ -240,7 +251,7 @@ anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
text = "QUITE LONG PLAYER NAME"
text = "xXx_TransgenderHyena_xXx"
horizontal_alignment = 1
vertical_alignment = 1
@ -271,6 +282,8 @@ script = ExtResource("6_cf5ap")
script = ExtResource("20_cfhw8")
player = NodePath("..")
head = NodePath("../ViewMovement")
max_look_down_angle = 80.0
max_look_up_angle = 80.0
[node name="HUD" type="CanvasLayer" parent="." node_paths=PackedStringArray("wave_count", "lives_count", "currency_count", "minimap_outline", "crosshair", "minimap", "minimap_cam", "minimap_viewport", "fps_label", "hover_text", "enemy_sprites", "enemy_counts", "weapon_energy_bar", "offhand_energy_bar")]
script = ExtResource("8_yl6ka")
@ -586,7 +599,7 @@ tint_progress = Color(0, 1, 1, 1)
wait_time = 0.9
one_shot = true
[node name="AudioListener3D" type="AudioListener3D" parent="."]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1.5, 0)
[node name="MultiplayerSynchronizer" type="MultiplayerSynchronizer" parent="."]
replication_config = SubResource("SceneReplicationConfig_tsiqi")
[connection signal="timeout" from="WeaponSwapTimer" to="." method="_on_timer_timeout"]

View File

@ -9,9 +9,10 @@ class_name PlayerMovement
@export var sprint_boost := 1.3
@export var acceleration := 0.8
@export var friction_percentage := 0.1
@export var max_look_down_angle := 90.0
@export var max_look_up_angle := 90.0
@export_category("Jump")
var jump_held = false
@export var min_height := 0.8
@export var max_height := 1.3
@export var time_to_peak := 0.5
@ -22,11 +23,13 @@ var jump_held = false
@onready var time_to_min_peak : float = (clampf(min_height, 0.0, max_height) / max_height) * time_to_peak
@onready var min_jump_gravity : float = (-2 * clampf(min_height, 0.0, max_height)) / pow(time_to_min_peak, 2)
var paused := false
var zoom_factor := 1.0
var input_vector : Vector2
var can_sprint := true
var sprint_zoom_factor := 0.08
var sprinting := false
var jump_held = false
var head_angle := 0.0
var look_sens : float :
set(_value):
@ -53,13 +56,14 @@ func _physics_process(delta: float) -> void:
velocity = velocity.limit_length(movement_speed * sprint_boost if sprinting else movement_speed)
player.velocity = Vector3(velocity.x, down_velocity + (get_gravity() * delta), velocity.y)
player.move_and_slide()
sync_position.rpc(player.position)
sync_rotation.rpc(player.rotation)
func _process(_delta: float) -> void:
if !is_multiplayer_authority():
return
if paused:
input_vector = Vector2.ZERO
return
can_sprint = true
input_vector = Input.get_vector("Move Left", "Move Right", "Move Forward", "Move Backward")
if input_vector.y >= 0:
@ -84,15 +88,5 @@ func _unhandled_input(event: InputEvent) -> void:
if event is InputEventMouseMotion and Input.get_mouse_mode() == Input.MOUSE_MODE_CAPTURED:
player.rotation.y -= event.relative.x * (look_sens / zoom_factor) * (-1 if Data.preferences.invert_lookX else 1)
head_angle -= event.relative.y * (look_sens / zoom_factor) * (-1 if Data.preferences.invert_lookY else 1)
head_angle = clamp(head_angle, -1.5, 1.5)
head_angle = clamp(head_angle, deg_to_rad(-max_look_down_angle), deg_to_rad(max_look_up_angle))
head.rotation.x = head_angle
@rpc
func sync_position(vec):
player.position = vec
@rpc
func sync_rotation(rot):
player.rotation = rot

View File

@ -6,18 +6,12 @@ class_name ViewMovement
@export var head_bob_camera : Camera3D
@export var head_bob_focus_raycast : RayCast3D
@export var enable_head_bob := true
@export var head_bob_amplitude := 0.040
@export var head_bob_frequency := 0.015
@export var target_stabilisation := false
@export_category("Tilting")
@export var enable_tilt := true
var head_bob_amplitude := 0.001
var head_bob_frequency := 0.015
var tilt_amount := 0.03
var head_bob_start_position : Vector3
func _ready() -> void:
head_bob_start_position = head_bob_camera.position
@export var tilt_amount := 0.02
func _process(delta: float) -> void:
@ -37,23 +31,24 @@ func check_motion(delta) -> void:
if !player.is_on_floor():
reset_position(delta)
return
play_motion(foot_step_motion())
play_motion(sample_lemniscate(Time.get_ticks_msec() * head_bob_frequency), delta)
func reset_position(delta) -> void:
if head_bob_camera.position != head_bob_start_position:
head_bob_camera.position = lerp(head_bob_camera.position, head_bob_start_position, 10.0 * delta)
if head_bob_camera.position != Vector3.ZERO:
head_bob_camera.position = lerp(head_bob_camera.position, Vector3.ZERO, 7.0 * delta)
func foot_step_motion() -> Vector3:
var pos := Vector3.ZERO
pos.y += cos(Time.get_ticks_msec() * head_bob_frequency) * head_bob_amplitude
pos.x += cos(Time.get_ticks_msec() * head_bob_frequency / 2.0) * head_bob_amplitude * 2.0
func sample_lemniscate(t: float) -> Vector2:
var pos := Vector2.ZERO
pos.y += sin(t) * head_bob_amplitude
pos.x += cos(t / 2.0) * head_bob_amplitude * 2.0
return pos
func play_motion(motion: Vector3) -> void:
head_bob_camera.position += motion
func play_motion(motion: Vector2, delta) -> void:
var motion3d = Vector3(motion.x, motion.y, 0.0)
head_bob_camera.position = lerp(head_bob_camera.position, motion3d, 7.0 * delta)
func focus_target() -> Vector3:

View File

@ -20,7 +20,6 @@ target_position = Vector3(0, 0, -20)
collision_mask = 25
[node name="WallPreview" parent="." instance=ExtResource("2_r3632")]
visible = false
[node name="ProgressBar" type="TextureProgressBar" parent="."]
anchors_preset = 8

View File

@ -0,0 +1,25 @@
[gd_scene load_steps=7 format=3 uid="uid://8d452unjpoiu"]
[ext_resource type="Script" path="res://Scripts/inventory.gd" id="1_6ftnx"]
[ext_resource type="Resource" uid="uid://deer0awg4d18o" path="res://PCs/Universal/ClassCards/Assault/card_assault.tres" id="2_hayav"]
[ext_resource type="Resource" uid="uid://bibx2my7igspq" path="res://PCs/Universal/ClassCards/Fireball/card_fireball.tres" id="3_sq8ai"]
[ext_resource type="Resource" uid="uid://b3o112jw3loiu" path="res://PCs/Universal/ClassCards/Reactor/card_reactor.tres" id="4_3jmlk"]
[sub_resource type="BoxShape3D" id="BoxShape3D_lscco"]
[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_b3jqa"]
albedo_color = Color(0.509804, 0.505882, 0, 1)
[node name="ItemContainer" type="StaticBody3D"]
[node name="Inventory" type="Node" parent="."]
script = ExtResource("1_6ftnx")
contents = Array[Resource("res://Scripts/Resources/item.gd")]([ExtResource("2_hayav"), ExtResource("3_sq8ai"), ExtResource("4_3jmlk")])
[node name="CollisionShape3D" type="CollisionShape3D" parent="."]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.5, 0)
shape = SubResource("BoxShape3D_lscco")
[node name="CSGBox3D" type="CSGBox3D" parent="."]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.5, 0)
material = SubResource("StandardMaterial3D_b3jqa")

View File

@ -20,8 +20,13 @@ var tower_frames = []
var wall_id = 0
func toggle_point(point_id):
networked_toggle_point.rpc(point_id)
func toggle_point(point_id, caller_id):
networked_toggle_point.rpc(point_id, caller_id)
func remove_wall(wall : TowerBase):
networked_remove_wall.rpc(wall.point_id)
toggle_point(wall.point_id, multiplayer.get_unique_id())
func point_is_build_location(point_id):
@ -42,15 +47,15 @@ func test_path_if_point_toggled(point_id) -> bool:
@rpc("reliable", "any_peer", "call_local")
func networked_toggle_point(point_id):
func networked_toggle_point(point_id, caller_id):
if astar.is_point_disabled(point_id):
astar.set_point_disabled(point_id, false)
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)
if is_multiplayer_authority() and astar.is_point_disabled(point_id):
networked_spawn_wall.rpc(astar.get_point_position(point_id), wall_id, caller_id)
wall_id += 1
@ -131,11 +136,13 @@ func disable_path_tower_frames():
@rpc("reliable", "call_local")
func networked_spawn_wall(pos : Vector3, name_id : int):
func networked_spawn_wall(pos : Vector3, name_id : int, caller_id : int):
var base = tower_base_scene.instantiate() as TowerBase
base.position = pos
base.name = "Wall" + str(name_id)
base.owner_id = caller_id
var point_id = astar.get_closest_point(pos, true)
base.point_id = point_id
tower_base_ids[point_id] = base
tower_bases.append(base)
tower_path.add_child(base)
@ -157,6 +164,27 @@ func networked_spawn_wall(pos : Vector3, name_id : int):
tower_base_ids[west_point].set_east_wall(true)
@rpc("reliable", "call_local", "any_peer")
func networked_remove_wall(wall_id: int):
var wall = tower_base_ids[wall_id]
Game.connected_players_nodes[wall.owner_id].currency += Data.wall_cost
tower_bases.erase(wall)
tower_base_ids.erase(wall_id)
wall.queue_free()
var north_point = get_north_point(wall_id)
var south_point = get_south_point(wall_id)
var east_point = get_east_point(wall_id)
var west_point = get_west_point(wall_id)
if north_point >= 0 and astar.is_point_disabled(north_point):
tower_base_ids[north_point].set_south_wall(false)
if south_point >= 0 and astar.is_point_disabled(south_point):
tower_base_ids[south_point].set_north_wall(false)
if east_point >= 0 and astar.is_point_disabled(east_point):
tower_base_ids[east_point].set_west_wall(false)
if west_point >= 0 and astar.is_point_disabled(west_point):
tower_base_ids[west_point].set_east_wall(false)
func build_random_maze(block_limit):
var untested_point_ids = []
for index in (grid_size.x * grid_size.y):
@ -167,7 +195,7 @@ func build_random_maze(block_limit):
var random_point = untested_point_ids.pick_random()
untested_point_ids.erase(random_point)
if test_path_if_point_toggled(random_point):
networked_toggle_point.rpc(random_point)
networked_toggle_point.rpc(random_point, multiplayer.get_unique_id())
func place_random_towers(tower_limit):
@ -177,7 +205,7 @@ func place_random_towers(tower_limit):
for index in tower_limit:
var random_base = untowered_bases.pick_random() as TowerBase
untowered_bases.erase(random_base)
random_base.add_card(Data.cards.pick_random())
random_base.add_card(Data.cards.pick_random(), multiplayer.get_unique_id())
func find_path() -> bool:

View File

@ -1,12 +1,10 @@
extends Resource
extends Item
class_name Card
enum Faction {GENERIC = 0}
@export var title : String
@export var rarity : Data.Rarity
@export var faction : Faction
@export var sprite : Texture
@export var turret_scene : PackedScene
@export var weapon_scene : PackedScene
@export var weapon_stats : CardText

View File

@ -0,0 +1,5 @@
extends Resource
class_name Item
@export var display_name : String
@export var icon : Texture

View File

@ -8,6 +8,7 @@ class_name Tower
@export var range_indicator : CSGSphere3D
@export var audio_player : AudioStreamPlayer3D
var owner_id : int
var damage_particle_scene = preload("res://Scenes/damage_particle.tscn")
var base_name
var targeted_enemy

View File

@ -9,7 +9,7 @@ var stats : Card
func set_card(value):
stats = value
title_text.text = stats.title
title_text.text = stats.display_name
target_label.text = str(Data.TargetType.keys()[stats.tower_stats.target_type])
rarity_sprite.region_rect = Rect2(64 * stats.rarity, 0, 64, 64)

View File

@ -15,6 +15,7 @@ var valid_point := false
var is_looking_at_tower_base := false
var tower_preview
var last_tower_base
var last_collider
var last_card
var ray_collider
var ray_point
@ -46,25 +47,50 @@ func _process(delta: float) -> void:
set_progress_percent(0)
interacted_once = true
build_wall()
if interact_key_held and !interacted_once and last_collider and ray.is_colliding():
interact_held_time += delta
set_progress_percent(interact_held_time / interact_hold_time)
if interact_held_time >= interact_hold_time:
set_progress_percent(0)
interacted_once = true
refund_wall(last_collider)
if !interact_key_held:
interact_held_time = 0.0
interacted_once = false
set_progress_percent(0)
point_id = -1
if ray.is_colliding():
if !interacted_once and ray.is_colliding():
if !interact_key_held:
wall_preview.set_visible(true)
ray_collider = ray.get_collider()
ray_point = ray.get_collision_point()
is_looking_at_tower_base = ray_collider is TowerBase
if is_looking_at_tower_base and inventory.contents.size() > 0 and !ray_collider.has_card:
if ray_collider != last_tower_base or inventory.selected_item != last_card:
spawn_tower_preview()
elif tower_preview:
delete_tower_preview()
if Game.level:
if is_looking_at_tower_base:
valid_point = false
point_id = ray_collider.point_id
if obstacle_last_point != point_id:
obstacle_last_point = point_id
if is_instance_valid(last_collider):
Game.level.a_star_graph_3d.tower_base_ids[last_collider.point_id].set_material(null)
last_collider = null
if tower_preview:
delete_tower_preview()
wall_preview.set_visible(false)
last_collider = ray_collider
ray_collider.set_material(build_preview_material)
build_preview_material.albedo_color = Color.RED
build_preview_material.albedo_color.a = 1.0
if inventory.contents.size() > 0 and !ray_collider.has_card:
if ray_collider != last_tower_base or inventory.selected_item != last_card:
spawn_tower_preview()
elif Game.level:
if is_instance_valid(last_collider):
Game.level.a_star_graph_3d.tower_base_ids[last_collider.point_id].set_material(null)
last_collider = null
if tower_preview:
delete_tower_preview()
point_id = Game.level.a_star_graph_3d.astar.get_closest_point(ray_point)
if !Game.level.a_star_graph_3d.point_is_build_location(point_id) or hero.currency < Data.wall_cost:
wall_preview.set_visible(false)
@ -75,8 +101,8 @@ 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
@ -107,7 +133,7 @@ func spawn_tower_preview():
func delete_tower_preview():
last_tower_base = null
last_card = null
if tower_preview:
if is_instance_valid(tower_preview):
tower_preview.queue_free()
tower_preview = null
@ -121,15 +147,22 @@ func interact():
func build_wall():
if point_id >= 0 and valid_point and hero.currency >= Data.wall_cost:
hero.currency -= Data.wall_cost
Game.level.a_star_graph_3d.toggle_point(point_id)
Game.level.a_star_graph_3d.toggle_point(point_id, multiplayer.get_unique_id())
wall_preview.set_visible(false)
func refund_wall(wall: TowerBase):
last_collider = null
if wall.has_card:
wall.remove_card()
Game.level.a_star_graph_3d.remove_wall(wall)
func put_card_in_tower_base(tower_base: TowerBase):
if tower_base.has_card:
inventory.add(tower_base.remove_card())
tower_base.remove_card()
else:
tower_base.add_card(inventory.remove())
tower_base.add_card(inventory.remove(), multiplayer.get_unique_id())
func set_progress_percent(value: float):

View File

@ -5,37 +5,37 @@ signal item_added(item)
signal item_removed(item)
@export var max_size := 0
var contents : Array[Card] = []
@export var contents : Array[Item] = []
var selected_index := 0
var selected_item : Card :
var selected_item : Item :
get:
return contents[selected_index] if contents.size() > 0 else null
set(_value):
return
func add(card : Card) -> bool:
if card != null and contents.size() < max_size or max_size == 0:
contents.append(card)
item_added.emit(card)
networked_add.rpc(Data.cards.find(card))
func add(item : Item) -> bool:
if item != null and contents.size() < max_size or max_size == 0:
contents.append(item)
item_added.emit(item)
networked_add.rpc(Data.cards.find(item))
return true
return false
func remove_at(index : int) -> Card:
func remove_at(index : int) -> Item:
if contents.size() <= 0:
return null
var card = contents[index]
var item = contents[index]
contents.remove_at(index)
if selected_index >= contents.size() and selected_index > 0:
selected_index -= 1
item_removed.emit(card)
item_removed.emit(item)
networked_remove_at.rpc(index)
return card
return item
func remove() -> Card:
func remove() -> Item:
return remove_at(selected_index)

View File

@ -0,0 +1 @@
extends StaticBody3D

View File

@ -38,19 +38,19 @@ func randomize_cards():
cards[x].set_card(chosen_card)
cards[x].view_tower()
choice_buttons[x].press_cost = price_dict[chosen_card.rarity]
choice_buttons[x].hover_text = "Spend $" + str(choice_buttons[x].press_cost) + " to acquire " + chosen_card.title + "?"
choice_buttons[x].hover_text = "Spend $" + str(choice_buttons[x].press_cost) + " to acquire " + chosen_card.display_name + "?"
for x in 2:
var chosen_card = medium_cards.pick_random()
cards[x+3].set_card(chosen_card)
cards[x+3].view_tower()
choice_buttons[x+3].press_cost = price_dict[chosen_card.rarity]
choice_buttons[x+3].hover_text = "Spend $" + str(choice_buttons[x+3].press_cost) + " to acquire " + chosen_card.title + "?"
choice_buttons[x+3].hover_text = "Spend $" + str(choice_buttons[x+3].press_cost) + " to acquire " + chosen_card.display_name + "?"
for x in 1:
var chosen_card = pricey_cards.pick_random()
cards[x+5].set_card(chosen_card)
cards[x+5].view_tower()
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 + "?"
choice_buttons[x+5].hover_text = "Spend $" + str(choice_buttons[x+5].press_cost) + " to acquire " + chosen_card.display_name + "?"
for x in choice_colliders:
x.set_deferred("disabled", false)
for x in choice_sprites:

View File

@ -14,6 +14,8 @@ class_name TowerBase
@export var east_collider : CollisionShape3D
@export var west_collider : CollisionShape3D
var owner_id : int
var point_id : int
var tower = null
var has_card : bool :
set(_value):
@ -22,16 +24,16 @@ var has_card : bool :
return inventory.contents.size() != 0
func add_card(card: Card) -> bool:
func add_card(card: Card, caller_id: int) -> bool:
var result = inventory.add(card)
if result:
networked_spawn_tower.rpc()
networked_spawn_tower.rpc(caller_id)
return result
func remove_card() -> Card:
func remove_card():
Game.connected_players_nodes[tower.owner_id].add_card(inventory.remove())
networked_remove_tower.rpc()
return inventory.remove()
func set_material(value: StandardMaterial3D):
@ -42,7 +44,7 @@ func toggle_collision():
collider.disabled = !collider.disabled
func set_north_wall(value : bool):
func set_north_wall(value: bool):
north_mesh.set_visible(value)
north_collider.disabled = !value
@ -63,11 +65,12 @@ func set_west_wall(value : bool):
@rpc("reliable", "call_local", "any_peer")
func networked_spawn_tower():
func networked_spawn_tower(caller_id : int):
tower = inventory.selected_item.turret_scene.instantiate() as Tower
tower.stats = inventory.selected_item.tower_stats
tower.name = "tower"
tower.base_name = name
tower.owner_id = caller_id
tower.position = Vector3(0, 1.2, 0)
minimap_icon.modulate = Color.RED
add_child(tower)

37
motion_test.gd Normal file
View File

@ -0,0 +1,37 @@
extends Sprite2D
#var head_bob_amplitude := 100.0
@export var head_bob_amplitude := 50.0
#var head_bob_amplitude := 1.0
@export var head_bob_frequency := 0.015
#var head_bob_frequency := 0.030
func _process(delta: float) -> void:
check_motion(delta)
func check_motion(delta) -> void:
if Input.is_action_pressed("Primary Fire"):
play_motion(foot_step_motion(), delta)
else:
reset_position(delta)
func reset_position(delta) -> void:
if position != Vector2.ZERO:
position = lerp(position, Vector2.ZERO, 10.0 * delta)
func foot_step_motion() -> Vector2:
var pos := Vector2.ZERO
var t = Time.get_ticks_msec() * head_bob_frequency
pos.y += sin(t) * head_bob_amplitude
pos.x += cos(t / 2.0) * head_bob_amplitude * 2.0
return pos
func play_motion(motion: Vector2, delta) -> void:
position = lerp(position, motion, 10.0 * delta)
#position = motion
#position += motion

27
node_2d.tscn Normal file
View File

@ -0,0 +1,27 @@
[gd_scene load_steps=4 format=3 uid="uid://52e5sm81wqjh"]
[ext_resource type="Texture2D" uid="uid://cy786nrpcdr5o" path="res://Assets/Textures/minimap_path_visual.png" id="1_7omn8"]
[ext_resource type="Script" path="res://motion_test.gd" id="2_3ps2v"]
[sub_resource type="ParticleProcessMaterial" id="ParticleProcessMaterial_u1ue0"]
particle_flag_disable_z = true
gravity = Vector3(0, 0, 0)
scale_min = 10.0
scale_max = 10.0
[node name="Node2D" type="Node2D"]
[node name="Camera2D" type="Camera2D" parent="."]
[node name="Sprite2D" type="Sprite2D" parent="."]
texture = ExtResource("1_7omn8")
script = ExtResource("2_3ps2v")
[node name="GPUParticles2D" type="GPUParticles2D" parent="Sprite2D"]
amount = 100
process_material = SubResource("ParticleProcessMaterial_u1ue0")
lifetime = 2.0
[node name="Sprite2D2" type="Sprite2D" parent="."]
modulate = Color(1, 0, 0, 1)
texture = ExtResource("1_7omn8")

View File

@ -26,6 +26,17 @@ WaveManager="*res://Scripts/wave_manager.gd"
window/size/viewport_width=1920
window/size/viewport_height=1080
[file_customization]
folder_colors={
"res://Assets/": "purple",
"res://PCs/": "blue",
"res://Resources/": "green",
"res://Scenes/": "yellow",
"res://Scripts/": "red",
"res://Worlds/": "teal"
}
[filesystem]
import/blender/enabled=false