waited far too long for an initial commit but here we are

This commit is contained in:
2023-11-08 14:28:55 +11:00
commit 0427a58635
299 changed files with 10191 additions and 0 deletions

11
PCs/Blue/blue.tres Normal file
View File

@ -0,0 +1,11 @@
[gd_resource type="Resource" script_class="HeroClass" load_steps=5 format=3 uid="uid://dxonpv8qbyrjy"]
[ext_resource type="Script" path="res://Scripts/Resources/hero_class.gd" id="1_aeu85"]
[ext_resource type="Resource" uid="uid://dh5fjnbp8auw1" path="res://PCs/Universal/ClassCards/RocketLauncher/card_rocket_launcher.tres" id="1_uvyoy"]
[ext_resource type="Resource" uid="uid://bmoreipvttks8" path="res://PCs/Universal/ClassCards/Assault/card_assault.tres" id="2_3yr5a"]
[ext_resource type="Resource" uid="uid://cvf5bxtu6er17" path="res://PCs/Universal/ClassCards/Sniper/card_sniper.tres" id="3_wyb0n"]
[resource]
script = ExtResource("1_aeu85")
hero_name = "Blue"
deck = Array[Resource("res://Scripts/Resources/card.gd")]([ExtResource("1_uvyoy"), ExtResource("2_3yr5a"), ExtResource("3_wyb0n")])

13
PCs/Green/green.tres Normal file
View File

@ -0,0 +1,13 @@
[gd_resource type="Resource" script_class="HeroClass" load_steps=6 format=3 uid="uid://ogbkbf1v7j7l"]
[ext_resource type="Script" path="res://Scripts/Resources/hero_class.gd" id="1_cpfpk"]
[ext_resource type="Resource" uid="uid://cvf5bxtu6er17" path="res://PCs/Universal/ClassCards/Sniper/card_sniper.tres" id="1_hv6hq"]
[ext_resource type="Texture2D" uid="uid://bgt3j4cuq814m" path="res://Assets/TextureAtlases/green.tres" id="2_4p73e"]
[ext_resource type="Resource" uid="uid://dh5fjnbp8auw1" path="res://PCs/Universal/ClassCards/RocketLauncher/card_rocket_launcher.tres" id="2_jdi4m"]
[ext_resource type="Resource" uid="uid://bmoreipvttks8" path="res://PCs/Universal/ClassCards/Assault/card_assault.tres" id="3_f04lj"]
[resource]
script = ExtResource("1_cpfpk")
hero_name = "Green"
texture = ExtResource("2_4p73e")
deck = Array[Resource("res://Scripts/Resources/card.gd")]([ExtResource("1_hv6hq"), ExtResource("2_jdi4m"), ExtResource("3_f04lj")])

13
PCs/Red/red.tres Normal file
View File

@ -0,0 +1,13 @@
[gd_resource type="Resource" script_class="HeroClass" load_steps=6 format=3 uid="uid://b5pc3frhx467q"]
[ext_resource type="Script" path="res://Scripts/Resources/hero_class.gd" id="1_1wkap"]
[ext_resource type="Resource" uid="uid://bmoreipvttks8" path="res://PCs/Universal/ClassCards/Assault/card_assault.tres" id="1_iiksa"]
[ext_resource type="Resource" uid="uid://cvf5bxtu6er17" path="res://PCs/Universal/ClassCards/Sniper/card_sniper.tres" id="2_hkiwr"]
[ext_resource type="Texture2D" uid="uid://hxev3a2ktya" path="res://Assets/TextureAtlases/red.tres" id="2_kjc7g"]
[ext_resource type="Resource" uid="uid://dh5fjnbp8auw1" path="res://PCs/Universal/ClassCards/RocketLauncher/card_rocket_launcher.tres" id="3_ruhqi"]
[resource]
script = ExtResource("1_1wkap")
hero_name = "Red"
texture = ExtResource("2_kjc7g")
deck = Array[Resource("res://Scripts/Resources/card.gd")]([ExtResource("1_iiksa"), ExtResource("2_hkiwr"), ExtResource("3_ruhqi")])

View File

@ -0,0 +1,19 @@
[gd_resource type="Resource" script_class="Card" load_steps=7 format=3 uid="uid://bmoreipvttks8"]
[ext_resource type="Script" path="res://Scripts/Resources/card.gd" id="1_yqa4b"]
[ext_resource type="Texture2D" uid="uid://ca4lwwd3e0y73" path="res://Assets/TextureAtlases/g_assault.tres" id="2_8j5h0"]
[ext_resource type="PackedScene" uid="uid://fernyl7fsifv" path="res://PCs/Universal/ClassCards/Assault/tower_assault.tscn" id="3_0r6s7"]
[ext_resource type="Resource" uid="uid://w15ojqyxd72q" path="res://Resources/WeaponStats/assault.tres" id="3_k2yr3"]
[ext_resource type="Resource" uid="uid://cktq4o3yuxgsa" path="res://Resources/TurretStats/assault.tres" id="3_p4byc"]
[ext_resource type="PackedScene" uid="uid://d1xe6hsq05110" path="res://PCs/Universal/ClassCards/Assault/weapon_assault.tscn" id="3_wj5gm"]
[resource]
script = ExtResource("1_yqa4b")
title = "Assault"
rarity = 0
faction = 0
sprite = ExtResource("2_8j5h0")
turret = ExtResource("3_0r6s7")
weapon = ExtResource("3_wj5gm")
weapon_stats = ExtResource("3_k2yr3")
tower_stats = ExtResource("3_p4byc")

View File

@ -0,0 +1,45 @@
extends Node3D
class_name Tower
@export var stats : TowerStats
@export var model : Node3D
var targeted_enemy
var cooldown := 0.0
var other_cooldown := 0.0
func _ready() -> void:
cooldown = 1.0 / stats.fire_rate
func _process(delta: float) -> void:
other_cooldown -= delta
if !targeted_enemy:
acquire_target()
else:
if model.global_position.distance_to(targeted_enemy.global_position) > stats.fire_range:
targeted_enemy = null
if targeted_enemy:
aim()
if other_cooldown <= 0:
shoot()
other_cooldown = cooldown
func shoot():
targeted_enemy.damage(stats.damage)
func aim():
model.look_at(targeted_enemy.global_position)
func acquire_target():
var most_progressed_enemy = null
for enemy in get_tree().get_nodes_in_group("Enemies"):
if model.global_position.distance_to(enemy.global_position) > stats.fire_range:
continue
if (most_progressed_enemy == null or enemy.progress >= most_progressed_enemy.progress) and enemy.stats.target_type & stats.can_target:
most_progressed_enemy = enemy
if most_progressed_enemy != null:
targeted_enemy = most_progressed_enemy

View File

@ -0,0 +1,22 @@
[gd_scene load_steps=3 format=3 uid="uid://fernyl7fsifv"]
[ext_resource type="Script" path="res://PCs/Universal/ClassCards/Assault/tower.gd" id="1_c2874"]
[ext_resource type="Resource" uid="uid://cktq4o3yuxgsa" path="res://Resources/TurretStats/assault.tres" id="2_t516u"]
[node name="Node3D" type="Node3D" node_paths=PackedStringArray("model")]
script = ExtResource("1_c2874")
stats = ExtResource("2_t516u")
model = NodePath("Model")
[node name="Model" type="Node3D" parent="."]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 2, 0)
[node name="CSGBox3D" type="CSGBox3D" parent="Model"]
[node name="CSGBox3D2" type="CSGBox3D" parent="Model"]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.714825, 0, -0.423869)
size = Vector3(0.481654, 0.427749, 1.38438)
[node name="CSGBox3D3" type="CSGBox3D" parent="Model"]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.715, 0, -0.424)
size = Vector3(0.481654, 0.427749, 1.38438)

View File

@ -0,0 +1,66 @@
extends Sprite3D
class_name Weapon
@export var stats : WeaponStats
@export var hero : Hero
var cooldown := 0.0
var other_cooldown := 0.0
var trigger_held := false
var second_trigger_held := false
func _ready() -> void:
cooldown = 1.0 / stats.fire_rate
$RayCast3D.target_position = Vector3(0, 0, -stats.fire_range)
func set_raycast_origin(node):
$RayCast3D.global_position = node.global_position
func set_hero(value):
hero = value
func _process(delta: float) -> void:
if stats != null:
other_cooldown -= delta
func _physics_process(_delta: float) -> void:
if trigger_held:
shoot()
func hold_trigger():
trigger_held = true
func release_trigger():
trigger_held = false
func hold_second_trigger():
second_trigger_held = true
func release_second_trigger():
second_trigger_held = false
func shoot():
if other_cooldown <= 0 and stats != null:
other_cooldown = cooldown
$AnimationPlayer.play("shoot")
if $RayCast3D.is_colliding():
var target = $RayCast3D.get_collider()
if target != null:
var target_hitbox = target.shape_owner_get_owner($RayCast3D.get_collider_shape())
if target_hitbox is Hitbox:
target_hitbox.damage(stats.damage)
@rpc
func networked_shoot():
$AnimationPlayer.play("shoot")

View File

