juiced the camera a bit and limited weapon ammo

This commit is contained in:
Lexi Quinn 2023-11-27 13:52:46 +11:00
parent f631654626
commit 66f7131c1b
28 changed files with 406 additions and 124 deletions

View File

@ -1,4 +1,4 @@
[gd_resource type="Resource" script_class="CardText" load_steps=6 format=3 uid="uid://smctw4ogm4rx"] [gd_resource type="Resource" script_class="CardText" load_steps=7 format=3 uid="uid://smctw4ogm4rx"]
[ext_resource type="Script" path="res://Scripts/Resources/card_text.gd" id="1_gk542"] [ext_resource type="Script" path="res://Scripts/Resources/card_text.gd" id="1_gk542"]
[ext_resource type="Script" path="res://Scripts/Resources/stat_attribute.gd" id="1_qt3yl"] [ext_resource type="Script" path="res://Scripts/Resources/stat_attribute.gd" id="1_qt3yl"]
@ -18,8 +18,13 @@ script = ExtResource("1_qt3yl")
key = "Fire Delay" key = "Fire Delay"
value = 0.2 value = 0.2
[sub_resource type="Resource" id="Resource_8cirl"]
script = ExtResource("1_qt3yl")
key = "Energy"
value = 2.0
[resource] [resource]
script = ExtResource("1_gk542") script = ExtResource("1_gk542")
target_type = 0 target_type = 0
attributes = Array[ExtResource("1_qt3yl")]([SubResource("Resource_bcrtt"), SubResource("Resource_llper"), SubResource("Resource_7i2dt")]) attributes = Array[ExtResource("1_qt3yl")]([SubResource("Resource_bcrtt"), SubResource("Resource_llper"), SubResource("Resource_7i2dt"), SubResource("Resource_8cirl")])
text = "Fires a shot every /Fire Delay\\ seconds dealing /Damage\\ damage at a range of /Range\\m" text = "Fires a shot every /Fire Delay\\ seconds dealing /Damage\\ damage at a range of /Range\\m"

View File

@ -1,4 +1,4 @@
[gd_resource type="Resource" script_class="CardText" load_steps=6 format=3 uid="uid://c6e50linnk2i7"] [gd_resource type="Resource" script_class="CardText" load_steps=7 format=3 uid="uid://c6e50linnk2i7"]
[ext_resource type="Script" path="res://Scripts/Resources/card_text.gd" id="1_5ldx7"] [ext_resource type="Script" path="res://Scripts/Resources/card_text.gd" id="1_5ldx7"]
[ext_resource type="Script" path="res://Scripts/Resources/stat_attribute.gd" id="1_pw5it"] [ext_resource type="Script" path="res://Scripts/Resources/stat_attribute.gd" id="1_pw5it"]
@ -18,8 +18,13 @@ script = ExtResource("1_pw5it")
key = "Fire Delay" key = "Fire Delay"
value = 0.8 value = 0.8
[sub_resource type="Resource" id="Resource_dtjel"]
script = ExtResource("1_pw5it")
key = "Energy"
value = 15.0
[resource] [resource]
script = ExtResource("1_5ldx7") script = ExtResource("1_5ldx7")
target_type = 0 target_type = 0
attributes = Array[ExtResource("1_pw5it")]([SubResource("Resource_1txa7"), SubResource("Resource_46kv2"), SubResource("Resource_gb76x")]) attributes = Array[ExtResource("1_pw5it")]([SubResource("Resource_1txa7"), SubResource("Resource_46kv2"), SubResource("Resource_gb76x"), SubResource("Resource_dtjel")])
text = "Fires every /Fire Delay\\s, applying one stack of Poison at a range of /Range\\m" text = "Fires every /Fire Delay\\s, applying one stack of Poison at a range of /Range\\m"

View File

@ -1,4 +1,4 @@
[gd_resource type="Resource" script_class="CardText" load_steps=6 format=3 uid="uid://co6eorobj1xuu"] [gd_resource type="Resource" script_class="CardText" load_steps=7 format=3 uid="uid://co6eorobj1xuu"]
[ext_resource type="Script" path="res://Scripts/Resources/card_text.gd" id="1_8i32s"] [ext_resource type="Script" path="res://Scripts/Resources/card_text.gd" id="1_8i32s"]
[ext_resource type="Script" path="res://Scripts/Resources/stat_attribute.gd" id="1_kj8v0"] [ext_resource type="Script" path="res://Scripts/Resources/stat_attribute.gd" id="1_kj8v0"]
@ -18,8 +18,13 @@ script = ExtResource("1_kj8v0")
key = "Range" key = "Range"
value = 10.0 value = 10.0
[sub_resource type="Resource" id="Resource_67t30"]
script = ExtResource("1_kj8v0")
key = "Energy"
value = 10.0
[resource] [resource]
script = ExtResource("1_8i32s") script = ExtResource("1_8i32s")
target_type = 0 target_type = 0
attributes = Array[ExtResource("1_kj8v0")]([SubResource("Resource_yb48y"), SubResource("Resource_ewwvw"), SubResource("Resource_qu5dv")]) attributes = Array[ExtResource("1_kj8v0")]([SubResource("Resource_yb48y"), SubResource("Resource_ewwvw"), SubResource("Resource_qu5dv"), SubResource("Resource_67t30")])
text = "Launch a bomb that deals /Damage\\ damage every /Fire Delay\\ seconds" text = "Launch a bomb that deals /Damage\\ damage every /Fire Delay\\ seconds"

View File

@ -1,4 +1,4 @@
[gd_resource type="Resource" script_class="CardText" load_steps=6 format=3 uid="uid://dhwhwicgpw7yh"] [gd_resource type="Resource" script_class="CardText" load_steps=7 format=3 uid="uid://dhwhwicgpw7yh"]
[ext_resource type="Script" path="res://Scripts/Resources/stat_attribute.gd" id="1_80jfw"] [ext_resource type="Script" path="res://Scripts/Resources/stat_attribute.gd" id="1_80jfw"]
[ext_resource type="Script" path="res://Scripts/Resources/card_text.gd" id="1_hmbwy"] [ext_resource type="Script" path="res://Scripts/Resources/card_text.gd" id="1_hmbwy"]
@ -18,8 +18,13 @@ script = ExtResource("1_80jfw")
key = "Range" key = "Range"
value = 15.0 value = 15.0
[sub_resource type="Resource" id="Resource_y1gjj"]
script = ExtResource("1_80jfw")
key = "Energy"
value = 20.0
[resource] [resource]
script = ExtResource("1_hmbwy") script = ExtResource("1_hmbwy")
target_type = 0 target_type = 0
attributes = Array[ExtResource("1_80jfw")]([SubResource("Resource_68ba3"), SubResource("Resource_gogvm"), SubResource("Resource_pswb4")]) attributes = Array[ExtResource("1_80jfw")]([SubResource("Resource_68ba3"), SubResource("Resource_gogvm"), SubResource("Resource_pswb4"), SubResource("Resource_y1gjj")])
text = "Conjure a fireball every /Fire Delay\\s that can be thrown to deal /Damage\\ and apply Burning to enemies caught in its blast" text = "Conjure a fireball every /Fire Delay\\s that can be thrown to deal /Damage\\ and apply Burning to enemies caught in its blast"

View File

