fixed some bugs The Typening caused

This commit is contained in:
Lexi Quinn 2024-03-23 22:36:19 +11:00
parent a93660f755
commit 3c28999cd9
29 changed files with 51 additions and 116 deletions

View File

@ -1,7 +1,7 @@
class_name RocketLauncherTower extends ProjectileTower
var target_max: float = 3
var targets: Array = []
var targets: Array[EnemyController] = []
func _ready() -> void:
@ -21,13 +21,11 @@ func _physics_process(_delta: float) -> void:
if targets.size() < target_max:
acquire_target()
if targets.size() > 0:
var target_list: Array[EnemyController] = targets.duplicate()
for target: EnemyController 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)
var valid_targets: Array[EnemyController] = []
for target: EnemyController in targets:
if is_instance_valid(target) and target.alive and global_position.distance_to(target.global_position) < target_range:
valid_targets.append(target)
targets = valid_targets
if targets.size() > 0:
targeted_enemy = targets[0]
networked_acquire_target.rpc(get_tree().root.get_path_to(targeted_enemy))
@ -40,6 +38,8 @@ func _physics_process(_delta: float) -> void:
func acquire_target() -> void:
var possible_enemies: Array[EnemyController] = []
for enemy: EnemyController in get_tree().get_nodes_in_group("Enemies"):
if !is_instance_valid(enemy):
continue
if global_position.distance_to(enemy.global_position) > target_range:
continue
if !(enemy.stats.target_type & stats.target_type):

View File

@ -4,7 +4,7 @@
[ext_resource type="Resource" uid="uid://b5pc3frhx467q" path="res://PCs/Mechanic/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://buvgdem68wtev" path="res://Scenes/Menus/PauseMenu/pause_menu.tscn" id="3_avnsx"]
[ext_resource type="Script" path="res://PCs/view_movement.gd" id="4_mhexa"]
[ext_resource type="PackedScene" uid="uid://dixtx38u4jhd7" path="res://Scenes/UI/card_hand.tscn" id="4_mwtvp"]
[ext_resource type="PackedScene" uid="uid://dqt1ggtkpkuhs" path="res://Scenes/gauntlet.tscn" id="5_jlxb3"]

View File

@ -39,10 +39,10 @@ func _ready() -> void:
pitch_noise.frequency = 0.03
yaw_noise.frequency = 0.03
roll_noise.frequency = 0.01
var seed: int = randi()
pitch_noise.seed = seed
yaw_noise.seed = seed + 1
roll_noise.seed = seed + 2
var noise_seed: int = randi()
pitch_noise.seed = noise_seed
yaw_noise.seed = noise_seed + 1
roll_noise.seed = noise_seed + 2
func _physics_process(delta: float) -> void:
@ -50,7 +50,6 @@ func _physics_process(delta: float) -> void:
#TODO: maybe make the speed slower/faster on slopes?
var player_speed: float = Vector2(player.velocity.x, player.velocity.z).length()
speed_factor = lerp(speed_factor, player_speed / head_bob_max_effect_speed, 20.0 * delta)
var test: float = 1.0 / 12.5
sample_point += delta * head_bob_frequency * speed_factor
else:
speed_factor = lerp(speed_factor, 0.0, 20.0 * delta)

View File

@ -10,7 +10,7 @@ func _ready() -> void:
for hero: HeroClass in Data.characters:
var card: Control = hero_card_scene.instantiate()
card.set_hero(hero)
card.pressed.connect(func(x: int) -> void: hero_selected.emit(Data.characters.find(x)))
card.pressed.connect(func(x: int) -> void: hero_selected.emit(x))
card.button_mouse_entered.connect(_on_button_mouse_entered)
hbox.add_child(card)

View File