@ -0,0 +1,58 @@
[gd_scene load_steps=7 format=3 uid="uid://d1xe6hsq05110"]
[ext_resource type="Texture2D" uid="uid://ca4lwwd3e0y73" path="res://Assets/TextureAtlases/g_assault.tres" id="1_117ne"]
[ext_resource type="Script" path="res://PCs/Universal/ClassCards/Assault/weapon.gd" id="2_4ie8w"]
[ext_resource type="Resource" uid="uid://w15ojqyxd72q" path="res://Resources/WeaponStats/assault.tres" id="3_s4ckt"]
[sub_resource type="Animation" id="Animation_n8b32"]
length = 0.001
tracks/0/type = "value"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath(".:texture:region")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 0,
"values": [Rect2(0, 0, 64, 64)]
}
[sub_resource type="Animation" id="Animation_g0h8q"]
resource_name = "shoot"
length = 0.15
tracks/0/type = "value"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath(".:texture:region")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/keys = {
"times": PackedFloat32Array(0, 0.15),
"transitions": PackedFloat32Array(0, 0),
"update": 0,
"values": [Rect2(64, 0, 64, 64), Rect2(0, 0, 64, 64)]
}
[sub_resource type="AnimationLibrary" id="AnimationLibrary_ntl6p"]
_data = {
"RESET": SubResource("Animation_n8b32"),
"shoot": SubResource("Animation_g0h8q")
}
[node name="Weapon" type="Sprite3D"]
layers = 2
billboard = 1
texture_filter = 0
texture = ExtResource("1_117ne")
script = ExtResource("2_4ie8w")
stats = ExtResource("3_s4ckt")
[node name="AnimationPlayer" type="AnimationPlayer" parent="."]
libraries = {
"": SubResource("AnimationLibrary_ntl6p")
}
[node name="RayCast3D" type="RayCast3D" parent="."]
collision_mask = 4

View File

@ -0,0 +1,20 @@
extends RigidBody3D
class_name Bomb
@export var max_bounces := 1
@export var damage := 10.0
@export var explosion_range := 3.0
var bounces := 0
func _on_body_entered(_body: Node) -> void:
bounces += 1
var collided_body = get_colliding_bodies()[0].get_collision_layer_value(3)
if bounces > max_bounces or collided_body:
explode()
func explode():
for enemy in get_tree().get_nodes_in_group("Enemies"):
if global_position.distance_to(enemy.global_position) <= explosion_range:
enemy.damage(damage)
queue_free()

View File

@ -0,0 +1,29 @@
[gd_scene load_steps=5 format=3 uid="uid://d147iwg2wcqc5"]
[ext_resource type="Texture2D" uid="uid://b54d5dc4jmlau" path="res://Assets/Textures/bomb.png" id="1_u615o"]
[ext_resource type="Script" path="res://PCs/Universal/ClassCards/BombLauncher/bomb.gd" id="1_vekqm"]
[sub_resource type="PhysicsMaterial" id="PhysicsMaterial_whkhx"]
bounce = 0.6
[sub_resource type="SphereShape3D" id="SphereShape3D_mi0in"]
radius = 0.2
[node name="RigidBody3D" type="RigidBody3D"]
collision_layer = 0
collision_mask = 5
physics_material_override = SubResource("PhysicsMaterial_whkhx")
max_contacts_reported = 1
contact_monitor = true
script = ExtResource("1_vekqm")
[node name="Node3D" type="Sprite3D" parent="."]
transform = Transform3D(1.4, 0, 0, 0, 1.4, 0, 0, 0, 1.4, 0, 0, 0)
billboard = 1
texture_filter = 0
texture = ExtResource("1_u615o")
[node name="CollisionShape3D" type="CollisionShape3D" parent="."]
shape = SubResource("SphereShape3D_mi0in")
[connection signal="body_entered" from="." to="." method="_on_body_entered"]

View File

@ -0,0 +1,30 @@
extends Tower
class_name BombTower
@export var bomb_scene: PackedScene
var firing_velocity
func _ready() -> void:
super._ready()
firing_velocity = sqrt((stats.fire_range * ProjectSettings.get_setting("physics/3d/default_gravity")) / sin(2 * 45))
func shoot():
var bomb = bomb_scene.instantiate() as Bomb
bomb.position = model.global_position
bomb.damage = stats.damage
get_tree().root.add_child(bomb)
bomb.apply_impulse(-model.global_transform.basis.z * firing_velocity)
func aim():
var pos = Vector2(global_position.x, global_position.z)
var t_pos = Vector2(targeted_enemy.global_position.x, targeted_enemy.global_position.z)
var x = pos.distance_to(t_pos)
var y = targeted_enemy.global_position.y - global_position.y
var v = firing_velocity
var g = ProjectSettings.get_setting("physics/3d/default_gravity")
var v2 = pow(v, 2)
var angle = atan((v2 + sqrt(pow(v, 4) - g * ((g * pow(x, 2)) + (2 * y * v2)))) / (g * x))
model.look_at(Vector3(t_pos.x, model.global_position.y, t_pos.y))
model.rotate(model.global_transform.basis.x.normalized(), angle)

View File

@ -0,0 +1,21 @@
extends Weapon
class_name BombWeapon
@export var bomb_scene: PackedScene
var firing_velocity
func _ready() -> void:
cooldown = 1.0 / stats.fire_rate
firing_velocity = sqrt((stats.fire_range * ProjectSettings.get_setting("physics/3d/default_gravity")) / sin(2 * 45))
$RayCast3D.target_position = Vector3(0, 0, -stats.fire_range)
func shoot():
if other_cooldown <= 0 and stats != null:
other_cooldown = cooldown
$AnimationPlayer.play("shoot")
var bomb = bomb_scene.instantiate() as Bomb
bomb.position = $RayCast3D.global_position
bomb.damage = stats.damage
get_tree().root.add_child(bomb)
bomb.apply_impulse(-global_transform.basis.z * firing_velocity)

View File

@ -0,0 +1,19 @@
[gd_resource type="Resource" script_class="Card" load_steps=7 format=3 uid="uid://bvpkvmda845o5"]
[ext_resource type="Script" path="res://Scripts/Resources/card.gd" id="1_bscy2"]
[ext_resource type="Texture2D" uid="uid://bwufgga1pjyt" path="res://Assets/TextureAtlases/g_grenade_launcher.tres" id="2_xtrq2"]
[ext_resource type="Resource" uid="uid://crmsk6lvp5i4e" path="res://Resources/TurretStats/bomblauncher.tres" id="3_c1c3t"]
[ext_resource type="PackedScene" uid="uid://6ckryuql3bh8" path="res://PCs/Universal/ClassCards/BombLauncher/weapon_bomb_launcher.tscn" id="4_iaadg"]
[ext_resource type="PackedScene" uid="uid://cwc8y1nv53btu" path="res://PCs/Universal/ClassCards/BombLauncher/tower_bomb_launcher.tscn" id="4_ux0v3"]
[ext_resource type="Resource" uid="uid://kbaiy5u6imtu" path="res://Resources/WeaponStats/bomblauncher.tres" id="5_mhhrq"]
[resource]
script = ExtResource("1_bscy2")
title = "Grenade Launcher"
rarity = 1
faction = 0
sprite = ExtResource("2_xtrq2")
turret = ExtResource("4_ux0v3")
weapon = ExtResource("4_iaadg")
weapon_stats = ExtResource("5_mhhrq")
tower_stats = ExtResource("3_c1c3t")

View File

@ -0,0 +1,20 @@
[gd_scene load_steps=4 format=3 uid="uid://cwc8y1nv53btu"]
[ext_resource type="Script" path="res://PCs/Universal/ClassCards/BombLauncher/bombtower.gd" id="1_u2hyk"]
[ext_resource type="PackedScene" uid="uid://d147iwg2wcqc5" path="res://PCs/Universal/ClassCards/BombLauncher/bomb.tscn" id="2_n307r"]
[ext_resource type="Resource" uid="uid://crmsk6lvp5i4e" path="res://Resources/TurretStats/bomblauncher.tres" id="3_xv5rx"]
[node name="Node3D" type="Node3D" node_paths=PackedStringArray("model")]
script = ExtResource("1_u2hyk")
bomb_scene = ExtResource("2_n307r")
stats = ExtResource("3_xv5rx")
model = NodePath("Model")
[node name="Model" type="Node3D" parent="."]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1.13842, 0)
[node name="CSGBox3D" type="CSGBox3D" parent="Model"]
[node name="CSGBox3D2" type="CSGBox3D" parent="Model"]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, -0.65)
size = Vector3(0.596453, 0.632841, 0.539216)

View File

@ -0,0 +1,59 @@
[gd_scene load_steps=8 format=3 uid="uid://6ckryuql3bh8"]
[ext_resource type="Texture2D" uid="uid://bwufgga1pjyt" path="res://Assets/TextureAtlases/g_grenade_launcher.tres" id="1_n7mif"]
[ext_resource type="Script" path="res://PCs/Universal/ClassCards/BombLauncher/bombweapon.gd" id="2_4iyo6"]
[ext_resource type="PackedScene" uid="uid://d147iwg2wcqc5" path="res://PCs/Universal/ClassCards/BombLauncher/bomb.tscn" id="3_506dv"]
[ext_resource type="Resource" uid="uid://kbaiy5u6imtu" path="res://Resources/WeaponStats/bomblauncher.tres" id="4_45cu2"]
[sub_resource type="Animation" id="Animation_n8b32"]
length = 0.001
tracks/0/type = "value"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath(".:texture:region")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 0,
"values": [Rect2(0, 0, 64, 64)]
}
[sub_resource type="Animation" id="Animation_g0h8q"]
resource_name = "shoot"
length = 0.15
tracks/0/type = "value"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath(".:texture:region")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/keys = {
"times": PackedFloat32Array(0, 0.15),
"transitions": PackedFloat32Array(0, 0),
"update": 0,
"values": [Rect2(64, 0, 64, 64), Rect2(0, 0, 64, 64)]
}
[sub_resource type="AnimationLibrary" id="AnimationLibrary_ntl6p"]
_data = {
"RESET": SubResource("Animation_n8b32"),
"shoot": SubResource("Animation_g0h8q")
}
[node name="Weapon" type="Sprite3D"]
layers = 2
billboard = 1
texture_filter = 0
texture = ExtResource("1_n7mif")
script = ExtResource("2_4iyo6")
bomb_scene = ExtResource("3_506dv")
stats = ExtResource("4_45cu2")
[node name="AnimationPlayer" type="AnimationPlayer" parent="."]
libraries = {
"": SubResource("AnimationLibrary_ntl6p")
}
[node name="RayCast3D" type="RayCast3D" parent="."]