@ -1,4 +1,4 @@
[gd_resource type="Resource" script_class="CardText" load_steps=6 format=3 uid="uid://yjknwdimtm8g"] [gd_resource type="Resource" script_class="CardText" load_steps=7 format=3 uid="uid://yjknwdimtm8g"]
[ext_resource type="Script" path="res://Scripts/Resources/card_text.gd" id="1_7qcx8"] [ext_resource type="Script" path="res://Scripts/Resources/card_text.gd" id="1_7qcx8"]
[ext_resource type="Script" path="res://Scripts/Resources/stat_attribute.gd" id="1_g5aby"] [ext_resource type="Script" path="res://Scripts/Resources/stat_attribute.gd" id="1_g5aby"]
@ -18,8 +18,13 @@ script = ExtResource("1_g5aby")
key = "Range" key = "Range"
value = 3.0 value = 3.0
[sub_resource type="Resource" id="Resource_rjpjf"]
script = ExtResource("1_g5aby")
key = "Energy"
value = 6.0
[resource] [resource]
script = ExtResource("1_7qcx8") script = ExtResource("1_7qcx8")
target_type = 0 target_type = 0
attributes = Array[ExtResource("1_g5aby")]([SubResource("Resource_j28f4"), SubResource("Resource_likes"), SubResource("Resource_b65mk")]) attributes = Array[ExtResource("1_g5aby")]([SubResource("Resource_j28f4"), SubResource("Resource_likes"), SubResource("Resource_b65mk"), SubResource("Resource_rjpjf")])
text = "Hold to apply Burning to enemies in front of you" text = "Hold to apply Burning to enemies in front of you"

View File

@ -21,11 +21,13 @@ func _process(delta: float) -> void:
time_since_firing_started += delta time_since_firing_started += delta
var progress = clamp(time_since_firing_started / time_to_reach_max_speed, 0, 1.0) var progress = clamp(time_since_firing_started / time_to_reach_max_speed, 0, 1.0)
current_time_between_shots = lerpf(time_between_shots, final_time_between_shots, progress) current_time_between_shots = lerpf(time_between_shots, final_time_between_shots, progress)
if current_energy < energy_cost:
time_since_firing_started = 0.0
current_time_between_shots = time_between_shots
func _physics_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 time_since_firing >= current_time_between_shots:
print(current_time_between_shots)
time_since_firing -= current_time_between_shots time_since_firing -= current_time_between_shots
shoot() shoot()
networked_shoot.rpc() networked_shoot.rpc()

View File

@ -1,4 +1,4 @@
[gd_resource type="Resource" script_class="CardText" load_steps=8 format=3 uid="uid://cj2x1jvo8l4ot"] [gd_resource type="Resource" script_class="CardText" load_steps=9 format=3 uid="uid://cj2x1jvo8l4ot"]
[ext_resource type="Script" path="res://Scripts/Resources/card_text.gd" id="1_630yu"] [ext_resource type="Script" path="res://Scripts/Resources/card_text.gd" id="1_630yu"]
[ext_resource type="Script" path="res://Scripts/Resources/stat_attribute.gd" id="1_vpmor"] [ext_resource type="Script" path="res://Scripts/Resources/stat_attribute.gd" id="1_vpmor"]
@ -28,10 +28,15 @@ script = ExtResource("1_vpmor")
key = "Speed Time" key = "Speed Time"
value = 4.0 value = 4.0
[sub_resource type="Resource" id="Resource_d1lvi"]
script = ExtResource("1_vpmor")
key = "Energy"
value = 4.0
[resource] [resource]
script = ExtResource("1_630yu") script = ExtResource("1_630yu")
target_type = 0 target_type = 0
attributes = Array[ExtResource("1_vpmor")]([SubResource("Resource_fi7tc"), SubResource("Resource_r6h5d"), SubResource("Resource_gwg1i"), SubResource("Resource_ogk1x"), SubResource("Resource_wdp3h")]) attributes = Array[ExtResource("1_vpmor")]([SubResource("Resource_fi7tc"), SubResource("Resource_r6h5d"), SubResource("Resource_gwg1i"), SubResource("Resource_ogk1x"), SubResource("Resource_wdp3h"), SubResource("Resource_d1lvi")])
text = "Fires a shot every /Fire Delay\\ seconds dealing /Damage\\ damage at a range of /Range\\m text = "Fires a shot every /Fire Delay\\ seconds dealing /Damage\\ damage at a range of /Range\\m
While held, gradually accelerates to /Speed Multiplier\\x the fire rate over /Speed Time\\s" While held, gradually accelerates to /Speed Multiplier\\x the fire rate over /Speed Time\\s"

View File

@ -1,4 +1,4 @@
[gd_resource type="Resource" script_class="CardText" load_steps=6 format=3 uid="uid://boj1ho5x0sxtq"] [gd_resource type="Resource" script_class="CardText" load_steps=7 format=3 uid="uid://boj1ho5x0sxtq"]
[ext_resource type="Script" path="res://Scripts/Resources/card_text.gd" id="1_8sdo4"] [ext_resource type="Script" path="res://Scripts/Resources/card_text.gd" id="1_8sdo4"]
[ext_resource type="Script" path="res://Scripts/Resources/stat_attribute.gd" id="1_gheu8"] [ext_resource type="Script" path="res://Scripts/Resources/stat_attribute.gd" id="1_gheu8"]
@ -18,8 +18,13 @@ script = ExtResource("1_gheu8")
key = "Fire Delay" key = "Fire Delay"
value = 0.5 value = 0.5
[sub_resource type="Resource" id="Resource_o1b5x"]
script = ExtResource("1_gheu8")
key = "Energy"
value = 8.0
[resource] [resource]
script = ExtResource("1_8sdo4") script = ExtResource("1_8sdo4")
target_type = 0 target_type = 0
attributes = Array[ExtResource("1_gheu8")]([SubResource("Resource_gbocu"), SubResource("Resource_6a2im"), SubResource("Resource_7npe0")]) attributes = Array[ExtResource("1_gheu8")]([SubResource("Resource_gbocu"), SubResource("Resource_6a2im"), SubResource("Resource_7npe0"), SubResource("Resource_o1b5x")])
text = "Fires every /Fire Delay\\s, making the target Sticky at a range of /Range\\m" text = "Fires every /Fire Delay\\s, making the target Sticky at a range of /Range\\m"

View File

@ -1,4 +1,4 @@
[gd_resource type="Resource" script_class="CardText" load_steps=6 format=3 uid="uid://ckjmym1ofww4"] [gd_resource type="Resource" script_class="CardText" load_steps=7 format=3 uid="uid://ckjmym1ofww4"]
[ext_resource type="Script" path="res://Scripts/Resources/stat_attribute.gd" id="1_c13s0"] [ext_resource type="Script" path="res://Scripts/Resources/stat_attribute.gd" id="1_c13s0"]
[ext_resource type="Script" path="res://Scripts/Resources/card_text.gd" id="1_fpi27"] [ext_resource type="Script" path="res://Scripts/Resources/card_text.gd" id="1_fpi27"]
@ -18,8 +18,13 @@ script = ExtResource("1_c13s0")
key = "Range" key = "Range"
value = 15.0 value = 15.0
[sub_resource type="Resource" id="Resource_cfu7u"]
script = ExtResource("1_c13s0")
key = "Energy"
value = 20.0
[resource] [resource]
script = ExtResource("1_fpi27") script = ExtResource("1_fpi27")
target_type = 0 target_type = 0
attributes = Array[ExtResource("1_c13s0")]([SubResource("Resource_68ba3"), SubResource("Resource_gogvm"), SubResource("Resource_pswb4")]) attributes = Array[ExtResource("1_c13s0")]([SubResource("Resource_68ba3"), SubResource("Resource_gogvm"), SubResource("Resource_pswb4"), SubResource("Resource_cfu7u")])
text = "Conjure an icicle every /Fire Delay\\s that can be thrown to deal /Damage\\ and apply Cold to enemies caught in its blast" text = "Conjure an icicle every /Fire Delay\\s that can be thrown to deal /Damage\\ and apply Cold to enemies caught in its blast"

View File

