diff --git a/apps/gamejam/brackeys/13/scenes/game.tscn b/apps/gamejam/brackeys/13/scenes/game.tscn index 107d8a74f..a3ba0dd94 100644 --- a/apps/gamejam/brackeys/13/scenes/game.tscn +++ b/apps/gamejam/brackeys/13/scenes/game.tscn @@ -1,4 +1,4 @@ -[gd_scene load_steps=11 format=3 uid="uid://cbrda40vq26pj"] +[gd_scene load_steps=14 format=3 uid="uid://cbrda40vq26pj"] [ext_resource type="Script" path="res://scripts/game.gd" id="1_oyaqx"] [ext_resource type="PackedScene" uid="uid://1s5v0llrjq3" path="res://scenes/spaceship.tscn" id="1_rlyye"] @@ -10,10 +10,75 @@ [ext_resource type="Script" path="res://scripts/environment_layer.gd" id="8_rakg7"] [ext_resource type="Script" path="res://scripts/toast_manager.gd" id="9_tiuga"] [ext_resource type="Script" path="res://scripts/entity.gd" id="10_1liq3"] +[ext_resource type="Script" path="res://scripts/hud.gd" id="11_e1u8f"] +[ext_resource type="Theme" uid="uid://bkt3waoihtb6j" path="res://theme/Theme.tres" id="11_je1f8"] + +[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_4vpul"] +bg_color = Color(0.6, 0.6, 0.6, 0.5) +expand_margin_left = 20.0 +expand_margin_right = 20.0 [node name="Game" type="Node2D"] script = ExtResource("1_oyaqx") +[node name="CanvasLayer" type="CanvasLayer" parent="."] + +[node name="UI" type="Control" parent="CanvasLayer"] +layout_mode = 3 +anchors_preset = 15 +anchor_right = 1.0 +anchor_bottom = 1.0 +grow_horizontal = 2 +grow_vertical = 2 + +[node name="HUD" type="Control" parent="CanvasLayer/UI"] +custom_minimum_size = Vector2(0, 80) +layout_mode = 1 +anchors_preset = 15 +anchor_right = 1.0 +anchor_bottom = 1.0 +grow_horizontal = 2 +grow_vertical = 2 +size_flags_horizontal = 3 +theme = ExtResource("11_je1f8") +script = ExtResource("11_e1u8f") + +[node name="Panel" type="PanelContainer" parent="CanvasLayer/UI/HUD"] +custom_minimum_size = Vector2(0, 80) +layout_mode = 1 +anchors_preset = 10 +anchor_right = 1.0 +offset_bottom = 23.0 +grow_horizontal = 2 +theme_override_styles/panel = SubResource("StyleBoxFlat_4vpul") + +[node name="Menu" type="HBoxContainer" parent="CanvasLayer/UI/HUD/Panel"] +layout_mode = 2 +alignment = 1 + +[node name="Label" type="Label" parent="CanvasLayer/UI/HUD/Panel/Menu"] +layout_mode = 2 + +[node name="Bottom" type="Control" parent="CanvasLayer"] +layout_mode = 3 +anchors_preset = 12 +anchor_top = 1.0 +anchor_right = 1.0 +anchor_bottom = 1.0 +grow_horizontal = 2 +grow_vertical = 0 + +[node name="ToastManager" type="Control" parent="CanvasLayer/Bottom"] +layout_mode = 1 +anchors_preset = 2 +anchor_top = 1.0 +anchor_bottom = 1.0 +offset_top = -80.0 +offset_right = 40.0 +offset_bottom = -40.0 +grow_vertical = 0 +script = ExtResource("9_tiuga") + [node name="Spaceship" parent="." instance=ExtResource("1_rlyye")] position = Vector2(500, 300) @@ -39,12 +104,5 @@ script = ExtResource("7_hvh2v") [node name="EnvironmentLayer" type="Node2D" parent="Background"] script = ExtResource("8_rakg7") -[node name="ToastManager" type="Control" parent="."] -layout_mode = 3 -anchors_preset = 0 -offset_right = 40.0 -offset_bottom = 40.0 -script = ExtResource("9_tiuga") - [node name="Entity" type="Node2D" parent="."] script = ExtResource("10_1liq3") diff --git a/apps/gamejam/brackeys/13/scenes/ui/toast.tscn b/apps/gamejam/brackeys/13/scenes/ui/toast.tscn index f92aece5b..fd61fbd66 100644 --- a/apps/gamejam/brackeys/13/scenes/ui/toast.tscn +++ b/apps/gamejam/brackeys/13/scenes/ui/toast.tscn @@ -5,7 +5,12 @@ [node name="Toast" type="Control"] layout_mode = 3 -anchors_preset = 0 +anchors_preset = 12 +anchor_top = 1.0 +anchor_right = 1.0 +anchor_bottom = 1.0 +grow_horizontal = 2 +grow_vertical = 0 script = ExtResource("1_jpci1") [node name="Panel" type="Panel" parent="."] diff --git a/apps/gamejam/brackeys/13/scripts/entity.gd b/apps/gamejam/brackeys/13/scripts/entity.gd index 4fcfbfb00..d0336b35d 100644 --- a/apps/gamejam/brackeys/13/scripts/entity.gd +++ b/apps/gamejam/brackeys/13/scripts/entity.gd @@ -1,6 +1,6 @@ extends Node2D -const ASTEROID_SCENE = preload("res://scenes/Asteroid.tscn") +const ASTEROID_SCENE = preload("res://scenes/asteroid.tscn") var asteroid_pool: Array = [] var active_asteroids: Array = [] diff --git a/apps/gamejam/brackeys/13/scripts/game.gd b/apps/gamejam/brackeys/13/scripts/game.gd index 6477a08b8..fea0d7731 100644 --- a/apps/gamejam/brackeys/13/scripts/game.gd +++ b/apps/gamejam/brackeys/13/scripts/game.gd @@ -3,14 +3,14 @@ extends Node2D @onready var spaceship = $Spaceship @onready var projectiles = $Projectiles @onready var background = $Background -@onready var tm = $ToastManager +#@onready var tm = $ToastManager -const LASER_POOL_SIZE = 25 +const LASER_POOL_SIZE = 10 func _ready(): spaceship.connect("laser_shot", _on_spaceship_laser_shot) projectiles.initialize_pool(LASER_POOL_SIZE) - tm.show_toast("game_start", "Game Started! Ready for launch.", "info") + Global.emit_signal("notification_received", "game_start", "Game Started! Ready for launch.", "info") func _on_spaceship_laser_shot(scope_position: Vector2, rotation: float): projectiles.shoot_laser(scope_position, rotation) diff --git a/apps/gamejam/brackeys/13/scripts/hud.gd b/apps/gamejam/brackeys/13/scripts/hud.gd new file mode 100644 index 000000000..a1d4176a6 --- /dev/null +++ b/apps/gamejam/brackeys/13/scripts/hud.gd @@ -0,0 +1,11 @@ +extends Control + + +# Called when the node enters the scene tree for the first time. +func _ready() -> void: + pass # Replace with function body. + + +# Called every frame. 'delta' is the elapsed time since the previous frame. +func _process(delta: float) -> void: + pass diff --git a/apps/gamejam/brackeys/13/scripts/laser.gd b/apps/gamejam/brackeys/13/scripts/laser.gd index 8626be712..5aaff5408 100644 --- a/apps/gamejam/brackeys/13/scripts/laser.gd +++ b/apps/gamejam/brackeys/13/scripts/laser.gd @@ -17,6 +17,7 @@ func _on_area_entered(area): if area is Asteroid: var asteroid = area asteroid.destroy() + Global.emit_signal("notification_received", "asteroid_hit", "Asteroid was destoried!", "success") visible = false if get_parent(): get_parent()._on_laser_exited(self)