View File

@ -0,0 +1,15 @@
[gd_resource type="Resource" script_class="Card" load_steps=5 format=3 uid="uid://1xke2uy2vfuf"]
[ext_resource type="Script" path="res://Scripts/Resources/card.gd" id="1_xmwih"]
[ext_resource type="Resource" uid="uid://5ywipj3632u8" path="res://Resources/TurretStats/flametower.tres" id="2_80w0f"]
[ext_resource type="PackedScene" uid="uid://dvqk2lysu02gf" path="res://PCs/Universal/ClassCards/Flamethrower/tower_flamethrower.tscn" id="3_yfmjg"]
[ext_resource type="Resource" uid="uid://c4ihsd13o1esd" path="res://Resources/WeaponStats/flamethrower.tres" id="4_rdoaa"]
[resource]
script = ExtResource("1_xmwih")
title = "Flamethrower"
rarity = 3
faction = 0
turret = ExtResource("3_yfmjg")
weapon_stats = ExtResource("4_rdoaa")
tower_stats = ExtResource("2_80w0f")

View File

@ -0,0 +1,30 @@
extends Tower
class_name FlameyTower
@export var shapecast : ShapeCast3D
@export var particlesystem : GPUParticles3D
@export var status_stats : StatusStats
func _process(delta: float) -> void:
super._process(delta)
if targeted_enemy:
particlesystem.emitting = true
else:
particlesystem.emitting = false
func shoot():
for index in shapecast.get_collision_count():
var target = shapecast.get_collider(index) as CharacterBody3D
#TODO: its shit the way the enemy and status have to know about each other
var status = StatusOnFire.new()
status.affected = target.get_parent()
status.stats = status_stats
target.get_parent().status_manager.add_effect(status)
target.get_parent().add_child(status)
func aim():
model.look_at(targeted_enemy.global_position)
model.rotation.x = 0.0

View File

@ -0,0 +1,63 @@
[gd_scene load_steps=9 format=3 uid="uid://dvqk2lysu02gf"]
[ext_resource type="Script" path="res://PCs/Universal/ClassCards/Flamethrower/tower_flamethrower.gd" id="1_6dcsj"]
[ext_resource type="Resource" uid="uid://dbanx8taicddm" path="res://Resources/StatusEffects/on_fire.tres" id="2_yo2b7"]
[sub_resource type="Gradient" id="Gradient_kkqms"]
offsets = PackedFloat32Array(0.00591716, 1)
colors = PackedColorArray(0.898039, 0.447059, 0, 1, 1, 0, 0, 1)
[sub_resource type="GradientTexture1D" id="GradientTexture1D_gpquw"]
gradient = SubResource("Gradient_kkqms")
[sub_resource type="ParticleProcessMaterial" id="ParticleProcessMaterial_2nhns"]
direction = Vector3(0, 1, 0)
spread = 20.0
gravity = Vector3(0, 0, 0)
initial_velocity_min = 5.0
initial_velocity_max = 5.0
damping_min = 4.464
damping_max = 4.464
color_ramp = SubResource("GradientTexture1D_gpquw")
[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_2yd7w"]
vertex_color_use_as_albedo = true
[sub_resource type="BoxMesh" id="BoxMesh_q83y7"]
material = SubResource("StandardMaterial3D_2yd7w")
size = Vector3(0.3, 0.3, 0.3)
[sub_resource type="BoxShape3D" id="BoxShape3D_vck5q"]
size = Vector3(2.145, 3.125, 2.415)
[node name="Node3D" type="Node3D" node_paths=PackedStringArray("shapecast", "particlesystem", "model")]
script = ExtResource("1_6dcsj")
shapecast = NodePath("Model/Node3D/ShapeCast3D")
particlesystem = NodePath("Model/Node3D/GPUParticles3D")
status_stats = ExtResource("2_yo2b7")
model = NodePath("Model")
[node name="Model" type="Node3D" parent="."]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 2, 0)
[node name="CSGBox3D" type="CSGBox3D" parent="Model"]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -0.569646, 0)
size = Vector3(1, 1.78698, 1)
[node name="CSGBox3D2" type="CSGBox3D" parent="Model"]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.00567371, -0.274218, -0.514041)
size = Vector3(0.481654, 0.427749, 1.38438)
[node name="Node3D" type="Node3D" parent="Model"]
transform = Transform3D(1, 0, 0, 0, -4.37114e-08, 1, 0, -1, -4.37114e-08, 0, -0.301084, -1.2154)
[node name="GPUParticles3D" type="GPUParticles3D" parent="Model/Node3D"]
amount = 48
visibility_aabb = AABB(-2.2922, -3.14731, -1.92995, 4.5844, 6.29461, 3.85991)
process_material = SubResource("ParticleProcessMaterial_2nhns")
draw_pass_1 = SubResource("BoxMesh_q83y7")
[node name="ShapeCast3D" type="ShapeCast3D" parent="Model/Node3D"]
shape = SubResource("BoxShape3D_vck5q")
target_position = Vector3(0, 1.51, 0)
collision_mask = 4

View File

@ -0,0 +1,19 @@
[gd_resource type="Resource" script_class="Card" load_steps=7 format=3 uid="uid://q23ludhji5p4"]
[ext_resource type="Script" path="res://Scripts/Resources/card.gd" id="1_5html"]
[ext_resource type="Texture2D" uid="uid://d1am28tgvwaa0" path="res://Assets/TextureAtlases/g_accelerator.tres" id="2_a3hso"]
[ext_resource type="Resource" uid="uid://cc20tomywj0jm" path="res://Resources/TurretStats/accelerator.tres" id="3_yj53i"]
[ext_resource type="PackedScene" uid="uid://rcqf3vangjlp" path="res://PCs/Universal/ClassCards/Gatling/weapon_gatling.tscn" id="4_4xp1m"]
[ext_resource type="PackedScene" uid="uid://bwcdgglljbmot" path="res://PCs/Universal/ClassCards/Gatling/tower_gatling.tscn" id="4_maix8"]
[ext_resource type="Resource" uid="uid://ouwge5etb4me" path="res://Resources/WeaponStats/accelerator.tres" id="5_hguan"]
[resource]
script = ExtResource("1_5html")
title = "Accelerator"
rarity = 0
faction = 0
sprite = ExtResource("2_a3hso")
turret = ExtResource("4_maix8")
weapon = ExtResource("4_4xp1m")
weapon_stats = ExtResource("5_hguan")
tower_stats = ExtResource("3_yj53i")

View File

@ -0,0 +1,32 @@
extends Tower
class_name SpeedyTower
var third_cooldown := 0.0
var time_since_firing_started := 0.0
var time_to_reach_max_speed := 3.0
var max_speed_multiplier := 2.0
var destination_multiplier := 0.0
func _ready() -> void:
cooldown = 1.0 / stats.fire_rate
destination_multiplier = 1.0 / max_speed_multiplier
func _process(delta: float) -> void:
other_cooldown -= delta
if !targeted_enemy:
acquire_target()
else:
if model.global_position.distance_to(targeted_enemy.global_position) > stats.fire_range:
targeted_enemy = null
time_since_firing_started = 0.0
third_cooldown = cooldown
if targeted_enemy:
time_since_firing_started += delta
var progress = clamp(time_since_firing_started / time_to_reach_max_speed, 0, 1.0)
third_cooldown = cooldown * (1.0 - (destination_multiplier * progress))
aim()
if other_cooldown <= 0:
shoot()
other_cooldown = third_cooldown

View File

@ -0,0 +1,60 @@
extends Weapon
class_name SpeedyWeapon
var third_cooldown := 0.0
var time_since_firing_started := 0.0
var time_to_reach_max_speed := 3.0
var max_speed_multiplier := 2.0
var destination_multiplier := 0.0
func _ready() -> void:
cooldown = 1.0 / stats.fire_rate
destination_multiplier = 1.0 / max_speed_multiplier
$RayCast3D.target_position = Vector3(0, 0, -stats.fire_range)
func set_raycast_origin(node):
$RayCast3D.global_position = node.global_position
func _process(delta: float) -> void:
if stats != null:
other_cooldown -= delta
if trigger_held:
time_since_firing_started += delta
var progress = clamp(time_since_firing_started / time_to_reach_max_speed, 0, 1.0)
third_cooldown = cooldown * (1.0 - (destination_multiplier * progress))
func _physics_process(_delta: float) -> void:
if trigger_held:
shoot()
func hold_trigger():
trigger_held = true
func release_trigger():
trigger_held = false
time_since_firing_started = 0.0
third_cooldown = cooldown
func shoot():
if other_cooldown <= 0 and stats != null:
other_cooldown = third_cooldown
$AnimationPlayer.play("shoot")
if $RayCast3D.is_colliding():
var target = $RayCast3D.get_collider()
if target != null:
var target_hitbox = target.shape_owner_get_owner($RayCast3D.get_collider_shape())
if target_hitbox is Hitbox:
target_hitbox.damage(stats.damage)
@rpc
func networked_shoot():
$AnimationPlayer.play("shoot")

View File