@ -1,4 +1,4 @@
[gd_resource type="Resource" script_class="CardText" load_steps=6 format=3 uid="uid://ipfr7emuarbj"] [gd_resource type="Resource" script_class="CardText" load_steps=7 format=3 uid="uid://ipfr7emuarbj"]
[ext_resource type="Script" path="res://Scripts/Resources/stat_attribute.gd" id="1_biwk3"] [ext_resource type="Script" path="res://Scripts/Resources/stat_attribute.gd" id="1_biwk3"]
[ext_resource type="Script" path="res://Scripts/Resources/card_text.gd" id="2_62mnm"] [ext_resource type="Script" path="res://Scripts/Resources/card_text.gd" id="2_62mnm"]
@ -18,8 +18,13 @@ script = ExtResource("1_biwk3")
key = "Range" key = "Range"
value = 3.0 value = 3.0
[sub_resource type="Resource" id="Resource_b4805"]
script = ExtResource("1_biwk3")
key = "Energy"
value = 11.0
[resource] [resource]
script = ExtResource("2_62mnm") script = ExtResource("2_62mnm")
target_type = 0 target_type = 0
attributes = Array[ExtResource("1_biwk3")]([SubResource("Resource_j28f4"), SubResource("Resource_likes"), SubResource("Resource_b65mk")]) attributes = Array[ExtResource("1_biwk3")]([SubResource("Resource_j28f4"), SubResource("Resource_likes"), SubResource("Resource_b65mk"), SubResource("Resource_b4805")])
text = "Hold to apply Radioactive to enemies in front of you" text = "Hold to apply Radioactive to enemies in front of you"

View File

@ -1,4 +1,4 @@
[gd_resource type="Resource" script_class="CardText" load_steps=6 format=3 uid="uid://5l758yxfpi1e"] [gd_resource type="Resource" script_class="CardText" load_steps=7 format=3 uid="uid://5l758yxfpi1e"]
[ext_resource type="Script" path="res://Scripts/Resources/stat_attribute.gd" id="1_v7ces"] [ext_resource type="Script" path="res://Scripts/Resources/stat_attribute.gd" id="1_v7ces"]
[ext_resource type="Script" path="res://Scripts/Resources/card_text.gd" id="2_1d5nm"] [ext_resource type="Script" path="res://Scripts/Resources/card_text.gd" id="2_1d5nm"]
@ -18,8 +18,13 @@ script = ExtResource("1_v7ces")
key = "Range" key = "Range"
value = 3.0 value = 3.0
[sub_resource type="Resource" id="Resource_voaa5"]
script = ExtResource("1_v7ces")
key = "Energy"
value = 7.0
[resource] [resource]
script = ExtResource("2_1d5nm") script = ExtResource("2_1d5nm")
target_type = 0 target_type = 0
attributes = Array[ExtResource("1_v7ces")]([SubResource("Resource_j28f4"), SubResource("Resource_likes"), SubResource("Resource_b65mk")]) attributes = Array[ExtResource("1_v7ces")]([SubResource("Resource_j28f4"), SubResource("Resource_likes"), SubResource("Resource_b65mk"), SubResource("Resource_voaa5")])
text = "Hold to apply Cold to enemies in front of you" text = "Hold to apply Cold to enemies in front of you"

View File

@ -44,7 +44,9 @@ func _process(delta: float) -> void:
func release_trigger(): func release_trigger():
super.release_trigger() super.release_trigger()
if targets.size() > 0 and time_since_firing >= time_between_shots: if targets.size() > 0 and current_energy >= energy_cost and time_since_firing >= time_between_shots:
current_energy -= energy_cost
energy_changed.emit(current_energy)
time_since_firing -= time_between_shots time_since_firing -= time_between_shots
shoot() shoot()

View File

@ -1,4 +1,4 @@
[gd_resource type="Resource" script_class="CardText" load_steps=6 format=3 uid="uid://d2yo07m2mp2mp"] [gd_resource type="Resource" script_class="CardText" load_steps=7 format=3 uid="uid://d2yo07m2mp2mp"]
[ext_resource type="Script" path="res://Scripts/Resources/stat_attribute.gd" id="1_1le4i"] [ext_resource type="Script" path="res://Scripts/Resources/stat_attribute.gd" id="1_1le4i"]
[ext_resource type="Script" path="res://Scripts/Resources/card_text.gd" id="2_0trth"] [ext_resource type="Script" path="res://Scripts/Resources/card_text.gd" id="2_0trth"]
@ -18,8 +18,13 @@ script = ExtResource("1_1le4i")
key = "Damage" key = "Damage"
value = 8.0 value = 8.0
[sub_resource type="Resource" id="Resource_ymyed"]
script = ExtResource("1_1le4i")
key = "Energy"
value = 30.0
[resource] [resource]
script = ExtResource("2_0trth") script = ExtResource("2_0trth")
target_type = 0 target_type = 0
attributes = Array[ExtResource("1_1le4i")]([SubResource("Resource_4fjm2"), SubResource("Resource_uwj4j"), SubResource("Resource_6qv5v")]) attributes = Array[ExtResource("1_1le4i")]([SubResource("Resource_4fjm2"), SubResource("Resource_uwj4j"), SubResource("Resource_6qv5v"), SubResource("Resource_ymyed")])
text = "Every /Fire Delay\\s, hold to target up to /Target Limit\\ enemies and release to fire homing rockets that deal /Damage\\ damage" text = "Every /Fire Delay\\s, hold to target up to /Target Limit\\ enemies and release to fire homing rockets that deal /Damage\\ damage"

View File

@ -14,7 +14,7 @@ region = Rect2(0, 0, 64, 64)
[resource] [resource]
script = ExtResource("1_5vmtk") script = ExtResource("1_5vmtk")
title = "Sniper" title = "Sniper"
rarity = 4 rarity = 1
faction = 0 faction = 0
sprite = SubResource("AtlasTexture_fckie") sprite = SubResource("AtlasTexture_fckie")
turret_scene = ExtResource("4_k5nhs") turret_scene = ExtResource("4_k5nhs")

View File

@ -1,4 +1,4 @@
[gd_resource type="Resource" script_class="CardText" load_steps=6 format=3 uid="uid://3y7n1vdvf822"] [gd_resource type="Resource" script_class="CardText" load_steps=7 format=3 uid="uid://3y7n1vdvf822"]
[ext_resource type="Script" path="res://Scripts/Resources/stat_attribute.gd" id="1_7xbx2"] [ext_resource type="Script" path="res://Scripts/Resources/stat_attribute.gd" id="1_7xbx2"]
[ext_resource type="Script" path="res://Scripts/Resources/card_text.gd" id="1_t3oy2"] [ext_resource type="Script" path="res://Scripts/Resources/card_text.gd" id="1_t3oy2"]
@ -18,8 +18,13 @@ script = ExtResource("1_7xbx2")
key = "Range" key = "Range"
value = 100.0 value = 100.0
[sub_resource type="Resource" id="Resource_7pvmq"]
script = ExtResource("1_7xbx2")
key = "Energy"
value = 10.0
[resource] [resource]
script = ExtResource("1_t3oy2") script = ExtResource("1_t3oy2")
target_type = 0 target_type = 0
attributes = Array[ExtResource("1_7xbx2")]([SubResource("Resource_58kde"), SubResource("Resource_jl4jv"), SubResource("Resource_28kyj")]) attributes = Array[ExtResource("1_7xbx2")]([SubResource("Resource_58kde"), SubResource("Resource_jl4jv"), SubResource("Resource_28kyj"), SubResource("Resource_7pvmq")])
text = "Fires a shot every /Fire Delay\\ seconds dealing /Damage\\ damage at a range of /Range\\m" text = "Fires a shot every /Fire Delay\\ seconds dealing /Damage\\ damage at a range of /Range\\m"

View File