@ -1,6 +1,6 @@
[gd_scene load_steps=5 format=3 uid="uid://dqqitmhu66a7d"]
[ext_resource type="Script" path="res://charselect.gd" id="1_h2h26"]
[ext_resource type="Script" path="res://Scenes/Menus/CharacterSelect/charselect.gd" id="1_h2h26"]
[ext_resource type="PackedScene" uid="uid://bnsf2degj5tio" path="res://Scenes/UI/hero_card.tscn" id="1_v2mfo"]
[ext_resource type="AudioStream" uid="uid://dknygn5eyuhxt" path="res://shot1.wav" id="3_o88ca"]

View File

@ -1,7 +1,7 @@
[gd_scene load_steps=8 format=3 uid="uid://8yv7excojcg0"]
[ext_resource type="Theme" uid="uid://b6a0ip4p72tgx" path="res://new_theme.tres" id="1_p1cib"]
[ext_resource type="Script" path="res://Scripts/main_menu.gd" id="2_ivytu"]
[ext_resource type="Script" path="res://Scenes/Menus/MainMenu/main_menu.gd" id="2_ivytu"]
[ext_resource type="Texture2D" uid="uid://lvvnrb5jugum" path="res://Assets/Textures/logo_title.png" id="3_8jkeb"]
[ext_resource type="PackedScene" uid="uid://y1qa1g3ic8sp" path="res://Worlds/GreenPlanet/Levels/first_level.tscn" id="3_l8r4a"]
[ext_resource type="AudioStream" uid="uid://dknygn5eyuhxt" path="res://shot1.wav" id="5_4c4cl"]

View File

@ -1,7 +1,7 @@
[gd_scene load_steps=5 format=3 uid="uid://buvgdem68wtev"]
[ext_resource type="Theme" uid="uid://b6a0ip4p72tgx" path="res://new_theme.tres" id="1_gaupv"]
[ext_resource type="Script" path="res://Scripts/pause_menu.gd" id="2_4pn2l"]
[ext_resource type="Script" path="res://Scenes/Menus/PauseMenu/pause_menu.gd" id="2_4pn2l"]
[ext_resource type="AudioStream" uid="uid://dknygn5eyuhxt" path="res://shot1.wav" id="3_q3xhn"]
[sub_resource type="AudioStreamRandomizer" id="AudioStreamRandomizer_n6ixr"]

View File

@ -4,7 +4,7 @@
[ext_resource type="Script" path="res://Scripts/multiplayer_lobby.gd" id="2_nb860"]
[ext_resource type="PackedScene" uid="uid://dpt3kpixawyby" path="res://Scenes/UI/scoreboard.tscn" id="3_f6bia"]
[ext_resource type="PackedScene" uid="uid://bvfit0sy2tnw4" path="res://Scenes/Menus/server_form.tscn" id="5_bqbwv"]
[ext_resource type="PackedScene" uid="uid://dqqitmhu66a7d" path="res://charselect.tscn" id="5_lvoo2"]
[ext_resource type="PackedScene" uid="uid://dqqitmhu66a7d" path="res://Scenes/Menus/CharacterSelect/charselect.tscn" id="5_lvoo2"]
[ext_resource type="PackedScene" uid="uid://ddmg342ff2qaq" path="res://Scenes/UI/chatbox.tscn" id="6_wtqwd"]
[ext_resource type="AudioStream" uid="uid://dknygn5eyuhxt" path="res://shot1.wav" id="7_npnbo"]

View File

@ -4,7 +4,7 @@
[ext_resource type="PackedScene" uid="uid://dpt3kpixawyby" path="res://Scenes/UI/scoreboard.tscn" id="1_423py"]
[ext_resource type="Script" path="res://Scripts/singleplayer_lobby.gd" id="1_nd17k"]
[ext_resource type="PackedScene" uid="uid://ddmg342ff2qaq" path="res://Scenes/UI/chatbox.tscn" id="3_l8xy3"]
[ext_resource type="PackedScene" uid="uid://dqqitmhu66a7d" path="res://charselect.tscn" id="5_vg5y0"]
[ext_resource type="PackedScene" uid="uid://dqqitmhu66a7d" path="res://Scenes/Menus/CharacterSelect/charselect.tscn" id="5_vg5y0"]
[ext_resource type="AudioStream" uid="uid://dknygn5eyuhxt" path="res://shot1.wav" id="6_qgq1v"]
[sub_resource type="AudioStreamRandomizer" id="AudioStreamRandomizer_g5har"]