@ -0,0 +1,38 @@
[gd_scene load_steps=3 format=3 uid="uid://bwcdgglljbmot"]
[ext_resource type="Script" path="res://PCs/Universal/ClassCards/Gatling/speedytower.gd" id="1_26he3"]
[ext_resource type="Resource" uid="uid://cc20tomywj0jm" path="res://Resources/TurretStats/accelerator.tres" id="2_puwlv"]
[node name="Node3D" type="Node3D" node_paths=PackedStringArray("model")]
script = ExtResource("1_26he3")
stats = ExtResource("2_puwlv")
model = NodePath("Model")
[node name="Model" type="Node3D" parent="."]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 2, 0)
[node name="CSGBox3D" type="CSGBox3D" parent="Model"]
[node name="CSGBox3D2" type="CSGBox3D" parent="Model"]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.00131059, 0.27342, -0.880753)
size = Vector3(0.177, 0.148, 0.929)
[node name="CSGBox3D3" type="CSGBox3D" parent="Model"]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.226066, 0.0918715, -0.880753)
size = Vector3(0.177, 0.148, 0.929)
[node name="CSGBox3D4" type="CSGBox3D" parent="Model"]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.227674, -0.174673, -0.880753)
size = Vector3(0.177, 0.148, 0.929)
[node name="CSGBox3D5" type="CSGBox3D" parent="Model"]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.00246562, -0.314903, -0.880753)
size = Vector3(0.177, 0.148, 0.929)
[node name="CSGBox3D6" type="CSGBox3D" parent="Model"]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.259054, -0.125834, -0.880753)
size = Vector3(0.177, 0.148, 0.929)
[node name="CSGBox3D7" type="CSGBox3D" parent="Model"]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.26701, 0.102116, -0.880753)
size = Vector3(0.177, 0.148, 0.929)

View File

@ -0,0 +1,58 @@
[gd_scene load_steps=7 format=3 uid="uid://rcqf3vangjlp"]
[ext_resource type="Texture2D" uid="uid://d1am28tgvwaa0" path="res://Assets/TextureAtlases/g_accelerator.tres" id="1_n3tw0"]
[ext_resource type="Script" path="res://PCs/Universal/ClassCards/Gatling/speedyweapon.gd" id="2_fkecd"]
[ext_resource type="Resource" uid="uid://ouwge5etb4me" path="res://Resources/WeaponStats/accelerator.tres" id="3_nq6wu"]
[sub_resource type="Animation" id="Animation_n8b32"]
length = 0.001
tracks/0/type = "value"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath(".:texture:region")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 0,
"values": [Rect2(0, 0, 64, 64)]
}
[sub_resource type="Animation" id="Animation_g0h8q"]
resource_name = "shoot"
length = 0.15
tracks/0/type = "value"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath(".:texture:region")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/keys = {
"times": PackedFloat32Array(0, 0.15),
"transitions": PackedFloat32Array(0, 0),
"update": 0,
"values": [Rect2(64, 0, 64, 64), Rect2(0, 0, 64, 64)]
}
[sub_resource type="AnimationLibrary" id="AnimationLibrary_ntl6p"]
_data = {
"RESET": SubResource("Animation_n8b32"),
"shoot": SubResource("Animation_g0h8q")
}
[node name="Weapon" type="Sprite3D"]
layers = 2
billboard = 1
texture_filter = 0
texture = ExtResource("1_n3tw0")
script = ExtResource("2_fkecd")
stats = ExtResource("3_nq6wu")
[node name="AnimationPlayer" type="AnimationPlayer" parent="."]
libraries = {
"": SubResource("AnimationLibrary_ntl6p")
}
[node name="RayCast3D" type="RayCast3D" parent="."]
collision_mask = 4

View File

@ -0,0 +1,19 @@
[gd_resource type="Resource" script_class="Card" load_steps=7 format=3 uid="uid://bhmbk26whdsys"]
[ext_resource type="Script" path="res://Scripts/Resources/card.gd" id="1_4m1rh"]
[ext_resource type="Texture2D" uid="uid://jmxhiwsiw1f5" path="res://Assets/TextureAtlases/g_glue_gun.tres" id="2_xsq3l"]
[ext_resource type="Resource" uid="uid://dhcukj44khkd7" path="res://Resources/TurretStats/glue.tres" id="3_tb5qj"]
[ext_resource type="PackedScene" uid="uid://d24q8j53oiyd4" path="res://PCs/Universal/ClassCards/GlueLauncher/weapon_glue_launcher.tscn" id="4_0jn1x"]
[ext_resource type="PackedScene" uid="uid://dja1b2ke8clo5" path="res://PCs/Universal/ClassCards/GlueLauncher/tower_glue_launcher.tscn" id="4_1nhoo"]
[ext_resource type="Resource" uid="uid://dnucn65m12dmq" path="res://Resources/WeaponStats/glue.tres" id="5_qk2lw"]
[resource]
script = ExtResource("1_4m1rh")
title = "Glue Gun"
rarity = 3
faction = 0
sprite = ExtResource("2_xsq3l")
turret = ExtResource("4_1nhoo")
weapon = ExtResource("4_0jn1x")
weapon_stats = ExtResource("5_qk2lw")
tower_stats = ExtResource("3_tb5qj")

View File

@ -0,0 +1,12 @@
extends Tower
class_name StickyTower
@export var status_stats : StatusStats
func shoot():
var status = StatusSticky.new()
status.stats = status_stats
status.affected = targeted_enemy
status.affected.status_manager.add_effect(status)
targeted_enemy.add_child(status)

View File

@ -0,0 +1,19 @@
extends Weapon
class_name StickyWeapon
@export var status_stats : StatusStats
func shoot():
if other_cooldown <= 0 and stats != null:
other_cooldown = cooldown
$AnimationPlayer.play("shoot")
if $RayCast3D.is_colliding():
var target = $RayCast3D.get_collider()
if target != null:
var target_hitbox = target.shape_owner_get_owner($RayCast3D.get_collider_shape())
if target_hitbox is Hitbox:
var status = StatusSticky.new()
status.stats = status_stats
status.affected = target.get_parent()
status.affected.status_manager.add_effect(status)
target.add_child(status)

View File

@ -0,0 +1,26 @@
[gd_scene load_steps=3 format=3 uid="uid://dja1b2ke8clo5"]
[ext_resource type="Script" path="res://PCs/Universal/ClassCards/GlueLauncher/stickytower.gd" id="1_0fo13"]
[ext_resource type="Resource" uid="uid://d0643gfp52x3s" path="res://Resources/StatusEffects/sticky.tres" id="2_f8mxi"]
[node name="Node3D" type="Node3D" node_paths=PackedStringArray("model")]
script = ExtResource("1_0fo13")
status_stats = ExtResource("2_f8mxi")
model = NodePath("Model")
[node name="Model" type="Node3D" parent="."]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 2, 0)
[node name="CSGBox3D" type="CSGBox3D" parent="Model"]
[node name="CSGBox3D2" type="CSGBox3D" parent="Model"]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.0158235, 0, -0.956956)
size = Vector3(0.481654, 0.427749, 1.38438)
[node name="CSGBox3D3" type="CSGBox3D" parent="Model"]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.00590318, 0.717947, 0.210929)
size = Vector3(0.329535, 0.622842, 0.319929)
[node name="CSGBox3D4" type="CSGBox3D" parent="Model"]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.00590295, 0.453314, -0.265725)
size = Vector3(0.329535, 0.622842, 0.319929)

View File

@ -0,0 +1,58 @@
[gd_scene load_steps=7 format=3 uid="uid://d24q8j53oiyd4"]
[ext_resource type="Texture2D" uid="uid://jmxhiwsiw1f5" path="res://Assets/TextureAtlases/g_glue_gun.tres" id="1_pl6t8"]
[ext_resource type="Script" path="res://PCs/Universal/ClassCards/Sniper/scopedweapon.gd" id="2_8m6e6"]
[ext_resource type="Resource" uid="uid://dnucn65m12dmq" path="res://Resources/WeaponStats/glue.tres" id="3_li2dn"]
[sub_resource type="Animation" id="Animation_n8b32"]
length = 0.001
tracks/0/type = "value"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath(".:texture:region")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 0,
"values": [Rect2(0, 0, 64, 64)]
}
[sub_resource type="Animation" id="Animation_g0h8q"]
resource_name = "shoot"
length = 0.15
tracks/0/type = "value"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath(".:texture:region")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/keys = {
"times": PackedFloat32Array(0, 0.15),
"transitions": PackedFloat32Array(0, 0),
"update": 0,
"values": [Rect2(64, 0, 64, 64), Rect2(0, 0, 64, 64)]
}
[sub_resource type="AnimationLibrary" id="AnimationLibrary_ntl6p"]
_data = {
"RESET": SubResource("Animation_n8b32"),
"shoot": SubResource("Animation_g0h8q")
}
[node name="Weapon" type="Sprite3D"]
layers = 2
billboard = 1
texture_filter = 0
texture = ExtResource("1_pl6t8")
script = ExtResource("2_8m6e6")
stats = ExtResource("3_li2dn")
[node name="AnimationPlayer" type="AnimationPlayer" parent="."]
libraries = {
"": SubResource("AnimationLibrary_ntl6p")
}
[node name="RayCast3D" type="RayCast3D" parent="."]
collision_mask = 4

View File

@ -0,0 +1,19 @@
[gd_resource type="Resource" script_class="Card" load_steps=7 format=3 uid="uid://dh5fjnbp8auw1"]
[ext_resource type="Script" path="res://Scripts/Resources/card.gd" id="1_dg0td"]
[ext_resource type="Texture2D" uid="uid://clr6kfyci5jqb" path="res://Assets/TextureAtlases/g_rocket_launcher.tres" id="2_duef5"]
[ext_resource type="Resource" uid="uid://duofn25nuu84q" path="res://Resources/TurretStats/rocketlauncher.tres" id="3_tj17y"]
[ext_resource type="Resource" uid="uid://dtfgyt85mp1ar" path="res://Resources/WeaponStats/rocketlauncher.tres" id="4_hwkrq"]
[ext_resource type="PackedScene" uid="uid://cbmoi73hquaer" path="res://PCs/Universal/ClassCards/RocketLauncher/weapon_rocket_launcher.tscn" id="4_ioexd"]
[ext_resource type="PackedScene" uid="uid://br3bd1jmi235x" path="res://PCs/Universal/ClassCards/RocketLauncher/tower_rocket_launcher.tscn" id="4_mvvp4"]
[resource]
script = ExtResource("1_dg0td")
title = "Rocket Launcher"
rarity = 2
faction = 0
sprite = ExtResource("2_duef5")
turret = ExtResource("4_mvvp4")
weapon = ExtResource("4_ioexd")
weapon_stats = ExtResource("4_hwkrq")
tower_stats = ExtResource("3_tj17y")

View File

@ -0,0 +1,33 @@
extends RigidBody3D
class_name Rocket
@export var damage := 10.0
@export var explosion_range := 6.0
var target : Node3D
var acceleration := 15.0
var direction
var lifetime := 15.0
var time_alive := 0.0
func _process(delta: float) -> void:
time_alive += delta
if time_alive >= lifetime:
explode()
func _physics_process(_delta: float) -> void:
if is_instance_valid(target):
direction = global_position.direction_to(target.global_position)
apply_central_force(direction * acceleration)
func _on_body_entered(_body: Node) -> void:
explode()
func explode():
for enemy in get_tree().get_nodes_in_group("Enemies"):
if global_position.distance_to(enemy.global_position) <= explosion_range:
enemy.damage(damage)
queue_free()

View File

@ -0,0 +1,30 @@
[gd_scene load_steps=5 format=3 uid="uid://hr0dw2533tsl"]
[ext_resource type="Script" path="res://PCs/Universal/ClassCards/RocketLauncher/rocket.gd" id="1_7il2o"]
[ext_resource type="Texture2D" uid="uid://b54d5dc4jmlau" path="res://Assets/Textures/bomb.png" id="2_moh5p"]
[sub_resource type="PhysicsMaterial" id="PhysicsMaterial_whkhx"]
bounce = 0.6
[sub_resource type="SphereShape3D" id="SphereShape3D_mi0in"]
radius = 0.2
[node name="RigidBody3D" type="RigidBody3D"]
collision_layer = 0
collision_mask = 5
physics_material_override = SubResource("PhysicsMaterial_whkhx")
gravity_scale = 0.0
max_contacts_reported = 1
contact_monitor = true
script = ExtResource("1_7il2o")
[node name="Node3D" type="Sprite3D" parent="."]
transform = Transform3D(1.4, 0, 0, 0, 1.4, 0, 0, 0, 1.4, 0, 0, 0)
billboard = 1
texture_filter = 0
texture = ExtResource("2_moh5p")
[node name="CollisionShape3D" type="CollisionShape3D" parent="."]
shape = SubResource("SphereShape3D_mi0in")
[connection signal="body_entered" from="." to="." method="_on_body_entered"]

View File

@ -0,0 +1,66 @@
extends Weapon
class_name RocketWeapon
@export var rocket_scene : PackedScene
@export var target_icon_scene : PackedScene
var rocket_speed = 20.0
var target_max := 3
var targets = []
var target_icons = []
func _ready() -> void:
super._ready()
for x in target_max:
var icon = target_icon_scene.instantiate()
add_child(icon)
icon.set_visible(false)
target_icons.append(icon)
func _process(delta: float) -> void:
super._process(delta)
if !trigger_held or other_cooldown > 0:
return
var target_list = targets.duplicate()
for target in target_list:
if !is_instance_valid(target):
targets.erase(target)
continue
for x in target_icons.size():
if x < targets.size():
target_icons[x].global_position = targets[x].global_position
target_icons[x].set_visible(true)
else:
target_icons[x].set_visible(false)
$TextureRect.set_visible(true)
$TextureRect.texture.region = Rect2(128 * targets.size(), 0, 128, 128)
if targets.size() < target_max and $RayCast3D.is_colliding() and !targets.has($RayCast3D.get_collider()):
targets.append($RayCast3D.get_collider())
func _physics_process(_delta: float) -> void:
pass
func release_trigger():
if trigger_held:
super.release_trigger()
shoot()
func shoot():
if other_cooldown <= 0 and stats != null:
other_cooldown = cooldown
$AnimationPlayer.play("shoot")
for target in targets:
var rocket = rocket_scene.instantiate() as Rocket
rocket.position = $RayCast3D.global_position
rocket.damage = stats.damage
rocket.target = target
get_tree().root.add_child(rocket)
rocket.apply_central_impulse(Vector3.UP * 3.0)
targets.clear()
$TextureRect.set_visible(false)
for icon in target_icons:
icon.set_visible(false)

View File

@ -0,0 +1,56 @@
extends Tower
class_name RocketTower
var targeted_enemies = []
@export var rocket_scene : PackedScene
@export var target_max := 3
var targets = []
func _process(delta: float) -> void:
other_cooldown -= delta
if targets.size() < target_max:
acquire_target()
if targets.size() > 0:
var target_list = targets.duplicate()
for target in target_list:
if !is_instance_valid(target):
targets.erase(target)
continue
if model.global_position.distance_to(target.global_position) > stats.fire_range:
targets.erase(target)
if targets.size() > 0:
targeted_enemy = targets[0]
aim()
if other_cooldown <= 0:
shoot()
other_cooldown = cooldown
func shoot():
for target in targets:
var rocket = rocket_scene.instantiate() as Rocket
rocket.position = model.global_position
rocket.damage = stats.damage
get_tree().root.add_child(rocket)
rocket.target = target
func acquire_target():
var possible_enemies = []
for enemy in get_tree().get_nodes_in_group("Enemies"):
if model.global_position.distance_to(enemy.global_position) > stats.fire_range:
continue
if !(enemy.stats.target_type & stats.can_target):
continue
if targets.has(enemy):
continue
possible_enemies.append(enemy)
for x in target_max - targets.size():
if possible_enemies.size() == 0:
return
var chosen = possible_enemies.pick_random()
possible_enemies.erase(chosen)
targets.append(chosen)

View File

@ -0,0 +1,24 @@
[gd_scene load_steps=4 format=3 uid="uid://br3bd1jmi235x"]
[ext_resource type="Script" path="res://PCs/Universal/ClassCards/RocketLauncher/rockettower.gd" id="1_8hb2v"]
[ext_resource type="PackedScene" uid="uid://hr0dw2533tsl" path="res://PCs/Universal/ClassCards/RocketLauncher/rocket.tscn" id="2_by0gu"]
[ext_resource type="Resource" uid="uid://duofn25nuu84q" path="res://Resources/TurretStats/rocketlauncher.tres" id="3_ynh7l"]
[node name="Node3D" type="Node3D" node_paths=PackedStringArray("model")]
script = ExtResource("1_8hb2v")
rocket_scene = ExtResource("2_by0gu")
stats = ExtResource("3_ynh7l")
model = NodePath("Model")
[node name="Model" type="Node3D" parent="."]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1.97939, 0)
[node name="CSGBox3D" type="CSGBox3D" parent="Model"]
[node name="CSGBox3D2" type="CSGBox3D" parent="Model"]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, -0.65)
size = Vector3(0.805859, 0.771887, 1.04243)
[node name="CSGBox3D3" type="CSGBox3D" parent="Model"]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, -1.20204)
size = Vector3(0.597715, 0.561942, 0.242169)

View File

@ -0,0 +1,79 @@
[gd_scene load_steps=10 format=3 uid="uid://cbmoi73hquaer"]
[ext_resource type="Texture2D" uid="uid://clr6kfyci5jqb" path="res://Assets/TextureAtlases/g_rocket_launcher.tres" id="1_67vj1"]
[ext_resource type="Script" path="res://PCs/Universal/ClassCards/RocketLauncher/rocket_weapon.gd" id="2_rfuq6"]
[ext_resource type="Resource" uid="uid://dtfgyt85mp1ar" path="res://Resources/WeaponStats/rocketlauncher.tres" id="3_7mndo"]
[ext_resource type="PackedScene" uid="uid://hr0dw2533tsl" path="res://PCs/Universal/ClassCards/RocketLauncher/rocket.tscn" id="3_xn783"]
[ext_resource type="PackedScene" uid="uid://csufsbi64asau" path="res://Scenes/target_icon.tscn" id="4_ptwpb"]
[ext_resource type="Texture2D" uid="uid://bgeu8dnqaxq7v" path="res://Assets/TextureAtlases/target_list.tres" id="5_nbrvn"]
[sub_resource type="Animation" id="Animation_n8b32"]
length = 0.001
tracks/0/type = "value"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath(".:texture:region")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 0,
"values": [Rect2(0, 0, 64, 64)]
}
[sub_resource type="Animation" id="Animation_g0h8q"]
resource_name = "shoot"
length = 0.15
tracks/0/type = "value"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath(".:texture:region")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/keys = {
"times": PackedFloat32Array(0, 0.15),
"transitions": PackedFloat32Array(0, 0),
"update": 0,
"values": [Rect2(64, 0, 64, 64), Rect2(0, 0, 64, 64)]
}
[sub_resource type="AnimationLibrary" id="AnimationLibrary_ntl6p"]
_data = {
"RESET": SubResource("Animation_n8b32"),
"shoot": SubResource("Animation_g0h8q")
}
[node name="Weapon" type="Sprite3D"]
layers = 2
billboard = 1
texture_filter = 0
texture = ExtResource("1_67vj1")
script = ExtResource("2_rfuq6")
rocket_scene = ExtResource("3_xn783")
target_icon_scene = ExtResource("4_ptwpb")
stats = ExtResource("3_7mndo")
[node name="AnimationPlayer" type="AnimationPlayer" parent="."]
libraries = {
"": SubResource("AnimationLibrary_ntl6p")
}
[node name="RayCast3D" type="RayCast3D" parent="."]
collision_mask = 4
[node name="TextureRect" type="TextureRect" parent="."]
visible = false
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
texture = ExtResource("5_nbrvn")