@ -175,6 +175,7 @@ func pause():
func enter_editing_mode(value): func enter_editing_mode(value):
hud.set_wave_count(value + 1) hud.set_wave_count(value + 1)
hud.set_energy_visible(false)
editing_mode = true editing_mode = true
edit_tool.enabled = true edit_tool.enabled = true
check_left_hand_valid() check_left_hand_valid()
@ -184,10 +185,14 @@ func enter_editing_mode(value):
func exit_editing_mode(value): func exit_editing_mode(value):
hud.set_wave_count(value) hud.set_wave_count(value)
hud.set_energy_visible(true)
edit_tool.enabled = false edit_tool.enabled = false
edit_tool.delete_tower_preview() edit_tool.delete_tower_preview()
left_hand.set_visible(false) left_hand.set_visible(false)
editing_mode = false editing_mode = false
if weapon:
weapon.current_energy = weapon.max_energy
weapon.energy_changed.emit(weapon.current_energy)
func check_left_hand_valid(): func check_left_hand_valid():
@ -210,6 +215,7 @@ func equip_weapon():
equipped_card = inventory.remove() equipped_card = inventory.remove()
networked_equip_weapon.rpc(Data.cards.find(equipped_card)) networked_equip_weapon.rpc(Data.cards.find(equipped_card))
weapon = equipped_card.weapon_scene.instantiate() 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()) weapon.set_multiplayer_authority(multiplayer.get_unique_id())
gauntlet_sprite.set_visible(false) gauntlet_sprite.set_visible(false)

View File

