Add spaceship exit component, enemy wave trigger, and update various scene properties
This commit is contained in:
@@ -126,9 +126,11 @@ area2d = NodePath("../Hitbox")
|
|||||||
[node name="PeriodicShootingComponent" type="Node" parent="." node_paths=PackedStringArray("root", "bullet_spawn_right", "bullet_spawn_left")]
|
[node name="PeriodicShootingComponent" type="Node" parent="." node_paths=PackedStringArray("root", "bullet_spawn_right", "bullet_spawn_left")]
|
||||||
script = ExtResource("6_4ajjm")
|
script = ExtResource("6_4ajjm")
|
||||||
bullet_scene = ExtResource("7_4ajjm")
|
bullet_scene = ExtResource("7_4ajjm")
|
||||||
|
shoot_interval = 2.0
|
||||||
root = NodePath("..")
|
root = NodePath("..")
|
||||||
bullet_spawn_right = NodePath("../laser spawn point right")
|
bullet_spawn_right = NodePath("../laser spawn point right")
|
||||||
bullet_spawn_left = NodePath("../laser spawn point left")
|
bullet_spawn_left = NodePath("../laser spawn point left")
|
||||||
|
shooting_interval_variation = 0.5
|
||||||
|
|
||||||
[node name="EnemyDeathComponent" type="Node" parent="." node_paths=PackedStringArray("root", "collision_shape_2d", "health_component")]
|
[node name="EnemyDeathComponent" type="Node" parent="." node_paths=PackedStringArray("root", "collision_shape_2d", "health_component")]
|
||||||
script = ExtResource("7_uyhuj")
|
script = ExtResource("7_uyhuj")
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
[gd_scene load_steps=9 format=3 uid="uid://dtem8jgcyoqar"]
|
[gd_scene load_steps=10 format=3 uid="uid://dtem8jgcyoqar"]
|
||||||
|
|
||||||
[ext_resource type="Script" uid="uid://dkmxhjtmu5xlb" path="res://scripts/components/damage_component.gd" id="1_nuljg"]
|
[ext_resource type="Script" uid="uid://dkmxhjtmu5xlb" path="res://scripts/components/damage_component.gd" id="1_nuljg"]
|
||||||
[ext_resource type="Script" uid="uid://cdnwrn8v05qhi" path="res://scripts/components/bullet_component.gd" id="2_1gu8o"]
|
[ext_resource type="Script" uid="uid://cdnwrn8v05qhi" path="res://scripts/components/bullet_component.gd" id="2_1gu8o"]
|
||||||
@@ -7,16 +7,18 @@
|
|||||||
[ext_resource type="Script" uid="uid://873un8agkyja" path="res://scripts/components/launch_component.gd" id="5_772bd"]
|
[ext_resource type="Script" uid="uid://873un8agkyja" path="res://scripts/components/launch_component.gd" id="5_772bd"]
|
||||||
[ext_resource type="Script" uid="uid://bvsgg8lu0a8m6" path="res://scripts/components/lifetime_component.gd" id="6_vd16u"]
|
[ext_resource type="Script" uid="uid://bvsgg8lu0a8m6" path="res://scripts/components/lifetime_component.gd" id="6_vd16u"]
|
||||||
[ext_resource type="Script" uid="uid://bgty7040ams6s" path="res://scripts/components/projectile_init_component.gd" id="7_1gu8o"]
|
[ext_resource type="Script" uid="uid://bgty7040ams6s" path="res://scripts/components/projectile_init_component.gd" id="7_1gu8o"]
|
||||||
|
[ext_resource type="Script" uid="uid://bpy6xtfm8l3hy" path="res://scripts/components/trigger_lever_component.gd" id="8_2vcrp"]
|
||||||
|
|
||||||
[sub_resource type="RectangleShape2D" id="RectangleShape2D_n4uav"]
|
[sub_resource type="RectangleShape2D" id="RectangleShape2D_n4uav"]
|
||||||
size = Vector2(16, 2)
|
size = Vector2(16, 2)
|
||||||
|
|
||||||
[node name="Red Laser" type="Area2D"]
|
[node name="Green Laser" type="Area2D"]
|
||||||
collision_layer = 16
|
collision_layer = 16
|
||||||
collision_mask = 9
|
collision_mask = 9
|
||||||
|
|
||||||
[node name="DamageComponent" type="Node" parent="." node_paths=PackedStringArray("area2d")]
|
[node name="DamageComponent" type="Node" parent="." node_paths=PackedStringArray("area2d")]
|
||||||
script = ExtResource("1_nuljg")
|
script = ExtResource("1_nuljg")
|
||||||
|
damage = 1.0
|
||||||
area2d = NodePath("..")
|
area2d = NodePath("..")
|
||||||
metadata/_custom_type_script = "uid://dkmxhjtmu5xlb"
|
metadata/_custom_type_script = "uid://dkmxhjtmu5xlb"
|
||||||
|
|
||||||
@@ -72,3 +74,7 @@ autostart = true
|
|||||||
script = ExtResource("7_1gu8o")
|
script = ExtResource("7_1gu8o")
|
||||||
launch_component = NodePath("../LaunchComponent")
|
launch_component = NodePath("../LaunchComponent")
|
||||||
metadata/_custom_type_script = "uid://bgty7040ams6s"
|
metadata/_custom_type_script = "uid://bgty7040ams6s"
|
||||||
|
|
||||||
|
[node name="TriggerLeverComponent" type="Node" parent="."]
|
||||||
|
script = ExtResource("8_2vcrp")
|
||||||
|
metadata/_custom_type_script = "uid://bpy6xtfm8l3hy"
|
||||||
|
@@ -9,7 +9,7 @@ size = Vector2(12, 13)
|
|||||||
|
|
||||||
[node name="Lever" type="Area2D" groups=["levers"]]
|
[node name="Lever" type="Area2D" groups=["levers"]]
|
||||||
collision_layer = 0
|
collision_layer = 0
|
||||||
collision_mask = 4
|
collision_mask = 20
|
||||||
|
|
||||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
|
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
|
||||||
position = Vector2(0, 1.5)
|
position = Vector2(0, 1.5)
|
||||||
|
14
objects/entities/spaceship_exit.tscn
Normal file
14
objects/entities/spaceship_exit.tscn
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
[gd_scene load_steps=3 format=3 uid="uid://dkqa3q6j2gof4"]
|
||||||
|
|
||||||
|
[ext_resource type="Script" uid="uid://ybmwls7hv8j3" path="res://scripts/components/spaceship_exit_component.gd" id="1_1cmfv"]
|
||||||
|
|
||||||
|
[sub_resource type="RectangleShape2D" id="RectangleShape2D_njt46"]
|
||||||
|
|
||||||
|
[node name="Spaceship exit" type="Area2D" node_paths=PackedStringArray("area2d")]
|
||||||
|
collision_layer = 0
|
||||||
|
collision_mask = 4
|
||||||
|
script = ExtResource("1_1cmfv")
|
||||||
|
area2d = NodePath(".")
|
||||||
|
|
||||||
|
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
|
||||||
|
shape = SubResource("RectangleShape2D_njt46")
|
@@ -131,7 +131,7 @@ texture = ExtResource("2_dfydr")
|
|||||||
12:11/0 = 0
|
12:11/0 = 0
|
||||||
13:11/0 = 0
|
13:11/0 = 0
|
||||||
2:2/0 = 0
|
2:2/0 = 0
|
||||||
2:2/0/probability = 0.0
|
2:2/0/probability = 0.8
|
||||||
|
|
||||||
[resource]
|
[resource]
|
||||||
sources/0 = SubResource("TileSetAtlasSource_cagp7")
|
sources/0 = SubResource("TileSetAtlasSource_cagp7")
|
||||||
|
@@ -1,10 +1,11 @@
|
|||||||
[gd_resource type="TileSet" load_steps=14 format=3 uid="uid://bc5a20s6kuy8e"]
|
[gd_resource type="TileSet" load_steps=15 format=3 uid="uid://bc5a20s6kuy8e"]
|
||||||
|
|
||||||
[ext_resource type="Texture2D" uid="uid://djifxc5x0dyrw" path="res://sprites/ppc_tileset.png" id="1_ej5iv"]
|
[ext_resource type="Texture2D" uid="uid://djifxc5x0dyrw" path="res://sprites/ppc_tileset.png" id="1_ej5iv"]
|
||||||
[ext_resource type="PackedScene" uid="uid://54w4wisfj8v8" path="res://objects/entities/coin.tscn" id="2_31a0q"]
|
[ext_resource type="PackedScene" uid="uid://54w4wisfj8v8" path="res://objects/entities/coin.tscn" id="2_31a0q"]
|
||||||
[ext_resource type="PackedScene" uid="uid://c40r76qqacqie" path="res://objects/entities/collapsing_block.tscn" id="3_31a0q"]
|
[ext_resource type="PackedScene" uid="uid://c40r76qqacqie" path="res://objects/entities/collapsing_block.tscn" id="3_31a0q"]
|
||||||
[ext_resource type="PackedScene" uid="uid://ct8fim6mduyl3" path="res://objects/entities/collapsing_bridge.tscn" id="3_x63lh"]
|
[ext_resource type="PackedScene" uid="uid://ct8fim6mduyl3" path="res://objects/entities/collapsing_bridge.tscn" id="3_x63lh"]
|
||||||
[ext_resource type="PackedScene" uid="uid://bargnp4twtmxg" path="res://objects/entities/big_coin.tscn" id="4_ov0dn"]
|
[ext_resource type="PackedScene" uid="uid://bargnp4twtmxg" path="res://objects/entities/big_coin.tscn" id="4_ov0dn"]
|
||||||
|
[ext_resource type="PackedScene" uid="uid://buff711j0f2ph" path="res://objects/entities/spike_wheel.tscn" id="4_x63lh"]
|
||||||
[ext_resource type="PackedScene" uid="uid://d08dfqmirnd66" path="res://objects/entities/big_treasure.tscn" id="5_xxibl"]
|
[ext_resource type="PackedScene" uid="uid://d08dfqmirnd66" path="res://objects/entities/big_treasure.tscn" id="5_xxibl"]
|
||||||
[ext_resource type="PackedScene" uid="uid://073ts5cxtwbl" path="res://objects/entities/treasure.tscn" id="6_fmgww"]
|
[ext_resource type="PackedScene" uid="uid://073ts5cxtwbl" path="res://objects/entities/treasure.tscn" id="6_fmgww"]
|
||||||
[ext_resource type="PackedScene" uid="uid://cm3rixnnev1pg" path="res://objects/entities/jump_pad.tscn" id="7_0kjxj"]
|
[ext_resource type="PackedScene" uid="uid://cm3rixnnev1pg" path="res://objects/entities/jump_pad.tscn" id="7_0kjxj"]
|
||||||
@@ -147,6 +148,7 @@ scenes/7/scene = ExtResource("8_83o0w")
|
|||||||
scenes/8/scene = ExtResource("9_at40q")
|
scenes/8/scene = ExtResource("9_at40q")
|
||||||
scenes/9/scene = ExtResource("10_ivcjr")
|
scenes/9/scene = ExtResource("10_ivcjr")
|
||||||
scenes/10/scene = ExtResource("3_31a0q")
|
scenes/10/scene = ExtResource("3_31a0q")
|
||||||
|
scenes/11/scene = ExtResource("4_x63lh")
|
||||||
|
|
||||||
[resource]
|
[resource]
|
||||||
physics_layer_0/collision_layer = 1
|
physics_layer_0/collision_layer = 1
|
||||||
|
File diff suppressed because one or more lines are too long
37
scripts/components/enemy_wave_trigger.gd
Normal file
37
scripts/components/enemy_wave_trigger.gd
Normal file
@@ -0,0 +1,37 @@
|
|||||||
|
class_name EnemyWaveTrigger
|
||||||
|
extends Node
|
||||||
|
|
||||||
|
@export var area2d: Area2D
|
||||||
|
@export var path_follow_node: PathFollow2D
|
||||||
|
@export var speed: float = 100.0
|
||||||
|
@export var loop: bool = false
|
||||||
|
@export var activate_on_enter: bool = true
|
||||||
|
|
||||||
|
var active: bool = false
|
||||||
|
|
||||||
|
|
||||||
|
func _ready() -> void:
|
||||||
|
area2d.body_entered.connect(_on_body_entered)
|
||||||
|
if path_follow_node:
|
||||||
|
path_follow_node.progress = 0
|
||||||
|
path_follow_node.set_process(false)
|
||||||
|
|
||||||
|
|
||||||
|
func _process(delta: float) -> void:
|
||||||
|
if not active or not path_follow_node:
|
||||||
|
return
|
||||||
|
path_follow_node.progress += speed * delta
|
||||||
|
if path_follow_node.progress_ratio >= 1.0 and not loop:
|
||||||
|
active = false
|
||||||
|
path_follow_node.set_process(false)
|
||||||
|
|
||||||
|
|
||||||
|
func _on_body_entered(body: Node2D) -> void:
|
||||||
|
if activate_on_enter:
|
||||||
|
start_wave()
|
||||||
|
|
||||||
|
|
||||||
|
func start_wave() -> void:
|
||||||
|
if path_follow_node:
|
||||||
|
path_follow_node.set_process(true)
|
||||||
|
active = true
|
@@ -8,6 +8,7 @@ extends Node
|
|||||||
@export var root: Node2D
|
@export var root: Node2D
|
||||||
@export var bullet_spawn_right: Node2D
|
@export var bullet_spawn_right: Node2D
|
||||||
@export var bullet_spawn_left: Node2D
|
@export var bullet_spawn_left: Node2D
|
||||||
|
@export var shooting_interval_variation: float = 0.0
|
||||||
|
|
||||||
var timer: Timer
|
var timer: Timer
|
||||||
|
|
||||||
@@ -43,9 +44,16 @@ func on_timer_timeout() -> void:
|
|||||||
timer.start()
|
timer.start()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
func get_shoot_interval() -> float:
|
||||||
|
if shooting_interval_variation > 0.0:
|
||||||
|
return shoot_interval + randf_range(-shooting_interval_variation, shooting_interval_variation)
|
||||||
|
return shoot_interval
|
||||||
|
|
||||||
|
|
||||||
func setup_timer() -> void:
|
func setup_timer() -> void:
|
||||||
timer = Timer.new()
|
timer = Timer.new()
|
||||||
timer.wait_time = shoot_interval
|
timer.wait_time = get_shoot_interval()
|
||||||
timer.one_shot = false
|
timer.one_shot = false
|
||||||
timer.autostart = true
|
timer.autostart = true
|
||||||
timer.timeout.connect(on_timer_timeout)
|
timer.timeout.connect(on_timer_timeout)
|
||||||
|
21
scripts/components/spaceship_exit_component.gd
Normal file
21
scripts/components/spaceship_exit_component.gd
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
class_name SpaceshipExitComponent
|
||||||
|
extends Node
|
||||||
|
|
||||||
|
@export var area2d: Area2D
|
||||||
|
signal spaceship_exited
|
||||||
|
|
||||||
|
|
||||||
|
func _ready() -> void:
|
||||||
|
if not area2d:
|
||||||
|
printerr("SpaceshipExitComponent: area2d is not set.")
|
||||||
|
return
|
||||||
|
|
||||||
|
area2d.body_entered.connect(_on_area2d_body_entered)
|
||||||
|
|
||||||
|
|
||||||
|
func _on_area2d_body_entered(body: Node2D) -> void:
|
||||||
|
if not body is PlayerController:
|
||||||
|
printerr("SpaceshipExitComponent: body is not a PlayerController.")
|
||||||
|
return
|
||||||
|
print("SpaceshipExitComponent: PlayerController exited spaceship.")
|
||||||
|
spaceship_exited.emit()
|
1
scripts/components/spaceship_exit_component.gd.uid
Normal file
1
scripts/components/spaceship_exit_component.gd.uid
Normal file
@@ -0,0 +1 @@
|
|||||||
|
uid://ybmwls7hv8j3
|
Reference in New Issue
Block a user