View File

@ -0,0 +1,19 @@
[gd_resource type="Resource" script_class="Card" load_steps=7 format=3 uid="uid://cvf5bxtu6er17"]
[ext_resource type="Script" path="res://Scripts/Resources/card.gd" id="1_5vmtk"]
[ext_resource type="Texture2D" uid="uid://fmqq24n7rwvm" path="res://Assets/TextureAtlases/g_sniper.tres" id="2_skiu7"]
[ext_resource type="Resource" uid="uid://85iany3x0uv2" path="res://Resources/WeaponStats/sniper.tres" id="3_acfmb"]
[ext_resource type="PackedScene" uid="uid://v21rc7vtqp8l" path="res://Scenes/Weapons/scopedweapon.tscn" id="3_i0e3w"]
[ext_resource type="Resource" uid="uid://ddw7pj1ckwmp8" path="res://Resources/TurretStats/sniper.tres" id="3_tfyul"]
[ext_resource type="PackedScene" uid="uid://ryhc48vl36fc" path="res://Scenes/Towers/snipertower.tscn" id="4_kbb6b"]
[resource]
script = ExtResource("1_5vmtk")
title = "Sniper"
rarity = 4
faction = 0
sprite = ExtResource("2_skiu7")
turret = ExtResource("4_kbb6b")
weapon = ExtResource("3_i0e3w")
weapon_stats = ExtResource("3_acfmb")
tower_stats = ExtResource("3_tfyul")

View File

@ -0,0 +1,15 @@
extends Weapon
class_name ScopedWeapon
var scope_mask : Texture
func hold_second_trigger():
super.hold_second_trigger()
$CanvasLayer.set_visible(true)
hero.zoom_factor = 3.0
func release_second_trigger():
super.release_second_trigger()
$CanvasLayer.set_visible(false)

View File

@ -0,0 +1,18 @@
[gd_scene load_steps=3 format=3 uid="uid://ryhc48vl36fc"]
[ext_resource type="Script" path="res://PCs/Universal/ClassCards/Assault/tower.gd" id="1_tmpm5"]
[ext_resource type="Resource" uid="uid://ddw7pj1ckwmp8" path="res://Resources/TurretStats/sniper.tres" id="2_opda8"]
[node name="Node3D" type="Node3D" node_paths=PackedStringArray("model")]
script = ExtResource("1_tmpm5")
stats = ExtResource("2_opda8")
model = NodePath("Model")
[node name="Model" type="Node3D" parent="."]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 2, 0)
[node name="CSGBox3D" type="CSGBox3D" parent="Model"]
[node name="CSGBox3D3" type="CSGBox3D" parent="Model"]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, -0.776406)
size = Vector3(0.481654, 0.427749, 1.38438)

View File

@ -0,0 +1,85 @@
[gd_scene load_steps=8 format=3 uid="uid://v21rc7vtqp8l"]
[ext_resource type="Texture2D" uid="uid://fmqq24n7rwvm" path="res://Assets/TextureAtlases/g_sniper.tres" id="1_6a01i"]
[ext_resource type="Script" path="res://PCs/Universal/ClassCards/Sniper/scopedweapon.gd" id="2_qemq6"]
[ext_resource type="Resource" uid="uid://85iany3x0uv2" path="res://Resources/WeaponStats/sniper.tres" id="3_3c36k"]
[ext_resource type="Texture2D" uid="uid://bepgxu7wtcl1i" path="res://Assets/Textures/scopetest.png" id="3_pyugo"]
[sub_resource type="Animation" id="Animation_n8b32"]
length = 0.001
tracks/0/type = "value"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath(".:texture:region")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 0,
"values": [Rect2(0, 0, 64, 64)]
}
[sub_resource type="Animation" id="Animation_g0h8q"]
resource_name = "shoot"
length = 0.15
tracks/0/type = "value"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath(".:texture:region")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/keys = {
"times": PackedFloat32Array(0, 0.15),
"transitions": PackedFloat32Array(0, 0),
"update": 0,
"values": [Rect2(64, 0, 64, 64), Rect2(0, 0, 64, 64)]
}
[sub_resource type="AnimationLibrary" id="AnimationLibrary_ntl6p"]
_data = {
"RESET": SubResource("Animation_n8b32"),
"shoot": SubResource("Animation_g0h8q")
}
[node name="Weapon" type="Sprite3D"]
layers = 2
billboard = 1
texture_filter = 0
texture = ExtResource("1_6a01i")
script = ExtResource("2_qemq6")
stats = ExtResource("3_3c36k")
[node name="AnimationPlayer" type="AnimationPlayer" parent="."]
libraries = {
"": SubResource("AnimationLibrary_ntl6p")
}
[node name="RayCast3D" type="RayCast3D" parent="."]
collision_mask = 4
[node name="CanvasLayer" type="CanvasLayer" parent="."]
layer = 2
visible = false
[node name="TextureRect" type="TextureRect" parent="CanvasLayer"]
clip_children = 1
visibility_layer = 2
texture_filter = 1
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
mouse_filter = 2
texture = ExtResource("3_pyugo")
[node name="ColorRect" type="ColorRect" parent="CanvasLayer/TextureRect"]
layout_mode = 1
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
mouse_filter = 2
color = Color(0, 0, 0, 1)

211
PCs/hero.gd Normal file
View File

@ -0,0 +1,211 @@
extends CharacterBody3D
class_name Hero
signal ready_state_changed(state)
signal spawned
signal died
@export var hero_class: HeroClass
@export var camera : Camera3D
@export var left_hand : Node3D
@export var right_hand : Node3D
@export var right_hand_animator : AnimationPlayer
@export var edit_tool : EditTool
@export var gauntlet_sprite : Sprite3D
@export var sprite : EightDirectionSprite3D
@export var interaction_raycast : RayCast3D
@export var inventory : Inventory
@export var weapon : Weapon
@export var card : CardInHand
@export var pause_menu_scene : PackedScene
@export var weapon_scene : PackedScene
@export var hud : HUD
@export var movement : PlayerMovement
var equipped_card : Card
var paused := false
var editing_mode := true
var profile: PlayerProfile
var ready_state := false :
set(value):
ready_state = value
networked_set_ready_state.rpc(ready_state)
ready_state_changed.emit(ready_state)
var currency := 0 :
set(value):
currency = value
hud.set_currency_count(value)
get:
return currency
@export var sprint_zoom_speed := 0.2
func _ready() -> void:
if is_multiplayer_authority():
right_hand_animator.play("weapon_sway")
right_hand_animator.speed_scale = 0
hud.set_visible(true)
camera.make_current()
sprite.queue_free()
else:
camera.set_visible(false)
if weapon != null:
weapon.set_raycast_origin(camera)
inventory.contents.append_array(hero_class.deck)
sprite.texture = hero_class.texture
check_left_hand_valid()
Input.mouse_mode = Input.MOUSE_MODE_CAPTURED
func _physics_process(delta: float) -> void:
if !is_multiplayer_authority() or paused:
return
if movement.input_vector == Vector2.ZERO:
right_hand_animator.speed_scale = 0
elif movement.sprinting:
right_hand_animator.speed_scale = 1
else:
right_hand_animator.speed_scale = 0.6
func _process(delta: float) -> void:
if !is_multiplayer_authority() or paused:
return
if !movement.sprinting:
movement.zoom_factor += sprint_zoom_speed * 2.0 * delta
if movement.zoom_factor > 1.0:
movement.zoom_factor = 1.0
if editing_mode:
if edit_tool.is_looking_at_tower_base:
card.view_tower()
else:
card.view_weapon()
if Input.is_action_just_pressed("Interact"):
edit_tool.interact()
if interaction_raycast.get_collider() is InteractButton:
var button = interaction_raycast.get_collider() as InteractButton
if currency >= button.press_cost:
button.press()
currency -= button.press_cost
if interaction_raycast.get_collider() is ItemCard:
inventory.add(interaction_raycast.get_collider().pick_up())
if Input.is_action_just_pressed("Equip In Gauntlet"):
equip_weapon()
if Input.is_action_just_pressed("Select Next Card"):
inventory.increment_selected()
if Input.is_action_just_pressed("Select Previous Card"):
inventory.decrement_selected()
if Input.is_action_just_pressed("Primary Fire"):
edit_tool.interact_key_held = true
if Input.is_action_just_released("Primary Fire"):
edit_tool.interact_key_held = false
if weapon != null:
weapon.release_trigger()
weapon.release_second_trigger()
else:
if weapon != null and Input.is_action_just_pressed("Primary Fire"):
weapon.hold_trigger()
if weapon != null and Input.is_action_just_released("Primary Fire"):
weapon.release_trigger()
if weapon != null and Input.is_action_pressed("Secondary Fire"):
weapon.hold_second_trigger()
if weapon != null and Input.is_action_just_released("Secondary Fire"):
weapon.release_second_trigger()
if weapon != null and Input.is_action_pressed("Primary Fire"):
movement.can_sprint = false
if weapon != null and Input.is_action_pressed("Secondary Fire"):
movement.can_sprint = false
if movement.sprinting:
movement.zoom_factor -= sprint_zoom_speed * delta
if movement.zoom_factor <= 1.0 - movement.sprint_zoom_factor:
movement.zoom_factor = 1.0 - movement.sprint_zoom_factor
camera.fov = Data.preferences.hfov * (1.0 / movement.zoom_factor)
if Input.is_action_just_pressed("View Map"):
hud.maximise_minimap(Game.level)
#Input.mouse_mode = Input.MOUSE_MODE_VISIBLE
if Input.is_action_just_released("View Map"):
hud.minimize_minimap(self)
#Input.mouse_mode = Input.MOUSE_MODE_CAPTURED
check_left_hand_valid()
func _unhandled_input(event: InputEvent) -> void:
if !is_multiplayer_authority() or paused:
return
if editing_mode and event.is_action_pressed("Ready"):
edit_tool.interact_key_held = false
ready_state = true
if event.is_action_pressed("Pause"):
var menu = pause_menu_scene.instantiate() as PauseMenu
pause()
menu.closed.connect(unpause)
hud.add_child(menu)
func unpause():
paused = false
Input.mouse_mode = Input.MOUSE_MODE_CAPTURED
func pause():
paused = true
Input.mouse_mode = Input.MOUSE_MODE_VISIBLE
func enter_editing_mode(value):
hud.set_wave_count(value + 1)
editing_mode = true
edit_tool.enabled = true
check_left_hand_valid()
if weapon != null:
weapon.release_trigger()
func exit_editing_mode(value):
hud.set_wave_count(value)
edit_tool.enabled = false
left_hand.set_visible(false)
editing_mode = false
func check_left_hand_valid():
if inventory.contents.size() == 0:
left_hand.set_visible(false)
#gauntlet.texture.region = Rect2(64, 0, 64, 64)
else:
left_hand.set_visible(true)
#gauntlet.texture.region = Rect2(0, 0, 64, 64)
card.set_card(inventory.selected_item)
func equip_weapon():
if weapon != null:
unequip_weapon()
return
if inventory.contents.size() > 0:
equipped_card = inventory.remove()
weapon = equipped_card.weapon.instantiate()
right_hand.add_child(weapon)
gauntlet_sprite.set_visible(false)
weapon.set_raycast_origin(camera)
weapon.set_hero(self)
check_left_hand_valid()
func unequip_weapon():
gauntlet_sprite.set_visible(true)
weapon.queue_free()
inventory.add(equipped_card)
equipped_card = null
check_left_hand_valid()
#MULTIPLAYER NETWORKED FUNCTIONS
@rpc("reliable")
func networked_set_ready_state(state: bool):
ready_state = state
ready_state_changed.emit(state)