View File

@ -4,12 +4,12 @@ importer="scene"
importer_version=1
type="PackedScene"
uid="uid://dx0ixlcxcxpcg"
path="res://.godot/imported/funbox.glb-d1e31206a7865f3af16dc0128c2d024a.scn"
path="res://.godot/imported/funbox.glb-0d98cfb9abd4d8ea0cefa019611e5edf.scn"
[deps]
source_file="res://funbox.glb"
dest_files=["res://.godot/imported/funbox.glb-d1e31206a7865f3af16dc0128c2d024a.scn"]
source_file="res://Scenes/TowerBase/funbox.glb"
dest_files=["res://.godot/imported/funbox.glb-0d98cfb9abd4d8ea0cefa019611e5edf.scn"]
[params]

View File

Before

Width:  |  Height:  |  Size: 3.1 KiB

After

Width:  |  Height:  |  Size: 3.1 KiB

View File

@ -3,15 +3,15 @@
importer="texture"
type="CompressedTexture2D"
uid="uid://bmor4v4j7krgh"
path="res://.godot/imported/funboxtex.png-08d477b8edff9115126116319e7f210a.ctex"
path="res://.godot/imported/funboxtex.png-cacd48052e8a0cbba5138ea8a2d1200c.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://funboxtex.png"
dest_files=["res://.godot/imported/funboxtex.png-08d477b8edff9115126116319e7f210a.ctex"]
source_file="res://Scenes/TowerBase/funboxtex.png"
dest_files=["res://.godot/imported/funboxtex.png-cacd48052e8a0cbba5138ea8a2d1200c.ctex"]
[params]

Binary file not shown.

View File