@ -1,15 +1,15 @@
[gd_scene load_steps=30 format=3 uid="uid://dxgxbtf68lcv5"] [gd_scene load_steps=33 format=3 uid="uid://dxgxbtf68lcv5"]
[ext_resource type="Script" path="res://PCs/hero.gd" id="1_pihpe"] [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"] [ext_resource type="Resource" uid="uid://b5pc3frhx467q" path="res://PCs/Red/red.tres" id="2_dbyo0"]
[ext_resource type="PackedScene" uid="uid://ri8r03wqy80t" path="res://Scenes/8_direction_sprite.tscn" id="2_ib0t5"] [ext_resource type="PackedScene" uid="uid://ri8r03wqy80t" path="res://Scenes/8_direction_sprite.tscn" id="2_ib0t5"]
[ext_resource type="Texture2D" uid="uid://dkbkam81k355s" path="res://Assets/TextureAtlases/gauntlet.tres" id="3_5myy0"] [ext_resource type="Texture2D" uid="uid://dkbkam81k355s" path="res://Assets/TextureAtlases/gauntlet.tres" id="3_5myy0"]
[ext_resource type="PackedScene" uid="uid://buvgdem68wtev" path="res://Scenes/Menus/pause_menu.tscn" id="3_avnsx"] [ext_resource type="PackedScene" uid="uid://buvgdem68wtev" path="res://Scenes/Menus/pause_menu.tscn" id="3_avnsx"]
[ext_resource type="Script" path="res://PCs/view_movement.gd" id="4_mhexa"]
[ext_resource type="PackedScene" uid="uid://dixtx38u4jhd7" path="res://Scenes/UI/card_hand.tscn" id="4_mwtvp"] [ext_resource type="PackedScene" uid="uid://dixtx38u4jhd7" path="res://Scenes/UI/card_hand.tscn" id="4_mwtvp"]
[ext_resource type="PackedScene" uid="uid://dqt1ggtkpkuhs" path="res://Scenes/gauntlet.tscn" id="5_jlxb3"] [ext_resource type="PackedScene" uid="uid://dqt1ggtkpkuhs" path="res://Scenes/gauntlet.tscn" id="5_jlxb3"]
[ext_resource type="Script" path="res://Scripts/inventory.gd" id="6_cf5ap"] [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="Texture2D" uid="uid://cjqxkraykhxxk" path="res://PCs/Red/red.png" id="6_yyp8i"]
[ext_resource type="Texture2D" uid="uid://d0btebva6djdl" path="res://Assets/Textures/crosshair.png" id="8_fq3f6"]
[ext_resource type="Script" path="res://Scripts/HUD.gd" id="8_yl6ka"] [ext_resource type="Script" path="res://Scripts/HUD.gd" id="8_yl6ka"]
[ext_resource type="Script" path="res://Scripts/on_top_camera.gd" id="11_4sdwe"] [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="Script" path="res://Scripts/minimap_cam.gd" id="12_3hpi3"]
@ -19,10 +19,12 @@
[ext_resource type="Texture2D" uid="uid://chhmkmlfrobhu" path="res://Assets/Textures/bubble.png" id="15_q3yot"] [ext_resource type="Texture2D" uid="uid://chhmkmlfrobhu" path="res://Assets/Textures/bubble.png" id="15_q3yot"]
[ext_resource type="Texture2D" uid="uid://cqnapc8cscl7i" path="res://Assets/Textures/border.png" id="16_x1xjr"] [ext_resource type="Texture2D" uid="uid://cqnapc8cscl7i" path="res://Assets/Textures/border.png" id="16_x1xjr"]
[ext_resource type="Script" path="res://PCs/player_movement.gd" id="20_cfhw8"] [ext_resource type="Script" path="res://PCs/player_movement.gd" id="20_cfhw8"]
[ext_resource type="Shader" path="res://crosshair.gdshader" id="20_gxpgc"]
[ext_resource type="Texture2D" uid="uid://r202vo47jw1q" path="res://Assets/Textures/enemyhealth.png" id="21_apps2"]
[sub_resource type="CapsuleShape3D" id="CapsuleShape3D_jbu13"] [sub_resource type="CapsuleShape3D" id="CapsuleShape3D_jbu13"]
[sub_resource type="AtlasTexture" id="AtlasTexture_a5vl4"] [sub_resource type="AtlasTexture" id="AtlasTexture_4d5kf"]
resource_local_to_scene = true resource_local_to_scene = true
atlas = ExtResource("6_yyp8i") atlas = ExtResource("6_yyp8i")
region = Rect2(0, 0, 96, 96) region = Rect2(0, 0, 96, 96)
@ -53,29 +55,44 @@ viewport_path = NodePath("SubViewport/Head2/LeftHand/SubViewport")
background_mode = 1 background_mode = 1
background_color = Color(0.282353, 0.615686, 0.278431, 1) background_color = Color(0.282353, 0.615686, 0.278431, 1)
[sub_resource type="ViewportTexture" id="ViewportTexture_m3ots"]
viewport_path = NodePath("Nametag")
[sub_resource type="ViewportTexture" id="ViewportTexture_mk87g"] [sub_resource type="ViewportTexture" id="ViewportTexture_mk87g"]
viewport_path = NodePath("SubViewport") viewport_path = NodePath("SubViewport")
[sub_resource type="ViewportTexture" id="ViewportTexture_574jy"] [sub_resource type="ViewportTexture" id="ViewportTexture_574jy"]
viewport_path = NodePath("MiniMapViewport") viewport_path = NodePath("MiniMapViewport")
[sub_resource type="ViewportTexture" id="ViewportTexture_m3ots"] [sub_resource type="ShaderMaterial" id="ShaderMaterial_lg5jo"]
viewport_path = NodePath("Nametag") shader = ExtResource("20_gxpgc")
shader_parameter/center_enabled = true
shader_parameter/legs_enabled = true
shader_parameter/inverted = false
shader_parameter/color_id = 0
shader_parameter/color_0 = Vector4(1, 0, 0, 0.95)
shader_parameter/color_1 = Vector4(1, 0, 0, 1)
shader_parameter/color_2 = Vector4(0, 0, 1, 1)
shader_parameter/center_radius = 0.002
shader_parameter/width = 0.002
shader_parameter/len = 0.015
shader_parameter/spacing = 0.008
shader_parameter/spread = 1.0
[node name="Character" 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", "right_hand", "right_hand_animator", "edit_tool", "gauntlet_sprite", "sprite", "interaction_raycast", "inventory", "card", "hud", "movement", "player_name_tag")]
collision_layer = 2 collision_layer = 2
collision_mask = 37 collision_mask = 37
script = ExtResource("1_pihpe") script = ExtResource("1_pihpe")
hero_class = ExtResource("2_dbyo0") hero_class = ExtResource("2_dbyo0")
camera = NodePath("Head") camera = NodePath("ViewMovement/Head")
gun_camera = NodePath("SubViewport/Head2") gun_camera = NodePath("SubViewport/Head2")
left_hand = NodePath("SubViewport/Head2/LeftHand") left_hand = NodePath("SubViewport/Head2/LeftHand")
right_hand = NodePath("SubViewport/Head2/RightHand") right_hand = NodePath("SubViewport/Head2/RightHand")
right_hand_animator = NodePath("SubViewport/Head2/RightHand/AnimationPlayer") right_hand_animator = NodePath("SubViewport/Head2/RightHand/AnimationPlayer")
edit_tool = NodePath("Head/EditTool") edit_tool = NodePath("ViewMovement/Head/EditTool")
gauntlet_sprite = NodePath("SubViewport/Head2/RightHand/Gauntlet") gauntlet_sprite = NodePath("SubViewport/Head2/RightHand/Gauntlet")
sprite = NodePath("EightDirectionSprite") sprite = NodePath("EightDirectionSprite")
interaction_raycast = NodePath("Head/RayCast3D") interaction_raycast = NodePath("ViewMovement/Head/RayCast3D")
inventory = NodePath("Inventory") inventory = NodePath("Inventory")
card = NodePath("SubViewport/Head2/LeftHand/SubViewport/Node2D") card = NodePath("SubViewport/Head2/LeftHand/SubViewport/Node2D")
pause_menu_scene = ExtResource("3_avnsx") pause_menu_scene = ExtResource("3_avnsx")
@ -87,26 +104,33 @@ player_name_tag = NodePath("Nametag/Label")
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1, 0) transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1, 0)
shape = SubResource("CapsuleShape3D_jbu13") shape = SubResource("CapsuleShape3D_jbu13")
[node name="Head" type="Camera3D" parent="."] [node name="ViewMovement" type="Node3D" parent="." node_paths=PackedStringArray("player", "head_bob_camera", "head_bob_focus_raycast")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1.5, 0) transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1.5, 0)
script = ExtResource("4_mhexa")
player = NodePath("..")
head_bob_camera = NodePath("Head")
head_bob_focus_raycast = NodePath("RayCast3D")
[node name="Head" type="Camera3D" parent="ViewMovement"]
keep_aspect = 0 keep_aspect = 0
cull_mask = 1048569 cull_mask = 1048569
fov = 100.0 fov = 100.0
[node name="EditTool" parent="Head" node_paths=PackedStringArray("hero", "inventory") instance=ExtResource("5_jlxb3")] [node name="EditTool" parent="ViewMovement/Head" node_paths=PackedStringArray("hero", "inventory") instance=ExtResource("5_jlxb3")]
hero = NodePath("../..") hero = NodePath("../../..")
inventory = NodePath("../../Inventory") inventory = NodePath("../../../Inventory")
[node name="RayCast3D" type="RayCast3D" parent="Head"] [node name="RayCast3D" type="RayCast3D" parent="ViewMovement/Head"]
target_position = Vector3(0, 0, -2) target_position = Vector3(0, 0, -2)
collision_mask = 24 collision_mask = 24
[node name="RayCast3D" type="RayCast3D" parent="ViewMovement"]
target_position = Vector3(0, 0, -100)
collision_mask = 65535
[node name="EightDirectionSprite" parent="." instance=ExtResource("2_ib0t5")] [node name="EightDirectionSprite" parent="." instance=ExtResource("2_ib0t5")]
transform = Transform3D(2, 0, 0, 0, 2, 0, 0, 0, 2, 0, 0.915529, 0) transform = Transform3D(2, 0, 0, 0, 2, 0, 0, 0, 2, 0, 0.915529, 0)
texture = SubResource("AtlasTexture_a5vl4") texture = SubResource("AtlasTexture_4d5kf")
[node name="Inventory" type="Node" parent="."]
script = ExtResource("6_cf5ap")
[node name="SubViewport" type="SubViewport" parent="."] [node name="SubViewport" type="SubViewport" parent="."]
transparent_bg = true transparent_bg = true
@ -119,7 +143,7 @@ cull_mask = 2
environment = SubResource("Environment_ekmug") environment = SubResource("Environment_ekmug")
projection = 1 projection = 1
script = ExtResource("11_4sdwe") script = ExtResource("11_4sdwe")
clone_camera = NodePath("../../Head") clone_camera = NodePath("../../ViewMovement/Head")
[node name="RightHand" type="Node3D" parent="SubViewport/Head2"] [node name="RightHand" type="Node3D" parent="SubViewport/Head2"]
transform = Transform3D(0.7, 0, 0, 0, 0.7, 0, 0, 0, 0.7, 0.66, -0.255, -1) transform = Transform3D(0.7, 0, 0, 0, 0.7, 0, 0, 0, 0.7, 0.66, -0.255, -1)
@ -162,13 +186,52 @@ size = 15.0
script = ExtResource("12_3hpi3") script = ExtResource("12_3hpi3")
anchor = NodePath("../..") anchor = NodePath("../..")
[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")] [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)
render_target_update_mode = 4
[node name="Label" type="Label" parent="Nametag"]
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
text = "QUITE LONG PLAYER NAME"
horizontal_alignment = 1
vertical_alignment = 1
[node name="Sprite3D" type="Sprite3D" parent="."]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 2, 0)
layers = 5
sorting_offset = 500.0
pixel_size = 0.002
billboard = 1
no_depth_test = true
fixed_size = true
texture = SubResource("ViewportTexture_m3ots")
[node name="Inventory" type="Node" parent="."]
script = ExtResource("6_cf5ap")
[node name="PlayerMovement" type="Node" parent="." node_paths=PackedStringArray("player", "head")]
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")]
script = ExtResource("8_yl6ka") script = ExtResource("8_yl6ka")
wave_count = NodePath("WaveCount") wave_count = NodePath("WaveCount")
lives_count = NodePath("LivesCount") lives_count = NodePath("LivesCount")
enemy_count = NodePath("EnemyCount") enemy_count = NodePath("EnemyCount")
currency_count = NodePath("Currency") currency_count = NodePath("Currency")
crosshair = NodePath("Crosshair") crosshair = NodePath("ColorRect")
minimap = NodePath("TextureRect2") minimap = NodePath("TextureRect2")
minimap_cam = NodePath("../MiniMapViewport/Camera3D") minimap_cam = NodePath("../MiniMapViewport/Camera3D")
minimap_viewport = NodePath("../MiniMapViewport") minimap_viewport = NodePath("../MiniMapViewport")
@ -176,6 +239,7 @@ fps_label = NodePath("Label")
hover_text = NodePath("Label2") hover_text = NodePath("Label2")
enemy_sprites = [NodePath("TextureRect4/TextureRect"), NodePath("TextureRect4/TextureRect2"), NodePath("TextureRect4/TextureRect3"), NodePath("TextureRect4/TextureRect4"), NodePath("TextureRect4/TextureRect5")] 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")] 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")
[node name="EnemyCount" type="Label" parent="HUD"] [node name="EnemyCount" type="Label" parent="HUD"]
visible = false visible = false
@ -185,22 +249,6 @@ offset_right = 123.0
offset_bottom = 106.0 offset_bottom = 106.0
text = "Enemies left: 0" text = "Enemies left: 0"
[node name="Crosshair" type="TextureRect" parent="HUD"]
texture_filter = 1
anchors_preset = 8
anchor_left = 0.5
anchor_top = 0.5
anchor_right = 0.5
anchor_bottom = 0.5
offset_left = -20.0
offset_top = -20.0
offset_right = 20.0
offset_bottom = 20.0
grow_horizontal = 2
grow_vertical = 2
mouse_filter = 2
texture = ExtResource("8_fq3f6")
[node name="TextureRect" type="TextureRect" parent="HUD"] [node name="TextureRect" type="TextureRect" parent="HUD"]
anchors_preset = 15 anchors_preset = 15
anchor_right = 1.0 anchor_right = 1.0
@ -394,7 +442,7 @@ horizontal_alignment = 1
vertical_alignment = 1 vertical_alignment = 1
[node name="Currency" type="Label" parent="HUD"] [node name="Currency" type="Label" parent="HUD"]
anchors_preset = -1 anchors_preset = 1
anchor_left = 1.0 anchor_left = 1.0
anchor_right = 1.0 anchor_right = 1.0
offset_left = -101.0 offset_left = -101.0
@ -444,38 +492,31 @@ text = "1"
horizontal_alignment = 1 horizontal_alignment = 1
vertical_alignment = 1 vertical_alignment = 1
[node name="MinimapIcon" type="Sprite3D" parent="."] [node name="ColorRect" type="ColorRect" parent="HUD"]
transform = Transform3D(4, 0, 0, 0, 0.0698095, 3.99939, 0, -3.99939, 0.0698095, 0, 2.86288, 0) material = SubResource("ShaderMaterial_lg5jo")
layers = 4
texture_filter = 0
texture = ExtResource("15_nhlam")
[node name="PlayerMovement" type="Node" parent="." node_paths=PackedStringArray("player", "head")]
script = ExtResource("20_cfhw8")
player = NodePath("..")
head = NodePath("../Head")
[node name="Nametag" type="SubViewport" parent="."]
transparent_bg = true
size = Vector2i(300, 40)
render_target_update_mode = 4
[node name="Label" type="Label" parent="Nametag"]
anchors_preset = 15 anchors_preset = 15
anchor_right = 1.0 anchor_right = 1.0
anchor_bottom = 1.0 anchor_bottom = 1.0
grow_horizontal = 2 grow_horizontal = 2
grow_vertical = 2 grow_vertical = 2
text = "QUITE LONG PLAYER NAME" mouse_filter = 2
horizontal_alignment = 1
vertical_alignment = 1
[node name="Sprite3D" type="Sprite3D" parent="."] [node name="TextureProgressBar" type="TextureProgressBar" parent="HUD"]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 2, 0) visible = false
layers = 5 anchors_preset = -1
sorting_offset = 500.0 anchor_left = 1.0
pixel_size = 0.002 anchor_top = 1.0
billboard = 1 anchor_right = 1.0
no_depth_test = true anchor_bottom = 1.0
fixed_size = true offset_left = -500.0
texture = SubResource("ViewportTexture_m3ots") offset_top = -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)

