Finally. Simplified. Clean. Organized.
This commit is contained in:
parent
3960d9c6c5
commit
af0aa7fd46
17 changed files with 85 additions and 361 deletions
Binary file not shown.
|
@ -1,16 +1,13 @@
|
|||
[gd_scene load_steps=17 format=3 uid="uid://sukfq8clv4s0"]
|
||||
[gd_scene load_steps=14 format=3 uid="uid://sukfq8clv4s0"]
|
||||
|
||||
[ext_resource type="Texture2D" uid="uid://xlfmu7wr8mhb" path="res://non-godot/Textures/Level01/Sky2.png" id="1_4a42c"]
|
||||
[ext_resource type="Texture2D" uid="uid://88sgqxmugeto" path="res://non-godot/Textures/Level01/Sky1.png" id="2_vchpd"]
|
||||
[ext_resource type="Texture2D" uid="uid://w527cw3q2qhm" path="res://non-godot/Textures/Level01/Sky3.png" id="3_2h5vj"]
|
||||
[ext_resource type="PackedScene" uid="uid://b6gjwbfujf38y" path="res://godot/Scenes/heads_up_display.tscn" id="4_fiy6t"]
|
||||
[ext_resource type="PackedScene" uid="uid://bjbccem28ir8r" path="res://godot/Scenes/player.tscn" id="5_dh16x"]
|
||||
[ext_resource type="PackedScene" uid="uid://dguvnd4wmo35j" path="res://godot/Scenes/enemy_waves.tscn" id="6_7y0em"]
|
||||
[ext_resource type="PackedScene" uid="uid://b8vxsep2lvw3a" path="res://godot/Scenes/Waves/begin.tscn" id="7_4tvsp"]
|
||||
[ext_resource type="PackedScene" uid="uid://dyqnmrhflct7u" path="res://godot/Scenes/Waves/Level 01/sample_behind.tscn" id="8_btphg"]
|
||||
[ext_resource type="PackedScene" uid="uid://bkm7p6iqiqm21" path="res://godot/Scenes/Waves/Level 01/sample.tscn" id="8_e6nsj"]
|
||||
[ext_resource type="PackedScene" uid="uid://baqm758lyy4o3" path="res://godot/Scenes/Waves/Level 01/sample_shooting.tscn" id="9_6t24y"]
|
||||
[ext_resource type="PackedScene" uid="uid://bd0ehge1veq56" path="res://godot/Scenes/Waves/end.tscn" id="9_btphg"]
|
||||
[ext_resource type="Texture2D" uid="uid://xlfmu7wr8mhb" path="res://non-godot/Textures/Level01/Sky2.png" id="1_wriy3"]
|
||||
[ext_resource type="Texture2D" uid="uid://88sgqxmugeto" path="res://non-godot/Textures/Level01/Sky1.png" id="2_4tvsp"]
|
||||
[ext_resource type="Texture2D" uid="uid://w527cw3q2qhm" path="res://non-godot/Textures/Level01/Sky3.png" id="3_e6nsj"]
|
||||
[ext_resource type="PackedScene" uid="uid://b6gjwbfujf38y" path="res://godot/Scenes/heads_up_display.tscn" id="4_btphg"]
|
||||
[ext_resource type="PackedScene" uid="uid://bjbccem28ir8r" path="res://godot/Scenes/player.tscn" id="5_6t24y"]
|
||||
[ext_resource type="PackedScene" uid="uid://bkm7p6iqiqm21" path="res://godot/Scenes/Waves/sample.tscn" id="6_lxu8r"]
|
||||
[ext_resource type="PackedScene" uid="uid://dyqnmrhflct7u" path="res://godot/Scenes/Waves/sample_behind.tscn" id="7_8amlk"]
|
||||
[ext_resource type="PackedScene" uid="uid://baqm758lyy4o3" path="res://godot/Scenes/Waves/sample_shooting.tscn" id="8_2w03r"]
|
||||
|
||||
[sub_resource type="Gradient" id="Gradient_ay0jx"]
|
||||
colors = PackedColorArray(0, 0.172549, 1, 1, 0, 0.623529, 1, 1)
|
||||
|
@ -78,7 +75,7 @@ texture = SubResource("GradientTexture2D_1gw3d")
|
|||
[node name="SlowestClouds" type="GPUParticles2D" parent="Background"]
|
||||
position = Vector2(1800, 360)
|
||||
amount = 40
|
||||
texture = ExtResource("1_4a42c")
|
||||
texture = ExtResource("1_wriy3")
|
||||
lifetime = 480.0
|
||||
preprocess = 120.0
|
||||
visibility_rect = Rect2(-2000, -2000, 4000, 4000)
|
||||
|
@ -87,7 +84,7 @@ process_material = SubResource("ParticleProcessMaterial_ctueq")
|
|||
[node name="SlowClouds" type="GPUParticles2D" parent="Background"]
|
||||
position = Vector2(1800, 360)
|
||||
amount = 20
|
||||
texture = ExtResource("2_vchpd")
|
||||
texture = ExtResource("2_4tvsp")
|
||||
lifetime = 120.0
|
||||
preprocess = 40.0
|
||||
visibility_rect = Rect2(-2000, -2000, 4000, 4000)
|
||||
|
@ -96,24 +93,23 @@ process_material = SubResource("ParticleProcessMaterial_dvhti")
|
|||
[node name="FastClouds" type="GPUParticles2D" parent="Background"]
|
||||
position = Vector2(1800, 360)
|
||||
amount = 40
|
||||
texture = ExtResource("3_2h5vj")
|
||||
texture = ExtResource("3_e6nsj")
|
||||
lifetime = 40.0
|
||||
preprocess = 10.0
|
||||
visibility_rect = Rect2(-2000, -2000, 4000, 4000)
|
||||
process_material = SubResource("ParticleProcessMaterial_4312q")
|
||||
|
||||
[node name="HeadsUpDisplay" parent="." instance=ExtResource("4_fiy6t")]
|
||||
[node name="HeadsUpDisplay" parent="." instance=ExtResource("4_btphg")]
|
||||
|
||||
[node name="Player" parent="." instance=ExtResource("5_dh16x")]
|
||||
[node name="Player" parent="." instance=ExtResource("5_6t24y")]
|
||||
position = Vector2(157, 279)
|
||||
slide_on_ceiling = false
|
||||
|
||||
[node name="EnemyWaves" parent="." instance=ExtResource("6_7y0em")]
|
||||
WaveWaits = Array[float]([0.0, 3.0, 3.0])
|
||||
WaveScenes = Array[PackedScene]([ExtResource("8_e6nsj"), ExtResource("8_btphg"), ExtResource("9_6t24y")])
|
||||
BeginningFade = ExtResource("7_4tvsp")
|
||||
EndingFade = ExtResource("9_btphg")
|
||||
|
||||
[node name="WaveSystem" type="WaveSystem" parent="."]
|
||||
TimeTilWave = Array[float]([0.0])
|
||||
WaveScenes = Array[PackedScene]([null])
|
||||
TimeTilWave = Array[float]([0.0, 3.0, 3.0])
|
||||
WaveScenes = Array[PackedScene]([ExtResource("6_lxu8r"), ExtResource("7_8amlk"), ExtResource("8_2w03r")])
|
||||
FadeAtBeginning = true
|
||||
FadeAtEnd = true
|
||||
FadeTime = 3
|
||||
|
||||
[connection signal="WavesFinished" from="WaveSystem" to="HeadsUpDisplay" method="_on_wave_system_waves_finished"]
|
||||
|
|
|
@ -1,53 +0,0 @@
|
|||
[gd_scene load_steps=5 format=3 uid="uid://b8vxsep2lvw3a"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://bfw8gpwvaa5k1" path="res://godot/Scripts/beginning&end.gd" id="1_r5omd"]
|
||||
|
||||
[sub_resource type="Animation" id="Animation_hbbht"]
|
||||
length = 0.001
|
||||
tracks/0/type = "value"
|
||||
tracks/0/imported = false
|
||||
tracks/0/enabled = true
|
||||
tracks/0/path = NodePath("ColorRect:color")
|
||||
tracks/0/interp = 1
|
||||
tracks/0/loop_wrap = true
|
||||
tracks/0/keys = {
|
||||
"times": PackedFloat32Array(0),
|
||||
"transitions": PackedFloat32Array(1),
|
||||
"update": 0,
|
||||
"values": [Color(0, 0, 0, 1)]
|
||||
}
|
||||
|
||||
[sub_resource type="Animation" id="Animation_xpd8i"]
|
||||
resource_name = "anim"
|
||||
length = 3.0
|
||||
tracks/0/type = "value"
|
||||
tracks/0/imported = false
|
||||
tracks/0/enabled = true
|
||||
tracks/0/path = NodePath("ColorRect:color")
|
||||
tracks/0/interp = 1
|
||||
tracks/0/loop_wrap = true
|
||||
tracks/0/keys = {
|
||||
"times": PackedFloat32Array(0, 3),
|
||||
"transitions": PackedFloat32Array(1, 1),
|
||||
"update": 0,
|
||||
"values": [Color(0, 0, 0, 1), Color(0, 0, 0, 0)]
|
||||
}
|
||||
|
||||
[sub_resource type="AnimationLibrary" id="AnimationLibrary_gul8r"]
|
||||
_data = {
|
||||
"RESET": SubResource("Animation_hbbht"),
|
||||
"anim": SubResource("Animation_xpd8i")
|
||||
}
|
||||
|
||||
[node name="Begin" type="Node2D"]
|
||||
script = ExtResource("1_r5omd")
|
||||
|
||||
[node name="ColorRect" type="ColorRect" parent="."]
|
||||
offset_right = 1280.0
|
||||
offset_bottom = 720.0
|
||||
color = Color(0, 0, 0, 1)
|
||||
|
||||
[node name="AnimationPlayer" type="AnimationPlayer" parent="."]
|
||||
libraries = {
|
||||
"": SubResource("AnimationLibrary_gul8r")
|
||||
}
|
|
@ -1,67 +0,0 @@
|
|||
[gd_scene load_steps=5 format=3 uid="uid://bd0ehge1veq56"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://bfw8gpwvaa5k1" path="res://godot/Scripts/beginning&end.gd" id="1_neulq"]
|
||||
|
||||
[sub_resource type="Animation" id="Animation_wxjil"]
|
||||
length = 0.001
|
||||
tracks/0/type = "value"
|
||||
tracks/0/imported = false
|
||||
tracks/0/enabled = true
|
||||
tracks/0/path = NodePath("ColorRect:color")
|
||||
tracks/0/interp = 1
|
||||
tracks/0/loop_wrap = true
|
||||
tracks/0/keys = {
|
||||
"times": PackedFloat32Array(0),
|
||||
"transitions": PackedFloat32Array(1),
|
||||
"update": 0,
|
||||
"values": [Color(0, 0, 0, 0)]
|
||||
}
|
||||
|
||||
[sub_resource type="Animation" id="Animation_l8o88"]
|
||||
resource_name = "end"
|
||||
length = 3.0
|
||||
tracks/0/type = "method"
|
||||
tracks/0/imported = false
|
||||
tracks/0/enabled = true
|
||||
tracks/0/path = NodePath(".")
|
||||
tracks/0/interp = 1
|
||||
tracks/0/loop_wrap = true
|
||||
tracks/0/keys = {
|
||||
"times": PackedFloat32Array(2.99),
|
||||
"transitions": PackedFloat32Array(1),
|
||||
"values": [{
|
||||
"args": [],
|
||||
"method": &"NextLevel"
|
||||
}]
|
||||
}
|
||||
tracks/1/type = "value"
|
||||
tracks/1/imported = false
|
||||
tracks/1/enabled = true
|
||||
tracks/1/path = NodePath("ColorRect:color")
|
||||
tracks/1/interp = 1
|
||||
tracks/1/loop_wrap = true
|
||||
tracks/1/keys = {
|
||||
"times": PackedFloat32Array(0, 3),
|
||||
"transitions": PackedFloat32Array(1, 1),
|
||||
"update": 0,
|
||||
"values": [Color(0, 0, 0, 0), Color(0, 0, 0, 1)]
|
||||
}
|
||||
|
||||
[sub_resource type="AnimationLibrary" id="AnimationLibrary_q6a5y"]
|
||||
_data = {
|
||||
"RESET": SubResource("Animation_wxjil"),
|
||||
"anim": SubResource("Animation_l8o88")
|
||||
}
|
||||
|
||||
[node name="End" type="Node2D"]
|
||||
script = ExtResource("1_neulq")
|
||||
|
||||
[node name="ColorRect" type="ColorRect" parent="."]
|
||||
offset_right = 1280.0
|
||||
offset_bottom = 720.0
|
||||
color = Color(0, 0, 0, 0)
|
||||
|
||||
[node name="AnimationPlayer" type="AnimationPlayer" parent="."]
|
||||
libraries = {
|
||||
"": SubResource("AnimationLibrary_q6a5y")
|
||||
}
|
|
@ -1,6 +0,0 @@
|
|||
[gd_scene load_steps=2 format=3 uid="uid://dguvnd4wmo35j"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://bds2gfjat71g3" path="res://godot/Scripts/enemy_waves.gd" id="1_nghhd"]
|
||||
|
||||
[node name="EnemyWaves" type="Node2D"]
|
||||
script = ExtResource("1_nghhd")
|
|
@ -1,4 +1,4 @@
|
|||
[gd_scene load_steps=10 format=3 uid="uid://bjbccem28ir8r"]
|
||||
[gd_scene load_steps=6 format=3 uid="uid://bjbccem28ir8r"]
|
||||
|
||||
[ext_resource type="Texture2D" uid="uid://bcbjh2amre7ke" path="res://non-godot/Textures/Plane/PlaneUp.png" id="1_2h3i0"]
|
||||
[ext_resource type="Texture2D" uid="uid://d07qtvmhqjjts" path="res://non-godot/Textures/Bullet.png" id="1_ppa05"]
|
||||
|
@ -8,7 +8,7 @@
|
|||
[sub_resource type="ParticleProcessMaterial" id="ParticleProcessMaterial_xtmdc"]
|
||||
particle_flag_disable_z = true
|
||||
emission_shape = 3
|
||||
emission_box_extents = Vector3(0, 120, 1)
|
||||
emission_box_extents = Vector3(0, 16, 1)
|
||||
direction = Vector3(-1, 0, 0)
|
||||
spread = 0.0
|
||||
initial_velocity_min = 3000.0
|
||||
|
@ -17,136 +17,6 @@ gravity = Vector3(0, 0, 0)
|
|||
scale_max = 8.0
|
||||
color = Color(0.513233, 0.513233, 0.513233, 1)
|
||||
|
||||
[sub_resource type="Animation" id="Animation_bb0i0"]
|
||||
resource_name = "Death"
|
||||
length = 5.0
|
||||
step = 0.1
|
||||
tracks/0/type = "value"
|
||||
tracks/0/imported = false
|
||||
tracks/0/enabled = true
|
||||
tracks/0/path = NodePath("GPUParticles2D2:visible")
|
||||
tracks/0/interp = 1
|
||||
tracks/0/loop_wrap = true
|
||||
tracks/0/keys = {
|
||||
"times": PackedFloat32Array(3),
|
||||
"transitions": PackedFloat32Array(1),
|
||||
"update": 1,
|
||||
"values": [false]
|
||||
}
|
||||
tracks/1/type = "value"
|
||||
tracks/1/imported = false
|
||||
tracks/1/enabled = true
|
||||
tracks/1/path = NodePath("GPUParticles2D:visible")
|
||||
tracks/1/interp = 1
|
||||
tracks/1/loop_wrap = true
|
||||
tracks/1/keys = {
|
||||
"times": PackedFloat32Array(3),
|
||||
"transitions": PackedFloat32Array(1),
|
||||
"update": 1,
|
||||
"values": [false]
|
||||
}
|
||||
tracks/2/type = "value"
|
||||
tracks/2/imported = false
|
||||
tracks/2/enabled = true
|
||||
tracks/2/path = NodePath("ColorRect:color")
|
||||
tracks/2/interp = 1
|
||||
tracks/2/loop_wrap = true
|
||||
tracks/2/keys = {
|
||||
"times": PackedFloat32Array(3, 5),
|
||||
"transitions": PackedFloat32Array(1, 2),
|
||||
"update": 0,
|
||||
"values": [Color(0, 0, 0, 0), Color(0, 0, 0, 1)]
|
||||
}
|
||||
tracks/3/type = "method"
|
||||
tracks/3/imported = false
|
||||
tracks/3/enabled = true
|
||||
tracks/3/path = NodePath(".")
|
||||
tracks/3/interp = 1
|
||||
tracks/3/loop_wrap = true
|
||||
tracks/3/keys = {
|
||||
"times": PackedFloat32Array(4.99),
|
||||
"transitions": PackedFloat32Array(1),
|
||||
"values": [{
|
||||
"args": [],
|
||||
"method": &"GoToScene"
|
||||
}]
|
||||
}
|
||||
|
||||
[sub_resource type="Animation" id="Animation_vh54h"]
|
||||
resource_name = "Hit"
|
||||
length = 3.01
|
||||
step = 0.05
|
||||
tracks/0/type = "value"
|
||||
tracks/0/imported = false
|
||||
tracks/0/enabled = true
|
||||
tracks/0/path = NodePath(".:modulate")
|
||||
tracks/0/interp = 1
|
||||
tracks/0/loop_wrap = true
|
||||
tracks/0/keys = {
|
||||
"times": PackedFloat32Array(0, 0.25, 0.5, 0.75, 1, 1.25, 1.5, 1.75, 2, 2.25, 2.5, 2.75, 3),
|
||||
"transitions": PackedFloat32Array(1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1),
|
||||
"update": 0,
|
||||
"values": [Color(1, 1, 1, 1), Color(1, 1, 1, 0.392157), Color(1, 1, 1, 1), Color(1, 1, 1, 0.392157), Color(1, 1, 1, 1), Color(1, 1, 1, 0.392157), Color(1, 1, 1, 1), Color(1, 1, 1, 0.392157), Color(1, 1, 1, 1), Color(1, 1, 1, 0.392157), Color(1, 1, 1, 1), Color(1, 1, 1, 0.392157), Color(1, 1, 1, 1)]
|
||||
}
|
||||
|
||||
[sub_resource type="Animation" id="Animation_gbl2x"]
|
||||
length = 0.001
|
||||
tracks/0/type = "value"
|
||||
tracks/0/imported = false
|
||||
tracks/0/enabled = true
|
||||
tracks/0/path = NodePath("GPUParticles2D2:visible")
|
||||
tracks/0/interp = 1
|
||||
tracks/0/loop_wrap = true
|
||||
tracks/0/keys = {
|
||||
"times": PackedFloat32Array(0),
|
||||
"transitions": PackedFloat32Array(1),
|
||||
"update": 1,
|
||||
"values": [true]
|
||||
}
|
||||
tracks/1/type = "value"
|
||||
tracks/1/imported = false
|
||||
tracks/1/enabled = true
|
||||
tracks/1/path = NodePath("GPUParticles2D:visible")
|
||||
tracks/1/interp = 1
|
||||
tracks/1/loop_wrap = true
|
||||
tracks/1/keys = {
|
||||
"times": PackedFloat32Array(0),
|
||||
"transitions": PackedFloat32Array(1),
|
||||
"update": 1,
|
||||
"values": [true]
|
||||
}
|
||||
tracks/2/type = "value"
|
||||
tracks/2/imported = false
|
||||
tracks/2/enabled = true
|
||||
tracks/2/path = NodePath("ColorRect:color")
|
||||
tracks/2/interp = 1
|
||||
tracks/2/loop_wrap = true
|
||||
tracks/2/keys = {
|
||||
"times": PackedFloat32Array(0),
|
||||
"transitions": PackedFloat32Array(1),
|
||||
"update": 0,
|
||||
"values": [Color(0, 0, 0, 0)]
|
||||
}
|
||||
tracks/3/type = "value"
|
||||
tracks/3/imported = false
|
||||
tracks/3/enabled = true
|
||||
tracks/3/path = NodePath(".:modulate")
|
||||
tracks/3/interp = 1
|
||||
tracks/3/loop_wrap = true
|
||||
tracks/3/keys = {
|
||||
"times": PackedFloat32Array(0),
|
||||
"transitions": PackedFloat32Array(1),
|
||||
"update": 0,
|
||||
"values": [Color(1, 1, 1, 1)]
|
||||
}
|
||||
|
||||
[sub_resource type="AnimationLibrary" id="AnimationLibrary_vkafp"]
|
||||
_data = {
|
||||
&"Death": SubResource("Animation_bb0i0"),
|
||||
&"Hit": SubResource("Animation_vh54h"),
|
||||
&"RESET": SubResource("Animation_gbl2x")
|
||||
}
|
||||
|
||||
[node name="Player" type="Player" groups=["Player"]]
|
||||
ShotBulletLocation = Vector2(95, 45)
|
||||
ShotBulletTexture = ExtResource("1_ppa05")
|
||||
|
@ -163,27 +33,15 @@ motion_mode = 1
|
|||
|
||||
[node name="GPUParticles2D2" type="GPUParticles2D" parent="."]
|
||||
z_index = -1
|
||||
position = Vector2(-544, -153.33333)
|
||||
position = Vector2(-82, -21)
|
||||
amount = 500
|
||||
amount_ratio = 0.66
|
||||
lifetime = 5.0
|
||||
process_material = SubResource("ParticleProcessMaterial_xtmdc")
|
||||
|
||||
[node name="GPUParticles2D" type="GPUParticles2D" parent="."]
|
||||
position = Vector2(-640, -93.33333)
|
||||
position = Vector2(-95, -15)
|
||||
amount = 500
|
||||
amount_ratio = 0.66
|
||||
lifetime = 5.0
|
||||
process_material = SubResource("ParticleProcessMaterial_xtmdc")
|
||||
|
||||
[node name="AnimationPlayer" type="AnimationPlayer" parent="."]
|
||||
libraries = {
|
||||
&"": SubResource("AnimationLibrary_vkafp")
|
||||
}
|
||||
|
||||
[node name="ColorRect" type="ColorRect" parent="."]
|
||||
offset_left = -4963.0
|
||||
offset_top = -5294.0
|
||||
offset_right = 5037.0
|
||||
offset_bottom = 4706.0
|
||||
color = Color(0, 0, 0, 0)
|
||||
|
|
|
@ -1,11 +0,0 @@
|
|||
extends Node2D
|
||||
|
||||
@onready var Animator = get_node("AnimationPlayer")
|
||||
|
||||
func _ready():
|
||||
Animator.play("anim")
|
||||
|
||||
func NextLevel():
|
||||
Global.CurrentLevel += 1
|
||||
# take a look at the file and change it according to your naming scheme.
|
||||
get_tree().change_scene_to_file("res://Scenes/level_0" + var_to_str(Global.CurrentLevel) + ".tscn")
|
|
@ -1 +0,0 @@
|
|||
uid://bfw8gpwvaa5k1
|
|
@ -1,44 +0,0 @@
|
|||
extends Node2D
|
||||
|
||||
# Wave stuff.
|
||||
@export_category("Waves")
|
||||
@export var WaveWaits: Array[float]
|
||||
@export var WaveScenes: Array[PackedScene]
|
||||
var WaveTimer: float = 0
|
||||
var CurrentWave: int = 0
|
||||
# Start to make sure no other waves spawn when fading.
|
||||
var Start: bool = false
|
||||
|
||||
# Fading happens at the beginning and end of the level.
|
||||
@export_category("Fading")
|
||||
@export var BeginningFades: bool = true
|
||||
@export var BeginningFadeTime: float = 3
|
||||
@export var BeginningFade: PackedScene
|
||||
@export var EndingFades: bool = true
|
||||
@export var EndingFadeTime: float = 3
|
||||
@export var EndingFade: PackedScene
|
||||
|
||||
func _ready():
|
||||
# This addition here is to make sure that the fade completes.
|
||||
if WaveWaits.size() != WaveScenes.size():
|
||||
push_error("The WaveWaits and the WaveScenes don't line up! Are you missing something?")
|
||||
if BeginningFades == true:
|
||||
Spawn(BeginningFade)
|
||||
|
||||
func _process(delta: float):
|
||||
WaveTimer += delta
|
||||
if Start == false and WaveTimer >= BeginningFadeTime:
|
||||
Start = true
|
||||
WaveTimer = 0
|
||||
if CurrentWave != WaveScenes.size() and Start == true:
|
||||
if WaveTimer >= WaveWaits[CurrentWave]:
|
||||
Spawn(WaveScenes[CurrentWave])
|
||||
CurrentWave += 1
|
||||
if CurrentWave == WaveScenes.size() and WaveTimer >= EndingFadeTime:
|
||||
Spawn(EndingFade)
|
||||
|
||||
func Spawn(Wave: PackedScene):
|
||||
var thing = Wave.instantiate()
|
||||
self.add_child(thing)
|
||||
thing.transform = self.global_transform
|
||||
WaveTimer = 0
|
|
@ -1 +0,0 @@
|
|||
uid://bds2gfjat71g3
|
|
@ -1,4 +1,3 @@
|
|||
extends Node
|
||||
|
||||
var TotalScore: int = 0
|
||||
var CurrentLevel: int = 1
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
extends Control
|
||||
|
||||
|
||||
# change the hud if the player takes damage
|
||||
func _on_player_player_took_damage(Health: int):
|
||||
match Health:
|
||||
|
@ -13,3 +12,6 @@ func _on_player_player_took_damage(Health: int):
|
|||
|
||||
func _process(_delta: float):
|
||||
get_node("Container/Label").text = str(Global.TotalScore)
|
||||
|
||||
func _on_wave_system_waves_finished() -> void:
|
||||
print("We are done here.")
|
||||
|
|
|
@ -4,10 +4,21 @@
|
|||
#include <godot_cpp/core/property_info.hpp>
|
||||
#include <godot_cpp/core/memory.hpp>
|
||||
#include <godot_cpp/classes/engine.hpp>
|
||||
#include <godot_cpp/core/math.hpp>
|
||||
|
||||
#include <godot_cpp/classes/node.hpp>
|
||||
|
||||
namespace godot {
|
||||
WaveSystem::WaveSystem() {
|
||||
Fader = memnew(ColorRect);
|
||||
|
||||
Fader->set_offset(SIDE_LEFT, -10000);
|
||||
Fader->set_offset(SIDE_TOP, -10000);
|
||||
Fader->set_offset(SIDE_RIGHT, 10000);
|
||||
Fader->set_offset(SIDE_BOTTOM, 10000);
|
||||
Fader->set_color(Color(0, 0, 0, 0));
|
||||
|
||||
add_child(Fader);
|
||||
}
|
||||
|
||||
WaveSystem::~WaveSystem() {
|
||||
|
@ -22,19 +33,23 @@ namespace godot {
|
|||
ClassDB::bind_method(D_METHOD("GetWaveScenes"), &WaveSystem::GetWaveScenes);
|
||||
ClassDB::bind_method(D_METHOD("SetWaveScenes", "WaveScenes"), &WaveSystem::SetWaveScenes);
|
||||
ClassDB::add_property("WaveSystem", PropertyInfo(Variant::ARRAY, "WaveScenes", PROPERTY_HINT_RESOURCE_TYPE, "PackedScene"), "SetWaveScenes", "GetWaveScenes");
|
||||
|
||||
// Fades
|
||||
ClassDB::bind_method(D_METHOD("GetFadeAtBeginning"), &WaveSystem::GetFadeAtBeginning);
|
||||
ClassDB::bind_method(D_METHOD("SetFadeAtBeginning", "FadeAtBeginning"), &WaveSystem::SetFadeAtBeginning);
|
||||
ClassDB::add_property("WaveSystem", PropertyInfo(Variant::BOOL, "FadeAtBeginning"), "SetFadeAtBeginning", "GetFadeAtBeginning");
|
||||
ClassDB::bind_method(D_METHOD("GetFadeAtEnd"), &WaveSystem::GetFadeAtEnd);
|
||||
ClassDB::bind_method(D_METHOD("SetFadeAtEnd", "FadeAtEnd"), &WaveSystem::SetFadeAtEnd);
|
||||
ClassDB::add_property("WaveSystem", PropertyInfo(Variant::BOOL, "FadeAtEnd"), "SetFadeAtEnd", "GetFadeAtEnd");
|
||||
ClassDB::bind_method(D_METHOD("GetFadeTime"), &WaveSystem::GetFadeTime);
|
||||
ClassDB::bind_method(D_METHOD("SetFadeTime", "FadeTime"), &WaveSystem::SetFadeTime);
|
||||
ClassDB::add_property("WaveSystem", PropertyInfo(Variant::INT, "FadeTime"), "SetFadeTime", "GetFadeTime");
|
||||
|
||||
// Signals
|
||||
ClassDB::add_signal("WaveSystem", MethodInfo("WavesFinished"));
|
||||
}
|
||||
|
||||
void WaveSystem::_physics_process(double delta) {
|
||||
|
||||
// Anything before this means it plays in the editor.
|
||||
if (Engine::get_singleton()->is_editor_hint()) {
|
||||
return;
|
||||
|
@ -43,14 +58,39 @@ namespace godot {
|
|||
// Do some calculations first.
|
||||
if (Calculated == false) {
|
||||
if (FadeAtBeginning == true) {
|
||||
WaveTimer = WaveTimer - 3;
|
||||
WaveTimer = WaveTimer - FadeTime;
|
||||
}
|
||||
Calculated = true;
|
||||
}
|
||||
|
||||
WaveTimer = WaveTimer + delta;
|
||||
// TODO: Implement the waves system and then the finishing system
|
||||
emit_signal("WavesFinished");
|
||||
// If wavetimer is negative, it most likely means something is fading. So: fade.
|
||||
if (WaveTimer < 0) {
|
||||
Fader->set_color(Color(0, 0, 0, Math::abs(WaveTimer) / FadeTime));
|
||||
} else {
|
||||
Fader->set_color(Color(0, 0, 0, 0));
|
||||
}
|
||||
|
||||
// Don't crash.
|
||||
if (TimeTilWave.size() != CurrentWave) {
|
||||
WaveTimer = WaveTimer + delta;
|
||||
double funfun = TimeTilWave[CurrentWave]; // Kill yourself. Now.
|
||||
// When the timer is over the current wavie, turn it to the next wavie.
|
||||
if (WaveTimer >= funfun) {
|
||||
Node* child = Object::cast_to<PackedScene>(WaveScenes[CurrentWave])->instantiate();
|
||||
// Add, then move the child to get it to be hidden by fades.
|
||||
add_sibling(child);
|
||||
WaveTimer = 0;
|
||||
CurrentWave = CurrentWave + 1;
|
||||
}
|
||||
// End fade.
|
||||
} else if (FadeAtEnd == true && WaveTimer <= FadeTime) {
|
||||
WaveTimer = WaveTimer + delta;
|
||||
Fader->set_color(Color(0, 0, 0, WaveTimer / FadeTime));
|
||||
// Do something that this node can't.
|
||||
} else {
|
||||
Fader->set_color(Color(0, 0, 0, 1));
|
||||
emit_signal("WavesFinished");
|
||||
}
|
||||
}
|
||||
|
||||
TypedArray<double> WaveSystem::GetTimeTilWave() const {
|
||||
|
@ -65,6 +105,9 @@ namespace godot {
|
|||
bool WaveSystem::GetFadeAtEnd() const {
|
||||
return FadeAtEnd;
|
||||
}
|
||||
int WaveSystem::GetFadeTime() const {
|
||||
return FadeTime;
|
||||
}
|
||||
|
||||
void WaveSystem::SetTimeTilWave(const TypedArray<double> timeTilWave) {
|
||||
TimeTilWave = timeTilWave;
|
||||
|
@ -78,4 +121,7 @@ namespace godot {
|
|||
void WaveSystem::SetFadeAtEnd(const bool fadeAtEnd) {
|
||||
FadeAtEnd = fadeAtEnd;
|
||||
}
|
||||
void WaveSystem::SetFadeTime(const int fadeTime) {
|
||||
FadeTime = fadeTime;
|
||||
}
|
||||
};
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
|
||||
#include <godot_cpp/classes/node.hpp>
|
||||
#include <godot_cpp/classes/packed_scene.hpp>
|
||||
#include <godot_cpp/classes/color_rect.hpp>
|
||||
|
||||
namespace godot {
|
||||
class WaveSystem : public Node {
|
||||
|
@ -17,8 +18,11 @@ namespace godot {
|
|||
|
||||
bool FadeAtBeginning = false;
|
||||
bool FadeAtEnd = false;
|
||||
int FadeTime = 1;
|
||||
bool Calculated = false;
|
||||
|
||||
ColorRect* Fader;
|
||||
|
||||
protected:
|
||||
static void _bind_methods();
|
||||
|
||||
|
@ -33,11 +37,13 @@ namespace godot {
|
|||
TypedArray<PackedScene> GetWaveScenes() const;
|
||||
bool GetFadeAtBeginning() const;
|
||||
bool GetFadeAtEnd() const;
|
||||
int GetFadeTime() const;
|
||||
|
||||
void SetTimeTilWave(const TypedArray<double> TimeTilWave);
|
||||
void SetWaveScenes(const TypedArray<PackedScene> WaveScenes);
|
||||
void SetFadeAtBeginning(const bool fadeAtBeginning);
|
||||
void SetFadeAtEnd(const bool fadeAtEnd);
|
||||
void SetFadeTime(const int fadeTime);
|
||||
};
|
||||
};
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue