Skip to content

Commit

Permalink
Merge pull request #65 from Maaack/new-template-install
Browse files Browse the repository at this point in the history
Copies example files to project root
  • Loading branch information
Maaack authored May 1, 2024
2 parents 581e739 + c20e2f0 commit 03190ab
Show file tree
Hide file tree
Showing 49 changed files with 1,167 additions and 1 deletion.
Binary file added assets/images/logo_vertical_color_dark.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
34 changes: 34 additions & 0 deletions assets/images/logo_vertical_color_dark.png.import
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
[remap]

importer="texture"
type="CompressedTexture2D"
uid="uid://br7lvloooplpx"
path="res://.godot/imported/logo_vertical_color_dark.png-005eb53cedce1d2e147bce4006c229d6.ctex"
metadata={
"vram_texture": false
}

[deps]

source_file="res://assets/images/logo_vertical_color_dark.png"
dest_files=["res://.godot/imported/logo_vertical_color_dark.png-005eb53cedce1d2e147bce4006c229d6.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
7 changes: 6 additions & 1 deletion project.godot
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ config_version=5
[application]

config/name="Game Template"
run/main_scene="res://addons/maaacks_game_template/examples/scenes/Opening/OpeningWithLogo.tscn"
run/main_scene="res://scenes/Opening/OpeningWithLogo.tscn"
config/features=PackedStringArray("4.2")
config/icon="res://icon.png"

Expand Down Expand Up @@ -94,6 +94,11 @@ interact={
]
}

[maaacks_game_template]

disable_plugin_dialogues=true
copy_path="res://"

[physics]

common/enable_pause_aware_picking=true
Expand Down
2 changes: 2 additions & 0 deletions scenes/Credits/Credits.gd
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
@tool
extends Credits
7 changes: 7 additions & 0 deletions scenes/Credits/Credits.tscn
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
[gd_scene load_steps=3 format=3 uid="uid://b7xvww1e8ovn5"]

[ext_resource type="PackedScene" path="res://addons/maaacks_game_template/base/scenes/Credits/Credits.tscn" id="1_265ql"]
[ext_resource type="Script" path="res://scenes/Credits/Credits.gd" id="2_3axa4"]

[node name="Credits" instance=ExtResource("1_265ql")]
script = ExtResource("2_3axa4")
28 changes: 28 additions & 0 deletions scenes/EndCredits/EndCredits.gd
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
@tool
extends Credits

@export_file("*.tscn") var main_menu_scene : String

func _end_reached():
%EndMessagePanel.show()
super._end_reached()

func _on_MenuButton_pressed():
SceneLoader.load_scene(main_menu_scene)

func _on_ExitButton_pressed():
get_tree().quit()

func _ready():
if main_menu_scene.is_empty():
%MenuButton.hide()
if OS.has_feature("web"):
%ExitButton.hide()
super._ready()

func _unhandled_input(event):
if event.is_action_pressed("ui_cancel"):
if not %EndMessagePanel.visible:
_end_reached()
else:
get_tree().quit()
92 changes: 92 additions & 0 deletions scenes/EndCredits/EndCredits.tscn
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
[gd_scene load_steps=5 format=3 uid="uid://ddukh4p2a8eyq"]

[ext_resource type="PackedScene" path="res://addons/maaacks_game_template/base/scenes/Credits/Credits.tscn" id="1_1317b"]
[ext_resource type="Script" path="res://scenes/EndCredits/EndCredits.gd" id="2_usav5"]
[ext_resource type="PackedScene" path="res://addons/maaacks_game_template/base/scenes/MusicPlayers/BackgroundMusicPlayer.tscn" id="3_dgogn"]
[ext_resource type="Script" path="res://addons/maaacks_game_template/base/scripts/CaptureFocus.gd" id="4_d4xh7"]

[node name="EndCredits" instance=ExtResource("1_1317b")]
script = ExtResource("2_usav5")
main_menu_scene = "res://scenes/Menus/MainMenu/MainMenuWithAnimations.tscn"
scroll_active = true

[node name="BackgroundMusicPlayer" parent="." index="0" instance=ExtResource("3_dgogn")]

[node name="BackgroundColor" type="ColorRect" parent="." index="1"]
layout_mode = 1
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
color = Color(0, 0, 0, 1)

[node name="BackgroundTextureRect" type="TextureRect" parent="." index="2"]
layout_mode = 1
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
expand_mode = 1
stretch_mode = 5

[node name="ScrollContainer" parent="." index="3"]
scroll_vertical = 0

[node name="CenterContainer" type="CenterContainer" parent="." index="4"]
layout_mode = 0
anchor_right = 1.0
anchor_bottom = 1.0
size_flags_horizontal = 3
size_flags_vertical = 3
mouse_filter = 2

[node name="EndMessagePanel" type="Panel" parent="CenterContainer" index="0"]
unique_name_in_owner = true
visible = false
custom_minimum_size = Vector2(360, 120)
layout_mode = 2

[node name="VBoxContainer" type="VBoxContainer" parent="CenterContainer/EndMessagePanel" index="0"]
layout_mode = 0
anchor_right = 1.0
anchor_bottom = 1.0

[node name="ThankPlayer" type="Label" parent="CenterContainer/EndMessagePanel/VBoxContainer" index="0"]
layout_mode = 2
size_flags_horizontal = 3
size_flags_vertical = 3
text = "Thanks for playing!"
horizontal_alignment = 1
vertical_alignment = 1

[node name="CenterContainer" type="CenterContainer" parent="CenterContainer/EndMessagePanel/VBoxContainer" index="1"]
layout_mode = 2
size_flags_horizontal = 3
size_flags_vertical = 3

[node name="HBoxContainer" type="HBoxContainer" parent="CenterContainer/EndMessagePanel/VBoxContainer/CenterContainer" index="0"]
layout_mode = 2
size_flags_vertical = 3
theme_override_constants/separation = 24
script = ExtResource("4_d4xh7")

[node name="ExitButton" type="Button" parent="CenterContainer/EndMessagePanel/VBoxContainer/CenterContainer/HBoxContainer" index="0"]
unique_name_in_owner = true
custom_minimum_size = Vector2(60, 0)
layout_mode = 2
size_flags_horizontal = 3
size_flags_vertical = 3
text = "Exit"

[node name="MenuButton" type="Button" parent="CenterContainer/EndMessagePanel/VBoxContainer/CenterContainer/HBoxContainer" index="1"]
unique_name_in_owner = true
custom_minimum_size = Vector2(60, 0)
layout_mode = 2
size_flags_horizontal = 3
size_flags_vertical = 3
text = "Menu"

[connection signal="pressed" from="CenterContainer/EndMessagePanel/VBoxContainer/CenterContainer/HBoxContainer/ExitButton" to="." method="_on_ExitButton_pressed"]
[connection signal="pressed" from="CenterContainer/EndMessagePanel/VBoxContainer/CenterContainer/HBoxContainer/MenuButton" to="." method="_on_MenuButton_pressed"]
27 changes: 27 additions & 0 deletions scenes/GameScene/GameUI.gd
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
extends Control

@export var win_scene : PackedScene
@export var lose_scene : PackedScene

func _ready():
InGameMenuController.scene_tree = get_tree()

func _on_level_lost():
InGameMenuController.open_menu(lose_scene, get_viewport())

func _on_level_won():
$LevelLoader.advance_and_load_level()

func _on_level_loader_level_loaded():
await $LevelLoader.current_level.ready
if $LevelLoader.current_level.has_signal("level_won"):
$LevelLoader.current_level.level_won.connect(_on_level_won)
if $LevelLoader.current_level.has_signal("level_lost"):
$LevelLoader.current_level.level_lost.connect(_on_level_lost)
$LoadingScreen.close()

func _on_level_loader_levels_finished():
InGameMenuController.open_menu(win_scene, get_viewport())

func _on_level_loader_level_load_started():
$LoadingScreen.reset()
64 changes: 64 additions & 0 deletions scenes/GameScene/GameUI.tscn
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
[gd_scene load_steps=10 format=3 uid="uid://cudh1cxaskpoe"]

[ext_resource type="Script" path="res://scenes/GameScene/GameUI.gd" id="1_jxhd3"]
[ext_resource type="PackedScene" path="res://scenes/WinScreen/WinScreen.tscn" id="2_nkmcd"]
[ext_resource type="PackedScene" path="res://scenes/LoseScreen/LoseScreen.tscn" id="3_ewpkg"]
[ext_resource type="Script" path="res://addons/maaacks_game_template/extras/scripts/PauseMenuController.gd" id="4_t2wej"]
[ext_resource type="PackedScene" path="res://scenes/Menus/PauseMenu/PauseMenu.tscn" id="5_06bi7"]
[ext_resource type="Script" path="res://addons/maaacks_game_template/extras/scripts/LevelLoader.gd" id="6_yn5ws"]
[ext_resource type="PackedScene" path="res://addons/maaacks_game_template/base/scenes/MusicPlayers/BackgroundMusicPlayer.tscn" id="7_td8de"]
[ext_resource type="PackedScene" path="res://addons/maaacks_game_template/base/scenes/LoadingScreen/LoadingScreen.tscn" id="8_xnn2o"]
[ext_resource type="Script" path="res://scenes/GameScene/InputDisplayLabel.gd" id="9_bds4e"]