View File

@ -2,11 +2,26 @@ extends Node
class_name PlayerMovement class_name PlayerMovement
@export var player : CharacterBody3D @export var player : CharacterBody3D
@export var head : Camera3D @export var head : Node3D
@export var movement_speed := 3.5
@export var sprint_boost := 0.1 @export_category("Movement")
@export var movement_speed := 5.0
@export var sprint_boost := 1.3
@export var acceleration := 0.8 @export var acceleration := 0.8
@export var friction_percentage := 0.15 @export var friction_percentage := 0.1
@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
@export var time_to_floor := 0.35
@onready var jump_velocity : float = (2 * max_height) / time_to_peak
@onready var jump_gravity : float = (-2 * max_height) / pow(time_to_peak, 2)
@onready var fall_gravity : float = (-2 * max_height) / pow(time_to_floor, 2)
@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 zoom_factor := 1.0 var zoom_factor := 1.0
var input_vector : Vector2 var input_vector : Vector2
var can_sprint := true var can_sprint := true
@ -20,18 +35,23 @@ var look_sens : float :
return Data.preferences.mouse_sens / 40000.0 return Data.preferences.mouse_sens / 40000.0
func get_gravity() -> float:
if jump_held:
return jump_gravity if player.velocity.y > 0.0 else fall_gravity
return min_jump_gravity if player.velocity.y > 0.0 else fall_gravity
func _physics_process(delta: float) -> void: func _physics_process(delta: float) -> void:
if !is_multiplayer_authority(): if !is_multiplayer_authority():
return return
var accel = acceleration var result_vector = input_vector * acceleration
if sprinting: var velocity = Vector2(player.velocity.x, player.velocity.z)
accel = acceleration + sprint_boost
var result_vector = input_vector * accel
var down_velocity = player.velocity.y var down_velocity = player.velocity.y
player.velocity = player.velocity.limit_length(player.velocity.length() * (1.0 - friction_percentage)) var movement = ((player.transform.basis.z * result_vector.y) + (player.transform.basis.x * result_vector.x))
player.velocity += ((player.transform.basis.z * result_vector.y) + (player.transform.basis.x * result_vector.x)) velocity = velocity.limit_length(velocity.length() * (1.0 - friction_percentage))
player.velocity.y = down_velocity velocity += Vector2(movement.x, movement.z)
player.velocity += Vector3.DOWN * 9.81 * delta 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() player.move_and_slide()
sync_position.rpc(player.position) sync_position.rpc(player.position)
sync_rotation.rpc(player.rotation) sync_rotation.rpc(player.rotation)
@ -52,7 +72,10 @@ func _process(_delta: float) -> void:
if !can_sprint: if !can_sprint:
sprinting = false sprinting = false
if Input.is_action_just_pressed("Jump") and player.is_on_floor(): if Input.is_action_just_pressed("Jump") and player.is_on_floor():
player.velocity.y += 4.5 player.velocity.y = jump_velocity
jump_held = true
if Input.is_action_just_released("Jump"):
jump_held = false
func _unhandled_input(event: InputEvent) -> void: func _unhandled_input(event: InputEvent) -> void:

73
PCs/view_movement.gd Normal file
View File

@ -0,0 +1,73 @@
extends Node3D
class_name ViewMovement
@export var player : Hero
@export_category("Bobbing")
@export var head_bob_camera : Camera3D
@export var head_bob_focus_raycast : RayCast3D
@export var enable_head_bob := true
@export var target_stabilisation := false
@export_category("Tilting")
@export var enable_tilt := true
var head_bob_amplitude := 0.002
var head_bob_frequency := 0.015
var tilt_amount := 0.04
var head_bob_start_position : Vector3
func _ready() -> void:
head_bob_start_position = head_bob_camera.position
func _process(delta: float) -> void:
if enable_head_bob:
check_motion(delta)
if target_stabilisation:
head_bob_camera.look_at(focus_target())
if enable_tilt:
tilt_cam(delta)
func check_motion(delta) -> void:
var speed = player.velocity.length_squared()
if speed < 2.0:
reset_position(delta)
return
if !player.is_on_floor():
reset_position(delta)
return
play_motion(foot_step_motion())
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)
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
return pos
func play_motion(motion: Vector3) -> void:
head_bob_camera.position += motion
func focus_target() -> Vector3:
if head_bob_focus_raycast.is_colliding():
return head_bob_focus_raycast.get_collision_point()
else:
return head_bob_focus_raycast.global_position + -head_bob_focus_raycast.global_transform.basis.z * 15.0
func tilt_cam(delta):
if player.velocity.length() < 1.0:
return
var dot = player.velocity.normalized().dot(-global_transform.basis.z)
dot = -abs(dot) + 1
var input_vector = Input.get_vector("Move Left", "Move Right", "Move Forward", "Move Backward")
head_bob_camera.rotation.z = lerp(head_bob_camera.rotation.z, tilt_amount * dot * -input_vector.x, 8.0 * delta)
#head_bob_camera.rotation.x = lerp(head_bob_camera.rotation.x, tilt_amount * dot * input_vector.y, 8.0 * delta)

View File