@ -1,9 +1,9 @@
[gd_scene load_steps=10 format=3 uid="uid://ddbbwx0yy16lh"]
[ext_resource type="Script" path="res://Scripts/tower_base.gd" id="1_tghvd"]
[ext_resource type="Script" path="res://Scripts/inventory.gd" id="2_p5c7g"]
[ext_resource type="Texture2D" uid="uid://ba85u6i558x4w" path="res://Assets/Textures/minimap_node.png" id="3_01hk3"]
[ext_resource type="ArrayMesh" uid="uid://cr83c74ys8rll" path="res://textmesh.res" id="4_hosgw"]
[ext_resource type="Script" path="res://Scripts/tower_base.gd" id="1_kalmg"]
[ext_resource type="Script" path="res://Scripts/inventory.gd" id="2_m0oxx"]
[ext_resource type="ArrayMesh" uid="uid://cr83c74ys8rll" path="res://Scenes/TowerBase/textmesh.res" id="3_ly30x"]
[ext_resource type="Texture2D" uid="uid://ba85u6i558x4w" path="res://Assets/Textures/minimap_node.png" id="4_lbvtm"]
[sub_resource type="BoxShape3D" id="BoxShape3D_lc72v"]
size = Vector3(1.1, 1.1, 1.1)
@ -22,7 +22,7 @@ albedo_color = Color(0.462745, 0.439216, 0.415686, 1)
[node name="Node3D" type="StaticBody3D" node_paths=PackedStringArray("inventory", "block", "collider", "minimap_icon", "north_icon", "south_icon", "east_icon", "west_icon", "north_mesh", "south_mesh", "east_mesh", "west_mesh", "north_collider", "south_collider", "east_collider", "west_collider")]
collision_layer = 17
script = ExtResource("1_tghvd")
script = ExtResource("1_kalmg")
inventory = NodePath("Inventory")
block = NodePath("MeshInstance3D")
collider = NodePath("CollisionShape3D")
@ -41,7 +41,7 @@ east_collider = NodePath("CollisionShape3D5")
west_collider = NodePath("CollisionShape3D4")
[node name="Inventory" type="Node" parent="."]
script = ExtResource("2_p5c7g")
script = ExtResource("2_m0oxx")
max_size = 1
[node name="CollisionShape3D" type="CollisionShape3D" parent="."]
@ -50,14 +50,14 @@ shape = SubResource("BoxShape3D_lc72v")
[node name="MeshInstance3D" type="MeshInstance3D" parent="."]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.55, 0)
mesh = ExtResource("4_hosgw")
mesh = ExtResource("3_ly30x")
[node name="MinimapIcon" type="Sprite3D" parent="."]
transform = Transform3D(3.5, 0, 0, 0, -1.5299e-07, 3.5, 0, -3.5, -1.5299e-07, 0, 1.5, 0)
layers = 4
modulate = Color(0, 1, 0, 1)
texture_filter = 0
texture = ExtResource("3_01hk3")
texture = ExtResource("4_lbvtm")
[node name="North" type="CSGBox3D" parent="."]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.5, 0.45, 0)
@ -70,7 +70,7 @@ transform = Transform3D(3.5, 0, 0, 0, -6.7097e-08, 3.5, 0, -1.535, -1.5299e-07,
layers = 4
modulate = Color(0, 1, 0, 1)
texture_filter = 0
texture = ExtResource("3_01hk3")
texture = ExtResource("4_lbvtm")
[node name="CollisionShape3D2" type="CollisionShape3D" parent="."]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.5, 0.55, 0)
@ -89,7 +89,7 @@ transform = Transform3D(3.5, 0, 0, 0, -6.7097e-08, 3.5, 0, -1.535, -1.5299e-07,
layers = 4
modulate = Color(0, 1, 0, 1)
texture_filter = 0
texture = ExtResource("3_01hk3")
texture = ExtResource("4_lbvtm")
[node name="CollisionShape3D3" type="CollisionShape3D" parent="."]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.5, 0.55, 0)
@ -108,7 +108,7 @@ transform = Transform3D(1.535, 0, 0, 0, -1.5299e-07, 3.5, 0, -3.5, -1.5299e-07,
layers = 4
modulate = Color(0, 1, 0, 1)
texture_filter = 0
texture = ExtResource("3_01hk3")
texture = ExtResource("4_lbvtm")
[node name="CollisionShape3D5" type="CollisionShape3D" parent="."]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.55, -0.5)
@ -127,7 +127,7 @@ transform = Transform3D(1.535, 0, 0, 0, -1.5299e-07, 3.5, 0, -3.5, -1.5299e-07,
layers = 4
modulate = Color(0, 1, 0, 1)
texture_filter = 0
texture = ExtResource("3_01hk3")
texture = ExtResource("4_lbvtm")
[node name="CollisionShape3D4" type="CollisionShape3D" parent="."]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.55, 0.5)

View File

