inching towards better class inheritence and multiplayer compatibility
This commit is contained in:
@@ -1,19 +1,23 @@
|
||||
[gd_resource type="Resource" script_class="Card" load_steps=7 format=3 uid="uid://dh5fjnbp8auw1"]
|
||||
[gd_resource type="Resource" script_class="Card" load_steps=8 format=3 uid="uid://b37r54q84vqoi"]
|
||||
|
||||
[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"]
|
||||
[ext_resource type="Script" path="res://Scripts/Resources/card.gd" id="1_ly0o5"]
|
||||
[ext_resource type="Texture2D" uid="uid://by1y15lm0bppe" path="res://PCs/Universal/ClassCards/RocketLauncher/rocket_launcher.png" id="2_iqnic"]
|
||||
[ext_resource type="Resource" uid="uid://c65rq455ma8f6" path="res://PCs/Universal/ClassCards/RocketLauncher/tower_stats.tres" id="3_06my6"]
|
||||
[ext_resource type="PackedScene" uid="uid://bdp7icdejayvr" path="res://PCs/Universal/ClassCards/RocketLauncher/weapon_rocket_launcher.tscn" id="3_qo5gv"]
|
||||
[ext_resource type="Resource" uid="uid://d2yo07m2mp2mp" path="res://PCs/Universal/ClassCards/RocketLauncher/weapon_stats.tres" id="4_cmvfg"]
|
||||
[ext_resource type="PackedScene" uid="uid://b3q0f6w30nwsh" path="res://PCs/Universal/ClassCards/RocketLauncher/tower_rocket_launcher.tscn" id="4_hff2k"]
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_u80vk"]
|
||||
atlas = ExtResource("2_iqnic")
|
||||
region = Rect2(0, 0, 64, 64)
|
||||
|
||||
[resource]
|
||||
script = ExtResource("1_dg0td")
|
||||
script = ExtResource("1_ly0o5")
|
||||
title = "Rocket Launcher"
|
||||
rarity = 0
|
||||
faction = 0
|
||||
sprite = ExtResource("2_duef5")
|
||||
turret = ExtResource("4_mvvp4")
|
||||
weapon = ExtResource("4_ioexd")
|
||||
weapon_stats = ExtResource("4_hwkrq")
|
||||
tower_stats = ExtResource("3_tj17y")
|
||||
sprite = SubResource("AtlasTexture_u80vk")
|
||||
turret_scene = ExtResource("4_hff2k")
|
||||
weapon_scene = ExtResource("3_qo5gv")
|
||||
weapon_stats = ExtResource("4_cmvfg")
|
||||
tower_stats = ExtResource("3_06my6")
|
||||
|
@@ -1,33 +0,0 @@
|
||||
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()
|
BIN
PCs/Universal/ClassCards/RocketLauncher/rocket.png
Normal file
BIN
PCs/Universal/ClassCards/RocketLauncher/rocket.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 835 B |
34
PCs/Universal/ClassCards/RocketLauncher/rocket.png.import
Normal file
34
PCs/Universal/ClassCards/RocketLauncher/rocket.png.import
Normal file
@@ -0,0 +1,34 @@
|
||||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://bode8mfmr3r1h"
|
||||
path="res://.godot/imported/rocket.png-351afd78a91fe9f7469af30003adbe29.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://PCs/Universal/ClassCards/RocketLauncher/rocket.png"
|
||||
dest_files=["res://.godot/imported/rocket.png-351afd78a91fe9f7469af30003adbe29.ctex"]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=0
|
||||
compress/high_quality=false
|
||||
compress/lossy_quality=0.7
|
||||
compress/hdr_compression=1
|
||||
compress/normal_map=0
|
||||
compress/channel_pack=0
|
||||
mipmaps/generate=true
|
||||
mipmaps/limit=-1
|
||||
roughness/mode=0
|
||||
roughness/src_normal=""
|
||||
process/fix_alpha_border=true
|
||||
process/premult_alpha=false
|
||||
process/normal_map_invert_y=false
|
||||
process/hdr_as_srgb=false
|
||||
process/hdr_clamp_exposure=false
|
||||
process/size_limit=0
|
||||
detect_3d/compress_to=0
|
BIN
PCs/Universal/ClassCards/RocketLauncher/rocket.png.kra
Normal file
BIN
PCs/Universal/ClassCards/RocketLauncher/rocket.png.kra
Normal file
Binary file not shown.
@@ -1,30 +0,0 @@
|
||||
[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"]
|
BIN
PCs/Universal/ClassCards/RocketLauncher/rocket_launcher.png
Normal file
BIN
PCs/Universal/ClassCards/RocketLauncher/rocket_launcher.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 2.6 KiB |
@@ -0,0 +1,34 @@
|
||||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://by1y15lm0bppe"
|
||||
path="res://.godot/imported/rocket_launcher.png-2d44107b7f14206d86d0c1171ba425e8.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://PCs/Universal/ClassCards/RocketLauncher/rocket_launcher.png"
|
||||
dest_files=["res://.godot/imported/rocket_launcher.png-2d44107b7f14206d86d0c1171ba425e8.ctex"]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=0
|
||||
compress/high_quality=false
|
||||
compress/lossy_quality=0.7
|
||||
compress/hdr_compression=1
|
||||
compress/normal_map=0
|
||||
compress/channel_pack=0
|
||||
mipmaps/generate=true
|
||||
mipmaps/limit=-1
|
||||
roughness/mode=0
|
||||
roughness/src_normal=""
|
||||
process/fix_alpha_border=true
|
||||
process/premult_alpha=false
|
||||
process/normal_map_invert_y=false
|
||||
process/hdr_as_srgb=false
|
||||
process/hdr_clamp_exposure=false
|
||||
process/size_limit=0
|
||||
detect_3d/compress_to=0
|
@@ -0,0 +1,2 @@
|
||||
extends HomingProjectile
|
||||
class_name RocketProjectile
|
@@ -0,0 +1,14 @@
|
||||
[gd_scene load_steps=4 format=3 uid="uid://p2vwo8ivben6"]
|
||||
|
||||
[ext_resource type="PackedScene" uid="uid://di2wwvkv4wov1" path="res://Scenes/Projectiles/homing_projectile.tscn" id="1_fnn4i"]
|
||||
[ext_resource type="Script" path="res://PCs/Universal/ClassCards/RocketLauncher/rocket_projectile.gd" id="2_86up0"]
|
||||
[ext_resource type="Texture2D" uid="uid://bode8mfmr3r1h" path="res://PCs/Universal/ClassCards/RocketLauncher/rocket.png" id="3_aonkx"]
|
||||
|
||||
[node name="Rocket" instance=ExtResource("1_fnn4i")]
|
||||
script = ExtResource("2_86up0")
|
||||
acceleration = 40.0
|
||||
max_speed = 14.0
|
||||
|
||||
[node name="Sprite3D" parent="." index="1"]
|
||||
pixel_size = 0.013
|
||||
texture = ExtResource("3_aonkx")
|
@@ -1,66 +0,0 @@
|
||||
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)
|
BIN
PCs/Universal/ClassCards/RocketLauncher/target_icon.png
Normal file
BIN
PCs/Universal/ClassCards/RocketLauncher/target_icon.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.4 KiB |
@@ -0,0 +1,34 @@
|
||||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://hnfa76d6tdi"
|
||||
path="res://.godot/imported/target_icon.png-62861a4f843a005c647a8233c54d7a2c.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://PCs/Universal/ClassCards/RocketLauncher/target_icon.png"
|
||||
dest_files=["res://.godot/imported/target_icon.png-62861a4f843a005c647a8233c54d7a2c.ctex"]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=0
|
||||
compress/high_quality=false
|
||||
compress/lossy_quality=0.7
|
||||
compress/hdr_compression=1
|
||||
compress/normal_map=0
|
||||
compress/channel_pack=0
|
||||
mipmaps/generate=true
|
||||
mipmaps/limit=-1
|
||||
roughness/mode=0
|
||||
roughness/src_normal=""
|
||||
process/fix_alpha_border=true
|
||||
process/premult_alpha=false
|
||||
process/normal_map_invert_y=false
|
||||
process/hdr_as_srgb=false
|
||||
process/hdr_clamp_exposure=false
|
||||
process/size_limit=0
|
||||
detect_3d/compress_to=0
|
12
PCs/Universal/ClassCards/RocketLauncher/target_icon.tscn
Normal file
12
PCs/Universal/ClassCards/RocketLauncher/target_icon.tscn
Normal file
@@ -0,0 +1,12 @@
|
||||
[gd_scene load_steps=2 format=3 uid="uid://csufsbi64asau"]
|
||||
|
||||
[ext_resource type="Texture2D" uid="uid://hnfa76d6tdi" path="res://PCs/Universal/ClassCards/RocketLauncher/target_icon.png" id="1_r4a3f"]
|
||||
|
||||
[node name="Node3D" type="Sprite3D"]
|
||||
sorting_offset = 20.0
|
||||
pixel_size = 0.002
|
||||
billboard = 1
|
||||
no_depth_test = true
|
||||
fixed_size = true
|
||||
texture_filter = 0
|
||||
texture = ExtResource("1_r4a3f")
|
BIN
PCs/Universal/ClassCards/RocketLauncher/target_list.png
Normal file
BIN
PCs/Universal/ClassCards/RocketLauncher/target_list.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 3.2 KiB |
@@ -0,0 +1,34 @@
|
||||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://cc2umukpibmx1"
|
||||
path="res://.godot/imported/target_list.png-65d3525b52a0ccfc6d97382117363a29.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://PCs/Universal/ClassCards/RocketLauncher/target_list.png"
|
||||
dest_files=["res://.godot/imported/target_list.png-65d3525b52a0ccfc6d97382117363a29.ctex"]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=0
|
||||
compress/high_quality=false
|
||||
compress/lossy_quality=0.7
|
||||
compress/hdr_compression=1
|
||||
compress/normal_map=0
|
||||
compress/channel_pack=0
|
||||
mipmaps/generate=false
|
||||
mipmaps/limit=-1
|
||||
roughness/mode=0
|
||||
roughness/src_normal=""
|
||||
process/fix_alpha_border=true
|
||||
process/premult_alpha=false
|
||||
process/normal_map_invert_y=false
|
||||
process/hdr_as_srgb=false
|
||||
process/hdr_clamp_exposure=false
|
||||
process/size_limit=0
|
||||
detect_3d/compress_to=1
|
@@ -0,0 +1,75 @@
|
||||
extends ProjectileTower
|
||||
class_name RocketLauncherTower
|
||||
|
||||
var target_max := 3
|
||||
var targets = []
|
||||
|
||||
|
||||
func _ready() -> void:
|
||||
super._ready()
|
||||
target_max = floori(stats.get_attribute("Target Limit"))
|
||||
|
||||
|
||||
func _physics_process(_delta: float) -> void:
|
||||
if !is_multiplayer_authority():
|
||||
#only doing the graphical sort of stuff but not shoot logic
|
||||
if targeted_enemy and is_instance_valid(targeted_enemy):
|
||||
if !targeted_enemy.alive or global_position.distance_to(targeted_enemy.global_position) > target_range:
|
||||
targeted_enemy = null
|
||||
else:
|
||||
aim()
|
||||
return
|
||||
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) or !target.alive:
|
||||
targets.erase(target)
|
||||
continue
|
||||
if global_position.distance_to(target.global_position) > target_range:
|
||||
targets.erase(target)
|
||||
if targets.size() > 0:
|
||||
targeted_enemy = targets[0]
|
||||
networked_acquire_target.rpc(get_tree().root.get_path_to(targeted_enemy))
|
||||
aim()
|
||||
if time_since_firing >= time_between_shots:
|
||||
time_since_firing -= time_between_shots
|
||||
shoot()
|
||||
|
||||
|
||||
func acquire_target():
|
||||
var possible_enemies = []
|
||||
for enemy in get_tree().get_nodes_in_group("Enemies"):
|
||||
if global_position.distance_to(enemy.global_position) > target_range:
|
||||
continue
|
||||
if !(enemy.stats.target_type & stats.target_type):
|
||||
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)
|
||||
|
||||
|
||||
func shoot():
|
||||
for target in targets:
|
||||
networked_spawn_rocket.rpc(get_tree().root.get_path_to(target), multiplayer.get_unique_id())
|
||||
|
||||
|
||||
@rpc("reliable", "call_local")
|
||||
func networked_spawn_rocket(target_node_path, peer_id):
|
||||
var target = get_tree().root.get_node(target_node_path)
|
||||
var projectile = projectile_scene.instantiate() as RocketProjectile
|
||||
projectile.position = global_position + Vector3.UP
|
||||
projectile.damage = damage
|
||||
projectile.target = target
|
||||
projectile.name = base_name + str(peer_id) + str(projectile_id)
|
||||
get_tree().root.add_child(projectile)
|
||||
projectile.apply_central_impulse(Vector3.UP * 3.0)
|
||||
projectile_id += 1
|
@@ -1,43 +1,9 @@
|
||||
[gd_scene load_steps=5 format=3 uid="uid://br3bd1jmi235x"]
|
||||
[gd_scene load_steps=4 format=3 uid="uid://b3q0f6w30nwsh"]
|
||||
|
||||
[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"]
|
||||
[ext_resource type="PackedScene" uid="uid://t0b32qb8eub2" path="res://Scenes/Towers/projectile_tower.tscn" id="1_su4lx"]
|
||||
[ext_resource type="Script" path="res://PCs/Universal/ClassCards/RocketLauncher/tower_rocket_launcher.gd" id="2_33124"]
|
||||
[ext_resource type="PackedScene" uid="uid://p2vwo8ivben6" path="res://PCs/Universal/ClassCards/RocketLauncher/rocket_projectile.tscn" id="3_8kvhb"]
|
||||
|
||||
[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_fouf8"]
|
||||
transparency = 1
|
||||
cull_mode = 2
|
||||
shading_mode = 0
|
||||
albedo_color = Color(0.686275, 0, 0, 0.278431)
|
||||
|
||||
[node name="Node3D" type="Node3D" node_paths=PackedStringArray("model", "range_sphere", "minimap_range_sphere")]
|
||||
script = ExtResource("1_8hb2v")
|
||||
rocket_scene = ExtResource("2_by0gu")
|
||||
stats = ExtResource("3_ynh7l")
|
||||
model = NodePath("Model")
|
||||
range_sphere = NodePath("Model/CSGSphere3D")
|
||||
minimap_range_sphere = NodePath("Model/CSGSphere3D2")
|
||||
|
||||
[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)
|
||||
|
||||
[node name="CSGSphere3D" type="CSGSphere3D" parent="Model"]
|
||||
visible = false
|
||||
radius = 7.5
|
||||
material = SubResource("StandardMaterial3D_fouf8")
|
||||
|
||||
[node name="CSGSphere3D2" type="CSGSphere3D" parent="Model"]
|
||||
visible = false
|
||||
layers = 4
|
||||
radius = 7.5
|
||||
material = SubResource("StandardMaterial3D_fouf8")
|
||||
[node name="RocketLauncherTower" instance=ExtResource("1_su4lx")]
|
||||
script = ExtResource("2_33124")
|
||||
projectile_scene = ExtResource("3_8kvhb")
|
||||
|
30
PCs/Universal/ClassCards/RocketLauncher/tower_stats.tres
Normal file
30
PCs/Universal/ClassCards/RocketLauncher/tower_stats.tres
Normal file
@@ -0,0 +1,30 @@
|
||||
[gd_resource type="Resource" script_class="CardText" load_steps=7 format=3 uid="uid://c65rq455ma8f6"]
|
||||
|
||||
[ext_resource type="Script" path="res://Scripts/Resources/stat_attribute.gd" id="1_3kswp"]
|
||||
[ext_resource type="Script" path="res://Scripts/Resources/card_text.gd" id="1_k606l"]
|
||||
|
||||
[sub_resource type="Resource" id="Resource_4fjm2"]
|
||||
script = ExtResource("1_3kswp")
|
||||
key = "Fire Delay"
|
||||
value = 5.0
|
||||
|
||||
[sub_resource type="Resource" id="Resource_uwj4j"]
|
||||
script = ExtResource("1_3kswp")
|
||||
key = "Target Limit"
|
||||
value = 3.0
|
||||
|
||||
[sub_resource type="Resource" id="Resource_6qv5v"]
|
||||
script = ExtResource("1_3kswp")
|
||||
key = "Damage"
|
||||
value = 8.0
|
||||
|
||||
[sub_resource type="Resource" id="Resource_y1rtq"]
|
||||
script = ExtResource("1_3kswp")
|
||||
key = "Range"
|
||||
value = 20.0
|
||||
|
||||
[resource]
|
||||
script = ExtResource("1_k606l")
|
||||
target_type = 2
|
||||
attributes = Array[ExtResource("1_3kswp")]([SubResource("Resource_4fjm2"), SubResource("Resource_uwj4j"), SubResource("Resource_6qv5v"), SubResource("Resource_y1rtq")])
|
||||
text = "Every /Fire Delay\\s, fires a homing rocket at up to /Target Limit\\ flying enemies up to /Range\\m away that deal /Damage\\ damage"
|
@@ -0,0 +1,76 @@
|
||||
extends ProjectileWeapon
|
||||
class_name RocketLauncherWeapon
|
||||
|
||||
@export var target_icon_scene : PackedScene
|
||||
@export var targeting_raycast : RayCast3D
|
||||
@export var targeting_ui_rect : TextureRect
|
||||
var target_max := 3
|
||||
var targets = []
|
||||
var target_icons = []
|
||||
|
||||
|
||||
func _ready() -> void:
|
||||
super._ready()
|
||||
targeting_raycast.global_position = hero.camera.global_position
|
||||
|
||||
target_max = floori(stats.get_attribute("Target Limit"))
|
||||
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 time_since_firing < time_between_shots:
|
||||
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].sprite.global_position
|
||||
target_icons[x].set_visible(true)
|
||||
else:
|
||||
target_icons[x].set_visible(false)
|
||||
targeting_ui_rect.set_visible(true)
|
||||
targeting_ui_rect.texture.region = Rect2(128 * targets.size(), 0, 128, 128)
|
||||
if targets.size() < target_max and targeting_raycast.is_colliding() and !targets.has(targeting_raycast.get_collider()):
|
||||
targets.append(targeting_raycast.get_collider())
|
||||
|
||||
|
||||
func release_trigger():
|
||||
super.release_trigger()
|
||||
if targets.size() > 0 and time_since_firing >= time_between_shots:
|
||||
time_since_firing -= time_between_shots
|
||||
shoot()
|
||||
|
||||
|
||||
func shoot():
|
||||
animator.play("shoot")
|
||||
for target in targets:
|
||||
networked_spawn_rocket.rpc(get_tree().root.get_path_to(target), multiplayer.get_unique_id())
|
||||
targets.clear()
|
||||
targeting_ui_rect.set_visible(false)
|
||||
for icon in target_icons:
|
||||
icon.set_visible(false)
|
||||
|
||||
|
||||
@rpc("reliable", "call_local")
|
||||
func networked_spawn_rocket(target_node_path, peer_id):
|
||||
var target = get_tree().root.get_node(target_node_path)
|
||||
var projectile = projectile_scene.instantiate() as RocketProjectile
|
||||
projectile.position = global_position
|
||||
projectile.damage = damage
|
||||
projectile.target = target
|
||||
projectile.name = str(peer_id) + str(projectile_id)
|
||||
get_tree().root.add_child(projectile)
|
||||
projectile.apply_central_impulse(Vector3.UP * 3.0)
|
||||
projectile_id += 1
|
||||
|
||||
|
||||
func _physics_process(_delta: float) -> void:
|
||||
pass
|
@@ -1,70 +1,37 @@
|
||||
[gd_scene load_steps=10 format=3 uid="uid://cbmoi73hquaer"]
|
||||
[gd_scene load_steps=10 format=3 uid="uid://bdp7icdejayvr"]
|
||||
|
||||
[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"]
|
||||
[ext_resource type="PackedScene" uid="uid://bqdllitxbbpyp" path="res://Scenes/Weapons/projectile_weapon.tscn" id="1_gxaua"]
|
||||
[ext_resource type="Script" path="res://PCs/Universal/ClassCards/RocketLauncher/weapon_rocket_launcher.gd" id="2_8x1tf"]
|
||||
[ext_resource type="PackedScene" uid="uid://p2vwo8ivben6" path="res://PCs/Universal/ClassCards/RocketLauncher/rocket_projectile.tscn" id="2_lfuvh"]
|
||||
[ext_resource type="PackedScene" uid="uid://csufsbi64asau" path="res://PCs/Universal/ClassCards/RocketLauncher/target_icon.tscn" id="3_2x5va"]
|
||||
[ext_resource type="Resource" uid="uid://d2yo07m2mp2mp" path="res://PCs/Universal/ClassCards/RocketLauncher/weapon_stats.tres" id="3_i1hxj"]
|
||||
[ext_resource type="Texture2D" uid="uid://by1y15lm0bppe" path="res://PCs/Universal/ClassCards/RocketLauncher/rocket_launcher.png" id="4_iygkf"]
|
||||
[ext_resource type="Texture2D" uid="uid://cc2umukpibmx1" path="res://PCs/Universal/ClassCards/RocketLauncher/target_list.png" id="6_jlv88"]
|
||||
|
||||
[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="AtlasTexture" id="AtlasTexture_f4p4w"]
|
||||
atlas = ExtResource("4_iygkf")
|
||||
region = 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="AtlasTexture" id="AtlasTexture_ewxon"]
|
||||
atlas = ExtResource("6_jlv88")
|
||||
region = Rect2(0, 0, 128, 128)
|
||||
|
||||
[sub_resource type="AnimationLibrary" id="AnimationLibrary_ntl6p"]
|
||||
_data = {
|
||||
"RESET": SubResource("Animation_n8b32"),
|
||||
"shoot": SubResource("Animation_g0h8q")
|
||||
}
|
||||
[node name="RocketLauncher" node_paths=PackedStringArray("targeting_raycast", "targeting_ui_rect") instance=ExtResource("1_gxaua")]
|
||||
script = ExtResource("2_8x1tf")
|
||||
target_icon_scene = ExtResource("3_2x5va")
|
||||
targeting_raycast = NodePath("RayCast3D")
|
||||
targeting_ui_rect = NodePath("TextureRect")
|
||||
projectile_scene = ExtResource("2_lfuvh")
|
||||
stats = ExtResource("3_i1hxj")
|
||||
|
||||
[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="Sprite3D" parent="." index="0"]
|
||||
texture = SubResource("AtlasTexture_f4p4w")
|
||||
|
||||
[node name="AnimationPlayer" type="AnimationPlayer" parent="."]
|
||||
libraries = {
|
||||
"": SubResource("AnimationLibrary_ntl6p")
|
||||
}
|
||||
|
||||
[node name="RayCast3D" type="RayCast3D" parent="."]
|
||||
[node name="RayCast3D" type="RayCast3D" parent="." index="2"]
|
||||
target_position = Vector3(0, 0, -100)
|
||||
collision_mask = 4
|
||||
|
||||
[node name="TextureRect" type="TextureRect" parent="."]
|
||||
visible = false
|
||||
texture_filter = 1
|
||||
[node name="TextureRect" type="TextureRect" parent="." index="3"]
|
||||
anchors_preset = 8
|
||||
anchor_left = 0.5
|
||||
anchor_top = 0.5
|
||||
@@ -76,4 +43,4 @@ offset_right = 20.0
|
||||
offset_bottom = 20.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
texture = ExtResource("5_nbrvn")
|
||||
texture = SubResource("AtlasTexture_ewxon")
|
||||
|
25
PCs/Universal/ClassCards/RocketLauncher/weapon_stats.tres
Normal file
25
PCs/Universal/ClassCards/RocketLauncher/weapon_stats.tres
Normal file
@@ -0,0 +1,25 @@
|
||||
[gd_resource type="Resource" script_class="CardText" load_steps=6 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/card_text.gd" id="2_0trth"]
|
||||
|
||||
[sub_resource type="Resource" id="Resource_4fjm2"]
|
||||
script = ExtResource("1_1le4i")
|
||||
key = "Fire Delay"
|
||||
value = 2.0
|
||||
|
||||
[sub_resource type="Resource" id="Resource_uwj4j"]
|
||||
script = ExtResource("1_1le4i")
|
||||
key = "Target Limit"
|
||||
value = 3.0
|
||||
|
||||
[sub_resource type="Resource" id="Resource_6qv5v"]
|
||||
script = ExtResource("1_1le4i")
|
||||
key = "Damage"
|
||||
value = 8.0
|
||||
|
||||
[resource]
|
||||
script = ExtResource("2_0trth")
|
||||
target_type = 0
|
||||
attributes = Array[ExtResource("1_1le4i")]([SubResource("Resource_4fjm2"), SubResource("Resource_uwj4j"), SubResource("Resource_6qv5v")])
|
||||
text = "Every /Fire Delay\\s, hold to target up to /Target Limit\\ enemies and release to fire homing rockets that deal /Damage\\ damage"
|
Reference in New Issue
Block a user