@ -38,11 +38,12 @@ viewport_path = NodePath("SubViewport5")
[sub_resource type="ViewportTexture" id="ViewportTexture_rnm0u"] [sub_resource type="ViewportTexture" id="ViewportTexture_rnm0u"]
viewport_path = NodePath("SubViewport6") viewport_path = NodePath("SubViewport6")
[node name="ShopStand" type="Node3D" node_paths=PackedStringArray("cards", "choice_colliders", "choice_buttons")] [node name="ShopStand" type="Node3D" node_paths=PackedStringArray("cards", "choice_colliders", "choice_buttons", "choice_sprites")]
script = ExtResource("1_4in53") script = ExtResource("1_4in53")
cards = [NodePath("SubViewport/Node2D"), NodePath("SubViewport2/Node2D"), NodePath("SubViewport3/Node2D"), NodePath("SubViewport4/Node2D"), NodePath("SubViewport5/Node2D"), NodePath("SubViewport6/Node2D")] cards = [NodePath("SubViewport/Node2D"), NodePath("SubViewport2/Node2D"), NodePath("SubViewport3/Node2D"), NodePath("SubViewport4/Node2D"), NodePath("SubViewport5/Node2D"), NodePath("SubViewport6/Node2D")]
choice_colliders = [NodePath("InteractButton/CollisionShape3D"), NodePath("InteractButton2/CollisionShape3D2"), NodePath("InteractButton3/CollisionShape3D3"), NodePath("InteractButton6/CollisionShape3D6"), NodePath("InteractButton5/CollisionShape3D5"), NodePath("InteractButton4/CollisionShape3D4")] choice_colliders = [NodePath("InteractButton/CollisionShape3D"), NodePath("InteractButton2/CollisionShape3D2"), NodePath("InteractButton3/CollisionShape3D3"), NodePath("InteractButton6/CollisionShape3D6"), NodePath("InteractButton5/CollisionShape3D5"), NodePath("InteractButton4/CollisionShape3D4")]
choice_buttons = [NodePath("InteractButton"), NodePath("InteractButton2"), NodePath("InteractButton3"), NodePath("InteractButton6"), NodePath("InteractButton5"), NodePath("InteractButton4")] choice_buttons = [NodePath("InteractButton"), NodePath("InteractButton2"), NodePath("InteractButton3"), NodePath("InteractButton6"), NodePath("InteractButton5"), NodePath("InteractButton4")]
choice_sprites = [NodePath("Sprites/Sprite3D"), NodePath("Sprites/Sprite3D2"), NodePath("Sprites/Sprite3D3"), NodePath("Sprites/Sprite3D4"), NodePath("Sprites/Sprite3D5"), NodePath("Sprites/Sprite3D6")]
item_card_scene = ExtResource("2_qh00w") item_card_scene = ExtResource("2_qh00w")
[node name="CSGBox3D" type="CSGBox3D" parent="."] [node name="CSGBox3D" type="CSGBox3D" parent="."]
@ -167,40 +168,45 @@ render_target_update_mode = 4
[node name="Node2D" parent="SubViewport6" instance=ExtResource("3_u7x2f")] [node name="Node2D" parent="SubViewport6" instance=ExtResource("3_u7x2f")]
[node name="Sprites" type="Node3D" parent="."] [node name="Sprites" type="Node3D" parent="."]
visible = false
[node name="Sprite3D" type="Sprite3D" parent="Sprites"] [node name="Sprite3D" type="Sprite3D" parent="Sprites"]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -1.05174, 0.845052, 0.31035) transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -1.05174, 0.845052, 0.31035)
visible = false
pixel_size = 0.0015 pixel_size = 0.0015
texture_filter = 0 texture_filter = 0
texture = SubResource("ViewportTexture_5mbfv") texture = SubResource("ViewportTexture_5mbfv")
[node name="Sprite3D2" type="Sprite3D" parent="Sprites"] [node name="Sprite3D2" type="Sprite3D" parent="Sprites"]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.0552108, 0.842029, 0.32352) transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.0552108, 0.842029, 0.32352)
visible = false
pixel_size = 0.0015 pixel_size = 0.0015
texture_filter = 0 texture_filter = 0
texture = SubResource("ViewportTexture_cfv1i") texture = SubResource("ViewportTexture_cfv1i")
[node name="Sprite3D3" type="Sprite3D" parent="Sprites"] [node name="Sprite3D3" type="Sprite3D" parent="Sprites"]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 1.02516, 0.816916, 0.304008) transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 1.02516, 0.816916, 0.304008)
visible = false
pixel_size = 0.0015 pixel_size = 0.0015
texture_filter = 0 texture_filter = 0
texture = SubResource("ViewportTexture_1rey7") texture = SubResource("ViewportTexture_1rey7")
[node name="Sprite3D4" type="Sprite3D" parent="Sprites"] [node name="Sprite3D4" type="Sprite3D" parent="Sprites"]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.947595, 1.28234, -0.191499) transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.947595, 1.28234, -0.191499)
visible = false
pixel_size = 0.0015 pixel_size = 0.0015
texture_filter = 0 texture_filter = 0
texture = SubResource("ViewportTexture_rlwso") texture = SubResource("ViewportTexture_rlwso")
[node name="Sprite3D5" type="Sprite3D" parent="Sprites"] [node name="Sprite3D5" type="Sprite3D" parent="Sprites"]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.0401761, 1.28234, -0.191499) transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.0401761, 1.28234, -0.191499)
visible = false
pixel_size = 0.0015 pixel_size = 0.0015
texture_filter = 0 texture_filter = 0
texture = SubResource("ViewportTexture_a6401") texture = SubResource("ViewportTexture_a6401")
[node name="Sprite3D6" type="Sprite3D" parent="Sprites"] [node name="Sprite3D6" type="Sprite3D" parent="Sprites"]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 1.0227, 1.28234, -0.191499) transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 1.0227, 1.28234, -0.191499)
visible = false
pixel_size = 0.0015 pixel_size = 0.0015
texture_filter = 0 texture_filter = 0
texture = SubResource("ViewportTexture_rnm0u") texture = SubResource("ViewportTexture_rnm0u")

View File

@ -6,7 +6,7 @@ var last_lives_count = 120
@export var lives_count : Label @export var lives_count : Label
@export var enemy_count : Label @export var enemy_count : Label
@export var currency_count : Label @export var currency_count : Label
@export var crosshair : TextureRect @export var crosshair : Control
@export var minimap : TextureRect @export var minimap : TextureRect
@export var minimap_cam : MinimapCamera3D @export var minimap_cam : MinimapCamera3D
@export var minimap_viewport : SubViewport @export var minimap_viewport : SubViewport
@ -16,6 +16,11 @@ var minimap_anchor : Node3D
var enemy_names = [] var enemy_names = []
@export var enemy_sprites : Array[TextureRect] @export var enemy_sprites : Array[TextureRect]
@export var enemy_counts : Array[Label] @export var enemy_counts : Array[Label]
@export var weapon_energy_bar : TextureProgressBar
func set_energy_visible(value):
weapon_energy_bar.set_visible(value)
func _process(_delta: float) -> void: func _process(_delta: float) -> void:
@ -81,6 +86,10 @@ func set_crosshair_visible(value : bool):
crosshair.set_visible(value) crosshair.set_visible(value)
func set_weapon_energy(value):
weapon_energy_bar.value = value
func maximise_minimap(anchor): func maximise_minimap(anchor):
minimap_cam.anchor = anchor minimap_cam.anchor = anchor
minimap.set_anchors_and_offsets_preset(Control.PRESET_FULL_RECT) minimap.set_anchors_and_offsets_preset(Control.PRESET_FULL_RECT)

View File