@ -1,7 +1,7 @@
[gd_scene load_steps=5 format=3 uid="uid://dqt1ggtkpkuhs"]
[ext_resource type="Script" path="res://Scripts/edit_tool.gd" id="1_yf8lt"]
[ext_resource type="PackedScene" uid="uid://ddbbwx0yy16lh" path="res://Scenes/tower_base.tscn" id="2_r3632"]
[ext_resource type="PackedScene" uid="uid://ddbbwx0yy16lh" path="res://Scenes/TowerBase/tower_base.tscn" id="2_r3632"]
[ext_resource type="Texture2D" uid="uid://gh4yvnerf1f5" path="res://Assets/Textures/radial.png" id="3_a323w"]
[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_36ot1"]

View File

@ -11,7 +11,7 @@ var astar: AStar3D = AStar3D.new()
@export var spawner: EnemySpawner
@export var visualized_path: VisualizedPath
@export var tower_path: Node
var tower_base_scene: PackedScene = load("res://Scenes/tower_base.tscn")
var tower_base_scene: PackedScene = load("res://Scenes/TowerBase/tower_base.tscn")
var tower_frame_scene: PackedScene = load("res://Scenes/tower_frame.tscn")
var tower_bases: Array = []
var tower_base_ids: Dictionary = {}

View File

@ -7,7 +7,7 @@ var max_speed: float = 13.0
func _physics_process(_delta: float) -> void:
if is_instance_valid(target):
direction = global_position.direction_to(target.sprite.global_position)
direction = global_position.direction_to(target.global_position)
#apply_central_force(direction * acceleration)

View File

@ -10,7 +10,7 @@ signal won_game
var level_scene: PackedScene = load("res://Worlds/GreenPlanet/Levels/first_level.tscn")
var player_scene: PackedScene = load("res://PCs/hero.tscn")
var main_menu_scene_path: String = "res://Scenes/Menus/main_menu.tscn"
var main_menu_scene_path: String = "res://Scenes/Menus/MainMenu/main_menu.tscn"
var multiplayer_lobby_scene_path: String = "res://Scenes/Menus/multiplayer_lobby.tscn"
var singleplayer_lobby_scene_path: String = "res://Scenes/Menus/singleplayer_lobby.tscn"
var won_game_scene: PackedScene = load("res://Scenes/Menus/won_game_screen.tscn")

File diff suppressed because one or more lines are too long

View File

@ -9,7 +9,7 @@
[ext_resource type="Resource" uid="uid://deer0awg4d18o" path="res://PCs/Mechanic/ClassCards/Assault/card_assault.tres" id="5_806m0"]
[ext_resource type="Resource" uid="uid://ckm88acryitl4" path="res://PCs/Mechanic/ClassCards/Sniper/card_sniper.tres" id="6_evvng"]
[ext_resource type="Resource" uid="uid://cvto66tp7rrst" path="res://PCs/Mechanic/ClassCards/Gatling/card_gatling.tres" id="8_k80ff"]
[ext_resource type="PackedScene" uid="uid://ddbbwx0yy16lh" path="res://Scenes/tower_base.tscn" id="9_imodf"]
[ext_resource type="PackedScene" uid="uid://ddbbwx0yy16lh" path="res://Scenes/TowerBase/tower_base.tscn" id="9_imodf"]
[ext_resource type="Resource" uid="uid://blgngx360vff1" path="res://PCs/Mechanic/ClassCards/BombLauncher/card_bomb_launcher.tres" id="10_g0syk"]
[ext_resource type="Resource" uid="uid://dg4pjt47q8xpw" path="res://PCs/Mechanic/ClassCards/Flamethrower/card_flamethrower.tres" id="11_d3sci"]
[ext_resource type="Resource" uid="uid://b37r54q84vqoi" path="res://PCs/Mechanic/ClassCards/RocketLauncher/card_rocket_launcher.tres" id="11_jk0fe"]

View File

@ -1,6 +1,6 @@
[gd_resource type="VisualShader" load_steps=17 format=3 uid="uid://dsi0ofa74tfc4"]
[ext_resource type="Texture2D" uid="uid://bmor4v4j7krgh" path="res://funboxtex.png" id="1_h83w8"]
[ext_resource type="Texture2D" uid="uid://bmor4v4j7krgh" path="res://Scenes/TowerBase/funboxtex.png" id="1_h83w8"]
[ext_resource type="Texture2D" uid="uid://c4ytjp05u7auv" path="res://noisetex.tres" id="2_pgkht"]
[sub_resource type="VisualShaderNodeTexture" id="VisualShaderNodeTexture_ugjxq"]

View File

@ -13,7 +13,7 @@ func set_hero(hero: HeroClass) -> void:
func _on_button_pressed() -> void:
pressed.emit(hero_class)
pressed.emit(Data.characters.find(hero_class))
func _on_button_mouse_entered() -> void:

View File

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

View File

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

View File

@ -11,7 +11,7 @@ config_version=5
[application]
config/name="Multiplayer Tower Defense"
run/main_scene="res://Scenes/Menus/main_menu.tscn"
run/main_scene="res://Scenes/Menus/MainMenu/main_menu.tscn"
config/features=PackedStringArray("4.2", "Forward Plus")
config/icon="res://Assets/Textures/icon.svg"

Binary file not shown.