waited far too long for an initial commit but here we are
This commit is contained in:
19
PCs/Universal/ClassCards/Gatling/card_gatling.tres
Normal file
19
PCs/Universal/ClassCards/Gatling/card_gatling.tres
Normal 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")
|
32
PCs/Universal/ClassCards/Gatling/speedytower.gd
Normal file
32
PCs/Universal/ClassCards/Gatling/speedytower.gd
Normal 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
|
60
PCs/Universal/ClassCards/Gatling/speedyweapon.gd
Normal file
60
PCs/Universal/ClassCards/Gatling/speedyweapon.gd
Normal 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")
|
||||
|
38
PCs/Universal/ClassCards/Gatling/tower_gatling.tscn
Normal file
38
PCs/Universal/ClassCards/Gatling/tower_gatling.tscn
Normal 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)
|
58
PCs/Universal/ClassCards/Gatling/weapon_gatling.tscn
Normal file
58
PCs/Universal/ClassCards/Gatling/weapon_gatling.tscn
Normal 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
|
Reference in New Issue
Block a user