@ -1,6 +1,8 @@
extends Node3D extends Node3D
class_name Weapon class_name Weapon
signal energy_changed(energy)
@export var stats : CardText @export var stats : CardText
@export var animator : AnimationPlayer @export var animator : AnimationPlayer
@ -11,11 +13,15 @@ var second_trigger_held := false
var time_since_firing := 0.0 var time_since_firing := 0.0
var time_between_shots := 0.0 var time_between_shots := 0.0
var damage := 0.0 var damage := 0.0
var max_energy := 100.0
var current_energy := 100.0
var energy_cost := 1.0
func _ready() -> void: func _ready() -> void:
time_between_shots = stats.get_attribute("Fire Delay") time_between_shots = stats.get_attribute("Fire Delay")
damage = stats.get_attribute("Damage") damage = stats.get_attribute("Damage")
energy_cost = stats.get_attribute("Energy")
func set_hero(value): func set_hero(value):
@ -23,13 +29,19 @@ func set_hero(value):
func _process(delta: float) -> void: func _process(delta: float) -> void:
current_energy += 5.0 * delta
if current_energy >= max_energy:
current_energy = max_energy
energy_changed.emit(current_energy)
if time_since_firing < time_between_shots: if time_since_firing < time_between_shots:
time_since_firing += delta time_since_firing += delta
func _physics_process(_delta: float) -> void: func _physics_process(_delta: float) -> void:
if trigger_held and time_since_firing >= time_between_shots: if trigger_held and current_energy >= energy_cost and time_since_firing >= time_between_shots:
time_since_firing -= time_between_shots time_since_firing -= time_between_shots
current_energy -= energy_cost
energy_changed.emit(current_energy)
shoot() shoot()
networked_shoot.rpc() networked_shoot.rpc()

View File

@ -40,6 +40,7 @@ func _ready() -> void:
cards.append(preload("res://PCs/Universal/ClassCards/Gatling/card_gatling.tres")) cards.append(preload("res://PCs/Universal/ClassCards/Gatling/card_gatling.tres"))
cards.append(preload("res://PCs/Universal/ClassCards/RocketLauncher/card_rocket_launcher.tres")) cards.append(preload("res://PCs/Universal/ClassCards/RocketLauncher/card_rocket_launcher.tres"))
#Uncommon #Uncommon
cards.append(preload("res://PCs/Universal/ClassCards/Sniper/card_sniper.tres"))
cards.append(preload("res://PCs/Universal/ClassCards/Blowdart/card_blowdart.tres")) cards.append(preload("res://PCs/Universal/ClassCards/Blowdart/card_blowdart.tres"))
cards.append(preload("res://PCs/Universal/ClassCards/Refrigerator/card_refrigerator.tres")) cards.append(preload("res://PCs/Universal/ClassCards/Refrigerator/card_refrigerator.tres"))
cards.append(preload("res://PCs/Universal/ClassCards/GlueLauncher/card_glue_launcher.tres")) cards.append(preload("res://PCs/Universal/ClassCards/GlueLauncher/card_glue_launcher.tres"))
@ -52,7 +53,6 @@ func _ready() -> void:
cards.append(preload("res://PCs/Universal/ClassCards/Fireball/card_fireball.tres")) cards.append(preload("res://PCs/Universal/ClassCards/Fireball/card_fireball.tres"))
#cards.append(preload("res://PCs/Universal/ClassCards/GammaLaser/card_gamma_laser.tres")) #cards.append(preload("res://PCs/Universal/ClassCards/GammaLaser/card_gamma_laser.tres"))
#Legendary #Legendary
cards.append(preload("res://PCs/Universal/ClassCards/Sniper/card_sniper.tres"))
cards.append(preload("res://PCs/Universal/ClassCards/Reactor/card_reactor.tres")) cards.append(preload("res://PCs/Universal/ClassCards/Reactor/card_reactor.tres"))
#cards.append(preload("res://PCs/Universal/ClassCards/Lightning/card_lightning.tres")) #cards.append(preload("res://PCs/Universal/ClassCards/Lightning/card_lightning.tres"))

View File

@ -22,7 +22,7 @@ var ray_point
var interact_key_held := false var interact_key_held := false
var interacted_once := false var interacted_once := false
var interact_held_time := 0.0 var interact_held_time := 0.0
var interact_hold_time := 0.5 var interact_hold_time := 0.4
func _ready() -> void: func _ready() -> void:

View File

@ -4,6 +4,7 @@ class_name ShopStand
@export var cards : Array[CardInHand] @export var cards : Array[CardInHand]
@export var choice_colliders : Array[CollisionShape3D] @export var choice_colliders : Array[CollisionShape3D]
@export var choice_buttons : Array[InteractButton] @export var choice_buttons : Array[InteractButton]
@export var choice_sprites : Array[Sprite3D]
@export var item_card_scene : PackedScene @export var item_card_scene : PackedScene
var price_dict = { var price_dict = {
Data.Rarity.UNCOMMON : 30, Data.Rarity.UNCOMMON : 30,
@ -16,7 +17,8 @@ var price_dict = {
func close(): func close():
for x in choice_colliders: for x in choice_colliders:
x.disabled = true x.disabled = true
$Sprites.set_visible(false) for x in choice_sprites:
x.set_visible(false)
func randomize_cards(): func randomize_cards():
@ -49,13 +51,16 @@ func randomize_cards():
cards[x+5].view_tower() cards[x+5].view_tower()
choice_buttons[x+5].press_cost = price_dict[chosen_card.rarity] 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.title + "?"
$Sprites.set_visible(true)
for x in choice_colliders: for x in choice_colliders:
x.disabled = false x.disabled = false
for x in choice_sprites:
x.set_visible(true)
func retrieve_card(i): func retrieve_card(i):
close() #close()
choice_colliders[i].disabled = true
choice_sprites[i].set_visible(false)
var card = cards[i].stats var card = cards[i].stats
var item = item_card_scene.instantiate() as ItemCard var item = item_card_scene.instantiate() as ItemCard
item.card = card item.card = card

View File

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

File diff suppressed because one or more lines are too long

43
crosshair.gdshader Normal file
View File

@ -0,0 +1,43 @@
shader_type canvas_item;
uniform bool center_enabled = true;
uniform bool legs_enabled = true;
uniform bool inverted = false;
uniform int color_id = 0;
uniform vec4 color_0 = vec4(0., 1, 0., 1.);
uniform vec4 color_1 = vec4(1., 0., 0., 1.);
uniform vec4 color_2 = vec4(0., 0., 1., 1.);
uniform float center_radius = .002;
uniform float width = .003;
uniform float len = .03;
uniform float spacing = .008;
uniform float spread = 1.;
uniform sampler2D SCREEN_TEXTURE : hint_screen_texture, filter_linear_mipmap_anisotropic;
void fragment(){
float a = SCREEN_PIXEL_SIZE.x / SCREEN_PIXEL_SIZE.y;
vec2 UVa = vec2(UV.x / a, UV.y);
vec2 center = vec2(.5 / a, .5);
float point = step(distance(UVa, center), center_radius);
float h = step(center.x - len - spacing*spread, UVa.x) - step(center.x - spacing*spread, UVa.x);
h += step(center.x + spacing*spread, UVa.x) - step(center.x + len + spacing*spread, UVa.x);
h *= step(center.y - width, UVa.y) - step(center.y + width, UVa.y);
float v = step(center.y - len - spacing*spread, UVa.y) - step(center.y - spacing*spread, UVa.y);
v += step(center.y + spacing*spread, UVa.y) - step(center.y + len + spacing*spread, UVa.y);
v *= step(center.x - width, UVa.x) - step(center.x + width, UVa.x);
float crosshair;
crosshair = (h+v) * float(legs_enabled) + point * float(center_enabled);
if(!inverted){
COLOR = (color_0 * float(color_id == 0) + color_1 * float(color_id == 1) + color_2 * float(color_id == 2)) * crosshair;
}else{
COLOR = vec4((cos(textureLod(SCREEN_TEXTURE, SCREEN_UV, 0.0).rgb * 3.1415926534) + 1.)/2., 1.) * crosshair;
}
}