425
PCs/hero.tscn Normal file
View File

@ -0,0 +1,425 @@
[gd_scene load_steps=29 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"]
[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="PackedScene" uid="uid://buvgdem68wtev" path="res://Scenes/Menus/pause_menu.tscn" id="3_avnsx"]
[ext_resource type="PackedScene" uid="uid://d1xe6hsq05110" path="res://PCs/Universal/ClassCards/Assault/weapon_assault.tscn" id="4_b0lpv"]
[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="Script" path="res://Scripts/inventory.gd" id="6_cf5ap"]
[ext_resource type="Texture2D" uid="uid://hxev3a2ktya" path="res://Assets/TextureAtlases/red.tres" id="6_loffy"]
[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/on_top_camera.gd" id="11_4sdwe"]
[ext_resource type="Script" path="res://Scripts/minimap_cam.gd" id="12_3hpi3"]
[ext_resource type="Texture2D" uid="uid://b6iego7256jf2" path="res://Assets/Textures/wavecounter.png" id="14_l34nu"]
[ext_resource type="PackedScene" uid="uid://24x18qxqhy0i" path="res://Scenes/UI/lives_bar.tscn" id="15_cqpib"]
[ext_resource type="Texture2D" uid="uid://c60fh34ttgcvh" path="res://Assets/Textures/minimap_player.png" id="15_nhlam"]
[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="Script" path="res://PCs/player_movement.gd" id="20_cfhw8"]
[sub_resource type="CapsuleShape3D" id="CapsuleShape3D_jbu13"]
[sub_resource type="Environment" id="Environment_ekmug"]
[sub_resource type="Animation" id="Animation_2q50p"]
resource_name = "weapon_sway"
length = 0.8
loop_mode = 1
tracks/0/type = "position_3d"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath(".")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/keys = PackedFloat32Array(0, 1, 0.615, -0.275, -1, 0.2, 1, 0.59, -0.255, -1, 0.4, 1, 0.615, -0.275, -1, 0.6, 1, 0.66, -0.255, -1, 0.8, 1, 0.615, -0.275, -1)
[sub_resource type="AnimationLibrary" id="AnimationLibrary_2wknc"]
_data = {
"weapon_sway": SubResource("Animation_2q50p")
}
[sub_resource type="ViewportTexture" id="ViewportTexture_8f12g"]
viewport_path = NodePath("SubViewport/Head2/LeftHand/SubViewport")
[sub_resource type="Environment" id="Environment_cilxe"]
background_mode = 1
background_color = Color(0.282353, 0.615686, 0.278431, 1)
[sub_resource type="ViewportTexture" id="ViewportTexture_mk87g"]
viewport_path = NodePath("SubViewport")
[sub_resource type="ViewportTexture" id="ViewportTexture_574jy"]
viewport_path = NodePath("MiniMapViewport")
[node name="Character" type="CharacterBody3D" node_paths=PackedStringArray("camera", "left_hand", "right_hand", "right_hand_animator", "edit_tool", "gauntlet_sprite", "sprite", "interaction_raycast", "inventory", "card", "hud", "movement")]
collision_layer = 2
collision_mask = 37
script = ExtResource("1_pihpe")
hero_class = ExtResource("2_dbyo0")
camera = NodePath("Head")
left_hand = NodePath("SubViewport/Head2/LeftHand")
right_hand = NodePath("SubViewport/Head2/RightHand")
right_hand_animator = NodePath("SubViewport/Head2/RightHand/AnimationPlayer")
edit_tool = NodePath("Head/EditTool")
gauntlet_sprite = NodePath("SubViewport/Head2/RightHand/Gauntlet")
sprite = NodePath("EightDirectionSprite")
interaction_raycast = NodePath("Head/RayCast3D")
inventory = NodePath("Inventory")
card = NodePath("SubViewport/Head2/LeftHand/SubViewport/Node2D")
pause_menu_scene = ExtResource("3_avnsx")
weapon_scene = ExtResource("4_b0lpv")
hud = NodePath("HUD")
movement = NodePath("PlayerMovement")
[node name="CollisionShape3D" type="CollisionShape3D" parent="."]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1, 0)
shape = SubResource("CapsuleShape3D_jbu13")
[node name="Head" type="Camera3D" parent="."]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1.5, 0)
keep_aspect = 0
cull_mask = 1048569
fov = 100.0
[node name="EditTool" parent="Head" node_paths=PackedStringArray("hero", "inventory") instance=ExtResource("5_jlxb3")]
hero = NodePath("../..")
inventory = NodePath("../../Inventory")
[node name="RayCast3D" type="RayCast3D" parent="Head"]
target_position = Vector3(0, 0, -2)
collision_mask = 24
[node name="EightDirectionSprite" parent="." instance=ExtResource("2_ib0t5")]
transform = Transform3D(2, 0, 0, 0, 2, 0, 0, 0, 2, 0, 0.915529, 0)
texture = ExtResource("6_loffy")
[node name="Inventory" type="Node" parent="."]
script = ExtResource("6_cf5ap")
[node name="SubViewport" type="SubViewport" parent="."]
transparent_bg = true
size = Vector2i(1920, 1080)
render_target_update_mode = 4
[node name="Head2" type="Camera3D" parent="SubViewport" node_paths=PackedStringArray("clone_camera")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1.5, 0)
cull_mask = 2
environment = SubResource("Environment_ekmug")
projection = 1
script = ExtResource("11_4sdwe")
clone_camera = NodePath("../../Head")
[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)
[node name="AnimationPlayer" type="AnimationPlayer" parent="SubViewport/Head2/RightHand"]
libraries = {
"": SubResource("AnimationLibrary_2wknc")
}
[node name="Gauntlet" type="Sprite3D" parent="SubViewport/Head2/RightHand"]
layers = 2
texture_filter = 0
texture = ExtResource("3_5myy0")
[node name="LeftHand" type="Node3D" parent="SubViewport/Head2"]
transform = Transform3D(0.235, 0, 0, 0, 0.235, 0, 0, 0, 0.235, -0.665, -0.275, -1)
[node name="SubViewport" type="SubViewport" parent="SubViewport/Head2/LeftHand"]
transparent_bg = true
size = Vector2i(192, 192)
render_target_update_mode = 4
[node name="Node2D" parent="SubViewport/Head2/LeftHand/SubViewport" instance=ExtResource("4_mwtvp")]
[node name="Sprite3D" type="Sprite3D" parent="SubViewport/Head2/LeftHand"]
layers = 2
texture_filter = 0
texture = SubResource("ViewportTexture_8f12g")
[node name="MiniMapViewport" type="SubViewport" parent="."]
size = Vector2i(256, 256)
render_target_update_mode = 4
[node name="Camera3D" type="Camera3D" parent="MiniMapViewport" node_paths=PackedStringArray("anchor")]
transform = Transform3D(1, 0, 0, 0, -4.37114e-08, 1, 0, -1, -4.37114e-08, 0, 3.28551, 0)
cull_mask = 4
environment = SubResource("Environment_cilxe")
projection = 1
size = 15.0
script = ExtResource("12_3hpi3")
anchor = NodePath("../..")
face_north = true
[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", "enemy_sprites", "enemy_counts")]
script = ExtResource("8_yl6ka")
wave_count = NodePath("WaveCount")
lives_count = NodePath("LivesCount")
enemy_count = NodePath("EnemyCount")
currency_count = NodePath("Currency")
crosshair = NodePath("Crosshair")
minimap = NodePath("TextureRect2")
minimap_cam = NodePath("../MiniMapViewport/Camera3D")
minimap_viewport = NodePath("../MiniMapViewport")
fps_label = NodePath("Label")
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")]
[node name="TextureRect4" type="TextureRect" parent="HUD"]
texture_filter = 1
anchors_preset = 5
anchor_left = 0.5
anchor_right = 0.5
offset_left = -154.0
offset_top = 22.0
offset_right = 154.0
offset_bottom = 116.0
grow_horizontal = 2
mouse_filter = 2
texture = ExtResource("14_l34nu")
[node name="TextureRect" type="TextureRect" parent="HUD/TextureRect4"]
visible = false
layout_mode = 0
offset_right = 64.0
offset_bottom = 64.0
texture = ExtResource("15_q3yot")
[node name="Label" type="Label" parent="HUD/TextureRect4/TextureRect"]
layout_mode = 0
offset_left = 28.01
offset_top = 41.81
offset_right = 68.01
offset_bottom = 66.8101
theme_override_colors/font_color = Color(1, 1, 1, 1)
theme_override_colors/font_outline_color = Color(0, 0, 0, 1)
theme_override_constants/outline_size = 5
theme_override_font_sizes/font_size = 15
text = "999"
horizontal_alignment = 1
vertical_alignment = 1
[node name="TextureRect2" type="TextureRect" parent="HUD/TextureRect4"]
visible = false
layout_mode = 0
offset_left = 61.0
offset_right = 125.0
offset_bottom = 64.0
texture = ExtResource("15_q3yot")
[node name="Label2" type="Label" parent="HUD/TextureRect4/TextureRect2"]
layout_mode = 0
offset_left = 28.745
offset_top = 41.81
offset_right = 68.7451
offset_bottom = 66.8101
theme_override_colors/font_color = Color(1, 1, 1, 1)
theme_override_colors/font_outline_color = Color(0, 0, 0, 1)
theme_override_constants/outline_size = 5
theme_override_font_sizes/font_size = 15
text = "999"
horizontal_alignment = 1
vertical_alignment = 1
[node name="TextureRect3" type="TextureRect" parent="HUD/TextureRect4"]
visible = false
layout_mode = 0
offset_left = 122.0
offset_right = 186.0
offset_bottom = 64.0
texture = ExtResource("15_q3yot")
[node name="Label3" type="Label" parent="HUD/TextureRect4/TextureRect3"]
layout_mode = 0
offset_left = 29.29
offset_top = 41.81
offset_right = 69.2901
offset_bottom = 66.8101
theme_override_colors/font_color = Color(1, 1, 1, 1)
theme_override_colors/font_outline_color = Color(0, 0, 0, 1)
theme_override_constants/outline_size = 5
theme_override_font_sizes/font_size = 15
text = "999"
horizontal_alignment = 1
vertical_alignment = 1
[node name="TextureRect4" type="TextureRect" parent="HUD/TextureRect4"]
visible = false
layout_mode = 0
offset_left = 183.0
offset_right = 247.0
offset_bottom = 64.0
texture = ExtResource("15_q3yot")
[node name="Label4" type="Label" parent="HUD/TextureRect4/TextureRect4"]
layout_mode = 0
offset_left = 29.0
offset_top = 41.81
offset_right = 69.0
offset_bottom = 66.8101
theme_override_colors/font_color = Color(1, 1, 1, 1)
theme_override_colors/font_outline_color = Color(0, 0, 0, 1)
theme_override_constants/outline_size = 5
theme_override_font_sizes/font_size = 15
text = "999"
horizontal_alignment = 1
vertical_alignment = 1
[node name="TextureRect5" type="TextureRect" parent="HUD/TextureRect4"]
visible = false
layout_mode = 0
offset_left = 244.0
offset_right = 308.0
offset_bottom = 64.0
texture = ExtResource("15_q3yot")
[node name="Label5" type="Label" parent="HUD/TextureRect4/TextureRect5"]
layout_mode = 0
offset_left = 29.0
offset_top = 41.81
offset_right = 69.0
offset_bottom = 66.8101
theme_override_colors/font_color = Color(1, 1, 1, 1)
theme_override_colors/font_outline_color = Color(0, 0, 0, 1)
theme_override_constants/outline_size = 5
theme_override_font_sizes/font_size = 15
text = "999"
horizontal_alignment = 1
vertical_alignment = 1
[node name="WaveCount" type="Label" parent="HUD"]
anchors_preset = 5
anchor_left = 0.5
anchor_right = 0.5
offset_left = -30.0
offset_top = 83.0
offset_right = 30.0
offset_bottom = 26.0
grow_horizontal = 2
theme_override_colors/font_color = Color(0, 0, 0, 1)
text = "1"
horizontal_alignment = 1
vertical_alignment = 1
[node name="EnemyCount" type="Label" parent="HUD"]
offset_left = 10.0
offset_top = 80.0
offset_right = 123.0
offset_bottom = 106.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"]
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
mouse_filter = 2
texture = SubResource("ViewportTexture_mk87g")
[node name="TextureRect2" type="TextureRect" parent="HUD"]
anchors_preset = 1
anchor_left = 1.0
anchor_right = 1.0
offset_left = -256.0
offset_top = 40.0
offset_right = -40.0
offset_bottom = 256.0
grow_horizontal = 0
mouse_filter = 2
texture = SubResource("ViewportTexture_574jy")
[node name="Label" type="Label" parent="HUD"]
anchors_preset = 1
anchor_left = 1.0
anchor_right = 1.0
offset_left = -40.0
offset_bottom = 26.0
grow_horizontal = 0
text = "FPS: "
horizontal_alignment = 2
vertical_alignment = 1
[node name="LivesBar" parent="HUD" instance=ExtResource("15_cqpib")]
anchors_preset = 0
anchor_right = 0.0
anchor_bottom = 0.0
offset_left = 10.0
offset_top = 10.0
offset_right = 214.0
offset_bottom = 32.0
grow_horizontal = 1
grow_vertical = 1
scale = Vector2(3, 3)
mouse_filter = 2
[node name="LivesCount" type="Label" parent="HUD"]
offset_left = -5.0
offset_top = 15.0
offset_right = 100.0
offset_bottom = 72.0
theme_override_colors/font_color = Color(0.65098, 0.227451, 0.243137, 1)
theme_override_font_sizes/font_size = 37
text = "120
"
horizontal_alignment = 1
vertical_alignment = 1
[node name="TextureRect3" type="TextureRect" parent="HUD"]
texture_filter = 1
anchors_preset = 1
anchor_left = 1.0
anchor_right = 1.0
offset_left = -262.0
offset_top = 37.0
offset_right = -37.0
offset_bottom = 336.0
grow_horizontal = 0
mouse_filter = 2
texture = ExtResource("16_x1xjr")
[node name="Currency" type="Label" parent="HUD"]
anchors_preset = 1
anchor_left = 1.0
anchor_right = 1.0
offset_left = -99.0
offset_top = 298.0
offset_right = -57.0
offset_bottom = 352.0
grow_horizontal = 0
theme_override_colors/font_color = Color(0.988235, 0.909804, 0.65098, 1)
theme_override_font_sizes/font_size = 37
text = "20"
horizontal_alignment = 1
vertical_alignment = 1
[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="PlayerMovement" type="Node" parent="." node_paths=PackedStringArray("player", "head")]
script = ExtResource("20_cfhw8")
player = NodePath("..")
head = NodePath("../Head")

69
PCs/player_movement.gd Normal file
View File

@ -0,0 +1,69 @@
extends Node
class_name PlayerMovement
@export var player : CharacterBody3D
@export var head : Camera3D
@export var movement_speed := 3.5
@export var sprint_boost := 0.1
@export var acceleration := 0.8
@export var friction_percentage := 0.15
var zoom_factor := 1.0
var input_vector : Vector2
var can_sprint := true
var sprint_zoom_factor := 0.08
var sprinting := false
var head_angle := 0.0
var look_sens : float :
set(value):
return
get:
return Data.preferences.mouse_sens / 40000.0
func _physics_process(delta: float) -> void:
var accel = acceleration
if sprinting:
accel = acceleration + sprint_boost
var result_vector = input_vector * accel
var down_velocity = player.velocity.y
player.velocity = player.velocity.limit_length(player.velocity.length() * (1.0 - friction_percentage))
player.velocity += ((player.transform.basis.z * result_vector.y) + (player.transform.basis.x * result_vector.x))
player.velocity.y = down_velocity
player.velocity += Vector3.DOWN * 9.81 * delta
player.move_and_slide()
sync_position.rpc(player.position)
sync_rotation.rpc(player.rotation)
func _process(delta: float) -> void:
can_sprint = true
input_vector = Input.get_vector("Move Left", "Move Right", "Move Forward", "Move Backward")
if input_vector.y >= 0:
can_sprint = false
if Data.preferences.toggle_sprint:
if Input.is_action_just_pressed("Sprint"):
sprinting = !sprinting
else:
sprinting = Input.is_action_pressed("Sprint")
if !can_sprint:
sprinting = false
if Input.is_action_just_pressed("Jump") and player.is_on_floor():
player.velocity.y += 4.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.rotation.x = head_angle
@rpc
func sync_position(vec):
player.position = vec
@rpc
func sync_rotation(rot):
player.rotation = rot