[node name="GameUI" type="Control"]
layout_mode = 3
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
script = ExtResource("1_jxhd3")
win_scene = ExtResource("2_nkmcd")
lose_scene = ExtResource("3_ewpkg")

[node name="PauseMenuController" type="Node" parent="."]
script = ExtResource("4_t2wej")
pause_menu_packed = ExtResource("5_06bi7")

[node name="LevelLoader" type="Node" parent="." node_paths=PackedStringArray("level_container")]
script = ExtResource("6_yn5ws")
level_container = NodePath("../Control")
files = Array[String](["res://scenes/GameScene/Levels/Level1.tscn", "res://scenes/GameScene/Levels/Level2.tscn", "res://scenes/GameScene/Levels/Level3.tscn"])
directory = "res://scenes/GameScene/Levels"

[node name="BackgroundMusicPlayer" parent="." instance=ExtResource("7_td8de")]

[node name="LoadingScreen" parent="." instance=ExtResource("8_xnn2o")]
visible = false

[node name="InputDisplayLabel" type="Label" parent="."]
layout_mode = 1
anchors_preset = 14
anchor_top = 0.5
anchor_right = 1.0
anchor_bottom = 0.5
offset_top = -11.5
offset_bottom = 11.5
grow_horizontal = 2
grow_vertical = 2
theme_override_font_sizes/font_size = 64
horizontal_alignment = 1
autowrap_mode = 2
script = ExtResource("9_bds4e")

[node name="Control" type="Control" parent="."]
layout_mode = 1
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2

[connection signal="level_load_started" from="LevelLoader" to="." method="_on_level_loader_level_load_started"]
[connection signal="level_loaded" from="LevelLoader" to="." method="_on_level_loader_level_loaded"]
[connection signal="levels_finished" from="LevelLoader" to="." method="_on_level_loader_levels_finished"]
21 changes: 21 additions & 0 deletions scenes/GameScene/InputDisplayLabel.gd
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
extends Label

@onready var action_names = AppSettings.get_filtered_action_names()

func _get_inputs_as_string():
var all_inputs : String = ""
var is_first : bool = true
for action_name in action_names:
if Input.is_action_pressed(action_name):
if is_first:
is_first = false
all_inputs += action_name
else:
all_inputs += " + " + action_name
return all_inputs

func _process(_delta):
if Input.is_anything_pressed():
text = _get_inputs_as_string()
else:
text = ""
10 changes: 10 additions & 0 deletions scenes/GameScene/Levels/Level.gd
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
extends Node

signal level_won
signal level_lost

func _on_lose_button_pressed():
emit_signal("level_lost")

func _on_win_button_pressed():
emit_signal("level_won")
38 changes: 38 additions & 0 deletions scenes/GameScene/Levels/Level1.tscn
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
[gd_scene load_steps=2 format=3 uid="uid://ckcsv8wlii02y"]

[ext_resource type="Script" path="res://scenes/GameScene/Levels/Level.gd" id="1_banrx"]

[node name="Level1" type="HBoxContainer"]
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
script = ExtResource("1_banrx")

[node name="MarginContainer" type="MarginContainer" parent="."]
layout_mode = 2
size_flags_horizontal = 3
theme_override_constants/margin_left = 32
theme_override_constants/margin_top = 32
theme_override_constants/margin_right = 32
theme_override_constants/margin_bottom = 32

[node name="LoseButton" type="Button" parent="MarginContainer"]
layout_mode = 2
text = "Lose"

[node name="MarginContainer2" type="MarginContainer" parent="."]
layout_mode = 2
size_flags_horizontal = 3
theme_override_constants/margin_left = 32
theme_override_constants/margin_top = 32
theme_override_constants/margin_right = 32
theme_override_constants/margin_bottom = 32

[node name="WinButton" type="Button" parent="MarginContainer2"]
layout_mode = 2
text = "Win"

[connection signal="pressed" from="MarginContainer/LoseButton" to="." method="_on_lose_button_pressed"]
[connection signal="pressed" from="MarginContainer2/WinButton" to="." method="_on_win_button_pressed"]
Loading

0 comments on commit 03190ab

Please sign in to comment.