Initial commit

This commit is contained in:
2024-02-08 22:16:58 +01:00
commit 89e97a200c
524 changed files with 15626 additions and 0 deletions

2
.gitattributes vendored Normal file
View File

@@ -0,0 +1,2 @@
# Normalize EOL for all files that Git considers text files.
* text=auto eol=lf

2
.gitignore vendored Normal file
View File

@@ -0,0 +1,2 @@
# Godot 4+ specific ignores
.godot/

18
.vscode/launch.json vendored Normal file
View File

@@ -0,0 +1,18 @@
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "GDScript Godot",
"type": "godot",
"request": "launch",
"project": "${workspaceFolder}",
"port": 6007,
"address": "127.0.0.1",
"launch_game_instance": true,
"launch_scene": false
}
]
}

3
.vscode/settings.json vendored Normal file
View File

@@ -0,0 +1,3 @@
{
"godot_tools.editor_path": "/usr/bin/godot"
}

21
LICENSE Normal file
View File

@@ -0,0 +1,21 @@
MIT License
Copyright (c) 2019 Lisandro Lorea
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

3
README.md Normal file
View File

@@ -0,0 +1,3 @@
# REWAVE POC YFinGames
Demo: https://instweb.yfin.mildstone.org/andrea/rewave

Binary file not shown.

After

Width:  |  Height:  |  Size: 64 KiB

View File

@@ -0,0 +1,96 @@
@tool
extends Control
@onready var btn_save_preset = %BtnSavePreset
@onready var btn_load_preset = %BtnLoadPreset
@onready var lin_ed_preset_name = %LinEdPresetName
@onready var dropdown = %Dropdown
@onready var btn_import = %BtnImport
@onready var confirmation_dialog = $ConfirmationDialog
@onready var file_dialog = $FileDialog
var folder_path : String
# Called when the node enters the scene tree for the first time.
func _ready():
btn_load_preset.pressed.connect(on_btn_pressed_load)
btn_save_preset.pressed.connect(on_btn_pressed_save)
btn_import.pressed.connect(on_btn_pressed_import)
confirmation_dialog.confirmed.connect(on_confirmed_restart)
file_dialog.dialog_hide_on_ok = true
file_dialog.access = 2
file_dialog.dir_selected.connect(on_folder_selected)
btn_import.disabled = true
func on_folder_selected(path):
folder_path = path
btn_import.disabled = false
dir_contents(path)
func on_confirmed_restart():
EditorPlugin.new().get_editor_interface().restart_editor()
func on_btn_pressed_import():
var file_path = folder_path.path_join(dropdown.get_item_text(dropdown.selected))
var config = ConfigFile.new()
var err = config.load(file_path)
if err != OK:
return
for input_name in config.get_section_keys("input"):
var action_obj = config.get_value("input", input_name)
ProjectSettings.set_setting("input/" + input_name, action_obj)
ProjectSettings.save()
confirmation_dialog.popup_centered()
func on_btn_pressed_load():
file_dialog.popup_centered()
func on_btn_pressed_save():
if lin_ed_preset_name.text != null:
save_test_file()
func save_test_file():
InputMap.load_from_project_settings()
var config = ConfigFile.new()
var Actions = InputMap.get_actions()
for action in Actions:
if not action.begins_with("ui"):
var input_object = {
"deadzone": InputMap.action_get_deadzone(action),
"events": InputMap.action_get_events(action)
}
config.set_value("input", action, input_object)
# Save it to a file (overwrite if already exists).
config.save(folder_path.path_join(lin_ed_preset_name.text + ".godot"))
func dir_contents(path):
dropdown.clear()
var dir = DirAccess.open(path)
if dir:
dir.list_dir_begin()
var file_name = dir.get_next()
while file_name != "":
if dir.current_is_dir():
print("Found directory: " + file_name)
else:
if file_name.ends_with(".godot"):
dropdown.add_item(file_name)
file_name = dir.get_next()
else:
print("An error occurred when trying to access the path.")

View File

@@ -0,0 +1,78 @@
[gd_scene load_steps=2 format=3 uid="uid://cpunnqo5npx7a"]
[ext_resource type="Script" path="res://addons/inputmapperpresetloader/InputMapperPresets.gd" id="1_m65gv"]
[node name="InputMapperPresets" 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_m65gv")
[node name="MarginContainer" type="MarginContainer" parent="."]
layout_mode = 1
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
[node name="HBoxContainer2" type="VBoxContainer" parent="MarginContainer"]
custom_minimum_size = Vector2(200, 0)
layout_mode = 2
[node name="HBoxContainer" type="HBoxContainer" parent="MarginContainer/HBoxContainer2"]
layout_mode = 2
[node name="BtnSavePreset" type="Button" parent="MarginContainer/HBoxContainer2/HBoxContainer"]
unique_name_in_owner = true
layout_mode = 2
tooltip_text = "Saves the projects current input map using name given to the right of this button and it ends with `.godot`
Will ignore default values (anything that starts with `ui`"
text = "Save"
[node name="LinEdPresetName" type="LineEdit" parent="MarginContainer/HBoxContainer2/HBoxContainer"]
unique_name_in_owner = true
custom_minimum_size = Vector2(200, 0)
layout_mode = 2
size_flags_horizontal = 3
tooltip_text = "The name the config file will have and it ends with a `.godot`"
[node name="TxtExtention" type="Label" parent="MarginContainer/HBoxContainer2/HBoxContainer"]
unique_name_in_owner = true
layout_mode = 2
size_flags_horizontal = 8
text = ".godot"
[node name="BtnLoadPreset" type="Button" parent="MarginContainer/HBoxContainer2/HBoxContainer"]
unique_name_in_owner = true
layout_mode = 2
tooltip_text = "Select the folder that has your saved config files"
text = "Select Folder"
[node name="Dropdown" type="OptionButton" parent="MarginContainer/HBoxContainer2"]
unique_name_in_owner = true
layout_mode = 2
allow_reselect = true
[node name="BtnImport" type="Button" parent="MarginContainer/HBoxContainer2"]
unique_name_in_owner = true
layout_mode = 2
disabled = true
text = "Import"
[node name="FileDialog" type="FileDialog" parent="."]
title = "Open a Directory"
size = Vector2i(480, 240)
min_size = Vector2i(480, 240)
ok_button_text = "Select Current Folder"
dialog_hide_on_ok = true
file_mode = 2
access = 2
root_subfolder = "C:\\Users\\Light\\AppData\\Roaming\\Godot"
[node name="ConfirmationDialog" type="AcceptDialog" parent="."]
dialog_text = "Restart Project Now?"

View File

@@ -0,0 +1,17 @@
@tool
extends EditorPlugin
const editorAddon = preload("res://addons/inputmapperpresetloader/InputMapperPresets.tscn")
var InputMapperPresetsScene
func _enter_tree():
InputMap.load_from_project_settings()
InputMapperPresetsScene = editorAddon.instantiate()
add_control_to_dock(EditorPlugin.DOCK_SLOT_RIGHT_UL, InputMapperPresetsScene)
func _exit_tree():
remove_control_from_docks(InputMapperPresetsScene)
InputMapperPresetsScene.free()

View File

@@ -0,0 +1,7 @@
[plugin]
name="InputMapperPresetLoader"
description="This plugin works by letting users save/import pre-defined Input Maps"
author="Light1c3"
version="1.0.0"
script="inputmapperpresetloader.gd"

View File

@@ -0,0 +1,21 @@
MIT License
Copyright (c) 2016-2023 The Godot Engine community
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,12 @@
[configuration]
entry_symbol = "git_plugin_init"
compatibility_minimum = "4.1.0"
[libraries]
macos.editor = "macos/libgit_plugin.macos.editor.universal.dylib"
windows.editor.x86_64 = "win64/libgit_plugin.windows.editor.x86_64.dll"
linux.editor.x86_64 = "linux/libgit_plugin.linux.editor.x86_64.so"
linux.editor.arm64 = "linux/libgit_plugin.linux.editor.arm64.so"
linux.editor.rv64 = ""

View File

@@ -0,0 +1,7 @@
[plugin]
name="Godot Git Plugin"
description="This plugin lets you interact with Git without leaving the Godot editor. More information can be found at https://github.com/godotengine/godot-git-plugin/wiki"
author="twaritwaikar"
version="v3.1.0"
script="godot-git-plugin.gd"

16
default_bus_layout.tres Normal file
View File

@@ -0,0 +1,16 @@
[gd_resource type="AudioBusLayout" load_steps=2 format=3 uid="uid://bwykv76fn4u75"]
[sub_resource type="AudioEffectLowPassFilter" id="1"]
resource_name = "LowPassFilter"
cutoff_hz = 1500.0
db = 1
[resource]
bus/1/name = &"Music"
bus/1/solo = false
bus/1/mute = false
bus/1/bypass_fx = false
bus/1/volume_db = 0.0
bus/1/send = &"Master"
bus/1/effect/0/effect = SubResource("1")
bus/1/effect/0/enabled = false

7
default_env.tres Normal file
View File

@@ -0,0 +1,7 @@
[gd_resource type="Environment" load_steps=2 format=3 uid="uid://di0mmn1y2mhwl"]
[sub_resource type="Sky" id="1"]
[resource]
background_mode = 2
sky = SubResource("1")

0
docs/.gdignore Normal file
View File

BIN
docs/Using the template.pdf Normal file

Binary file not shown.

1
docs/readme.txt Normal file
View File

@@ -0,0 +1 @@
You game documentation here

0
editables/.gdignore Normal file
View File

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.9 KiB

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.6 KiB

Binary file not shown.

77
export_presets.cfg Normal file
View File

@@ -0,0 +1,77 @@
[preset.0]
name="Linux/X11"
platform="Linux/X11"
runnable=false
dedicated_server=false
custom_features=""
export_filter="all_resources"
include_filter=""
exclude_filter=""
export_path=""
encryption_include_filters=""
encryption_exclude_filters=""
encrypt_pck=false
encrypt_directory=false
[preset.0.options]
custom_template/debug=""
custom_template/release=""
debug/export_console_wrapper=1
binary_format/embed_pck=false
texture_format/bptc=true
texture_format/s3tc=true
texture_format/etc=false
texture_format/etc2=false
binary_format/architecture="x86_64"
ssh_remote_deploy/enabled=false
ssh_remote_deploy/host="user@host_ip"
ssh_remote_deploy/port="22"
ssh_remote_deploy/extra_args_ssh=""
ssh_remote_deploy/extra_args_scp=""
ssh_remote_deploy/run_script="#!/usr/bin/env bash
export DISPLAY=:0
unzip -o -q \"{temp_dir}/{archive_name}\" -d \"{temp_dir}\"
\"{temp_dir}/{exe_name}\" {cmd_args}"
ssh_remote_deploy/cleanup_script="#!/usr/bin/env bash
kill $(pgrep -x -f \"{temp_dir}/{exe_name} {cmd_args}\")
rm -rf \"{temp_dir}\""
[preset.1]
name="Web"
platform="Web"
runnable=true
dedicated_server=false
custom_features=""
export_filter="all_resources"
include_filter=""
exclude_filter=""
export_path="../../instweb/andrea/rewave/reactive_wave.html"
encryption_include_filters=""
encryption_exclude_filters=""
encrypt_pck=false
encrypt_directory=false
[preset.1.options]
custom_template/debug=""
custom_template/release=""
variant/extensions_support=false
vram_texture_compression/for_desktop=true
vram_texture_compression/for_mobile=true
html/export_icon=true
html/custom_html_shell=""
html/head_include=""
html/canvas_resize_policy=2
html/focus_canvas_on_start=true
html/experimental_virtual_keyboard=false
progressive_web_app/enabled=false
progressive_web_app/offline_page=""
progressive_web_app/display=1
progressive_web_app/orientation=0
progressive_web_app/icon_144x144=""
progressive_web_app/icon_180x180=""
progressive_web_app/icon_512x512=""
progressive_web_app/background_color=Color(0, 0, 0, 1)

BIN
fonts/Candy Demo.otf Normal file

Binary file not shown.

View File

@@ -0,0 +1,33 @@
[remap]
importer="font_data_dynamic"
type="FontFile"
uid="uid://bq0nyj1m4id7o"
path="res://.godot/imported/Candy Demo.otf-b82ed4d6dbc76bc30f743fa743eece56.fontdata"
[deps]
source_file="res://fonts/Candy Demo.otf"
dest_files=["res://.godot/imported/Candy Demo.otf-b82ed4d6dbc76bc30f743fa743eece56.fontdata"]
[params]
Rendering=null
antialiasing=1
generate_mipmaps=false
multichannel_signed_distance_field=false
msdf_pixel_range=8
msdf_size=48
allow_system_fallback=true
force_autohinter=false
hinting=1
subpixel_positioning=1
oversampling=0.0
Fallbacks=null
fallbacks=[]
Compress=null
compress=true
preload=[]
language_support={}
script_support={}
opentype_features={}

BIN
fonts/Candy Demo.ttf Normal file

Binary file not shown.

View File

@@ -0,0 +1,33 @@
[remap]
importer="font_data_dynamic"
type="FontFile"
uid="uid://dxsjw0432epve"
path="res://.godot/imported/Candy Demo.ttf-b91de04578e8e82ab29fa5db62ce05ac.fontdata"
[deps]
source_file="res://fonts/Candy Demo.ttf"
dest_files=["res://.godot/imported/Candy Demo.ttf-b91de04578e8e82ab29fa5db62ce05ac.fontdata"]
[params]
Rendering=null
antialiasing=1
generate_mipmaps=false
multichannel_signed_distance_field=false
msdf_pixel_range=8
msdf_size=48
allow_system_fallback=true
force_autohinter=false
hinting=1
subpixel_positioning=1
oversampling=0.0
Fallbacks=null
fallbacks=[]
Compress=null
compress=true
preload=[]
language_support={}
script_support={}
opentype_features={}

9
fonts/dialog.tres Normal file
View File

@@ -0,0 +1,9 @@
[gd_resource type="FontFile" load_steps=2 format=2]
[ext_resource path="res://fonts/Candy Demo.otf" type="FontFile" id=1]
[resource]
size = 32
use_filter = true
extra_spacing_top = -3
font_data = ExtResource( 1 )

9
fonts/stats.tres Normal file
View File

@@ -0,0 +1,9 @@
[gd_resource type="FontFile" load_steps=2 format=2]
[ext_resource path="res://fonts/Candy Demo.otf" type="FontFile" id=1]
[resource]
size = 24
use_filter = true
extra_spacing_top = -3
font_data = ExtResource( 1 )

1
icon.svg Normal file
View File

@@ -0,0 +1 @@
<svg height="128" width="128" xmlns="http://www.w3.org/2000/svg"><g transform="translate(32 32)"><path d="m-16-32c-8.86 0-16 7.13-16 15.99v95.98c0 8.86 7.13 15.99 16 15.99h96c8.86 0 16-7.13 16-15.99v-95.98c0-8.85-7.14-15.99-16-15.99z" fill="#363d52"/><path d="m-16-32c-8.86 0-16 7.13-16 15.99v95.98c0 8.86 7.13 15.99 16 15.99h96c8.86 0 16-7.13 16-15.99v-95.98c0-8.85-7.14-15.99-16-15.99zm0 4h96c6.64 0 12 5.35 12 11.99v95.98c0 6.64-5.35 11.99-12 11.99h-96c-6.64 0-12-5.35-12-11.99v-95.98c0-6.64 5.36-11.99 12-11.99z" fill-opacity=".4"/></g><g stroke-width="9.92746" transform="matrix(.10073078 0 0 .10073078 12.425923 2.256365)"><path d="m0 0s-.325 1.994-.515 1.976l-36.182-3.491c-2.879-.278-5.115-2.574-5.317-5.459l-.994-14.247-27.992-1.997-1.904 12.912c-.424 2.872-2.932 5.037-5.835 5.037h-38.188c-2.902 0-5.41-2.165-5.834-5.037l-1.905-12.912-27.992 1.997-.994 14.247c-.202 2.886-2.438 5.182-5.317 5.46l-36.2 3.49c-.187.018-.324-1.978-.511-1.978l-.049-7.83 30.658-4.944 1.004-14.374c.203-2.91 2.551-5.263 5.463-5.472l38.551-2.75c.146-.01.29-.016.434-.016 2.897 0 5.401 2.166 5.825 5.038l1.959 13.286h28.005l1.959-13.286c.423-2.871 2.93-5.037 5.831-5.037.142 0 .284.005.423.015l38.556 2.75c2.911.209 5.26 2.562 5.463 5.472l1.003 14.374 30.645 4.966z" fill="#fff" transform="matrix(4.162611 0 0 -4.162611 919.24059 771.67186)"/><path d="m0 0v-47.514-6.035-5.492c.108-.001.216-.005.323-.015l36.196-3.49c1.896-.183 3.382-1.709 3.514-3.609l1.116-15.978 31.574-2.253 2.175 14.747c.282 1.912 1.922 3.329 3.856 3.329h38.188c1.933 0 3.573-1.417 3.855-3.329l2.175-14.747 31.575 2.253 1.115 15.978c.133 1.9 1.618 3.425 3.514 3.609l36.182 3.49c.107.01.214.014.322.015v4.711l.015.005v54.325c5.09692 6.4164715 9.92323 13.494208 13.621 19.449-5.651 9.62-12.575 18.217-19.976 26.182-6.864-3.455-13.531-7.369-19.828-11.534-3.151 3.132-6.7 5.694-10.186 8.372-3.425 2.751-7.285 4.768-10.946 7.118 1.09 8.117 1.629 16.108 1.846 24.448-9.446 4.754-19.519 7.906-29.708 10.17-4.068-6.837-7.788-14.241-11.028-21.479-3.842.642-7.702.88-11.567.926v.006c-.027 0-.052-.006-.075-.006-.024 0-.049.006-.073.006v-.006c-3.872-.046-7.729-.284-11.572-.926-3.238 7.238-6.956 14.642-11.03 21.479-10.184-2.264-20.258-5.416-29.703-10.17.216-8.34.755-16.331 1.848-24.448-3.668-2.35-7.523-4.367-10.949-7.118-3.481-2.678-7.036-5.24-10.188-8.372-6.297 4.165-12.962 8.079-19.828 11.534-7.401-7.965-14.321-16.562-19.974-26.182 4.4426579-6.973692 9.2079702-13.9828876 13.621-19.449z" fill="#478cbf" transform="matrix(4.162611 0 0 -4.162611 104.69892 525.90697)"/><path d="m0 0-1.121-16.063c-.135-1.936-1.675-3.477-3.611-3.616l-38.555-2.751c-.094-.007-.188-.01-.281-.01-1.916 0-3.569 1.406-3.852 3.33l-2.211 14.994h-31.459l-2.211-14.994c-.297-2.018-2.101-3.469-4.133-3.32l-38.555 2.751c-1.936.139-3.476 1.68-3.611 3.616l-1.121 16.063-32.547 3.138c.015-3.498.06-7.33.06-8.093 0-34.374 43.605-50.896 97.781-51.086h.066.067c54.176.19 97.766 16.712 97.766 51.086 0 .777.047 4.593.063 8.093z" fill="#478cbf" transform="matrix(4.162611 0 0 -4.162611 784.07144 817.24284)"/><path d="m0 0c0-12.052-9.765-21.815-21.813-21.815-12.042 0-21.81 9.763-21.81 21.815 0 12.044 9.768 21.802 21.81 21.802 12.048 0 21.813-9.758 21.813-21.802" fill="#fff" transform="matrix(4.162611 0 0 -4.162611 389.21484 625.67104)"/><path d="m0 0c0-7.994-6.479-14.473-14.479-14.473-7.996 0-14.479 6.479-14.479 14.473s6.483 14.479 14.479 14.479c8 0 14.479-6.485 14.479-14.479" fill="#414042" transform="matrix(4.162611 0 0 -4.162611 367.36686 631.05679)"/><path d="m0 0c-3.878 0-7.021 2.858-7.021 6.381v20.081c0 3.52 3.143 6.381 7.021 6.381s7.028-2.861 7.028-6.381v-20.081c0-3.523-3.15-6.381-7.028-6.381" fill="#fff" transform="matrix(4.162611 0 0 -4.162611 511.99336 724.73954)"/><path d="m0 0c0-12.052 9.765-21.815 21.815-21.815 12.041 0 21.808 9.763 21.808 21.815 0 12.044-9.767 21.802-21.808 21.802-12.05 0-21.815-9.758-21.815-21.802" fill="#fff" transform="matrix(4.162611 0 0 -4.162611 634.78706 625.67104)"/><path d="m0 0c0-7.994 6.477-14.473 14.471-14.473 8.002 0 14.479 6.479 14.479 14.473s-6.477 14.479-14.479 14.479c-7.994 0-14.471-6.485-14.471-14.479" fill="#414042" transform="matrix(4.162611 0 0 -4.162611 656.64056 631.05679)"/></g></svg>

After

Width:  |  Height:  |  Size: 4.1 KiB

37
icon.svg.import Normal file
View File

@@ -0,0 +1,37 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://b4jy3cynf4voa"
path="res://.godot/imported/icon.svg-218a8f2b3041327d8a5756f3a245f83b.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://icon.svg"
dest_files=["res://.godot/imported/icon.svg-218a8f2b3041327d8a5756f3a245f83b.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
svg/scale=1.0
editor/scale_with_editor_scale=false
editor/convert_colors_with_editor_theme=false

Binary file not shown.

After

Width:  |  Height:  |  Size: 48 KiB

View File

@@ -0,0 +1,34 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://b2vis61tr0j0j"
path="res://.godot/imported/gitpreview.png-ec153c306c5152ca4b5b1f0cefb68e3c.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://joystick/previews/gitpreview.png"
dest_files=["res://.godot/imported/gitpreview.png-ec153c306c5152ca4b5b1f0cefb68e3c.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

BIN
joystick/previews/icon.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

View File

@@ -0,0 +1,34 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://dqlnk87ubowrk"
path="res://.godot/imported/icon.png-324c050649ddbd50ea0d7a9cc738a782.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://joystick/previews/icon.png"
dest_files=["res://.godot/imported/icon.png-324c050649ddbd50ea0d7a9cc738a782.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

Binary file not shown.

After

Width:  |  Height:  |  Size: 49 KiB

View File

@@ -0,0 +1,34 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://0xvr5pp3p3ab"
path="res://.godot/imported/preview1.png-d4c4e981b042b85f31fe17ca28e82247.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://joystick/previews/preview1.png"
dest_files=["res://.godot/imported/preview1.png-d4c4e981b042b85f31fe17ca28e82247.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

Binary file not shown.

After

Width:  |  Height:  |  Size: 31 KiB

View File

@@ -0,0 +1,34 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://cdetlhwaywl5l"
path="res://.godot/imported/preview2.png-81dc3b7e24520b798753905eeb475d3a.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://joystick/previews/preview2.png"
dest_files=["res://.godot/imported/preview2.png-81dc3b7e24520b798753905eeb475d3a.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

Binary file not shown.

After

Width:  |  Height:  |  Size: 96 KiB

View File

@@ -0,0 +1,34 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://7i3tk35p2d3g"
path="res://.godot/imported/preview3.png-388abb38ce4b6197827ca76ef0b2e8de.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://joystick/previews/preview3.png"
dest_files=["res://.godot/imported/preview3.png-388abb38ce4b6197827ca76ef0b2e8de.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

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.7 KiB

View File

@@ -0,0 +1,34 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://bm30au8mjfc2f"
path="res://.godot/imported/joystick_base_outline.png-483e8f1ac02a5b9a594f81d7e341a76f.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://joystick/textures/joystick_base_outline.png"
dest_files=["res://.godot/imported/joystick_base_outline.png-483e8f1ac02a5b9a594f81d7e341a76f.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

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

View File

@@ -0,0 +1,34 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://bkvmydfn5saxg"
path="res://.godot/imported/joystick_tip.png-3a18c9ea76fb1ca4d2905a9a7401093a.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://joystick/textures/joystick_tip.png"
dest_files=["res://.godot/imported/joystick_tip.png-3a18c9ea76fb1ca4d2905a9a7401093a.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

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

View File

@@ -0,0 +1,34 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://dt13r06u87fib"
path="res://.godot/imported/joystick_tip_arrows.png-c9482441a78cf839baf32238aae88b91.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://joystick/textures/joystick_tip_arrows.png"
dest_files=["res://.godot/imported/joystick_tip_arrows.png-c9482441a78cf839baf32238aae88b91.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

View File

@@ -0,0 +1,165 @@
class_name VirtualJoystick
extends Control
## A simple virtual joystick for touchscreens, with useful options.
## Github: https://github.com/MarcoFazioRandom/Virtual-Joystick-Godot
# EXPORTED VARIABLE
## The color of the button when the joystick is pressed.
@export var pressed_color := Color.GRAY
## If the input is inside this range, the output is zero.
@export_range(0, 200, 1) var deadzone_size : float = 10
## The max distance the tip can reach.
@export_range(0, 500, 1) var clampzone_size : float = 75
enum Joystick_mode {
FIXED, ## The joystick doesn't move.
DYNAMIC, ## Every time the joystick area is pressed, the joystick position is set on the touched position.
FOLLOWING ## When the finger moves outside the joystick area, the joystick will follow it.
}
## If the joystick stays in the same position or appears on the touched position when touch is started
@export var joystick_mode := Joystick_mode.FIXED
enum Visibility_mode {
ALWAYS, ## Always visible
TOUCHSCREEN_ONLY ## Visible on touch screens only
}
## If the joystick is always visible, or is shown only if there is a touchscreen
@export var visibility_mode := Visibility_mode.ALWAYS
## If true, the joystick uses Input Actions (Project -> Project Settings -> Input Map)
@export var use_input_actions := true
@export var action_left := "ui_left"
@export var action_right := "ui_right"
@export var action_up := "ui_up"
@export var action_down := "ui_down"
# PUBLIC VARIABLES
## If the joystick is receiving inputs.
var is_pressed := false
# The joystick output.
var output := Vector2.ZERO
# PRIVATE VARIABLES
var _touch_index : int = -1
@onready var _base := $Base
@onready var _tip := $Base/Tip
@onready var _base_default_position : Vector2 = _base.position
@onready var _tip_default_position : Vector2 = _tip.position
@onready var _default_color : Color = _tip.modulate
# FUNCTIONS
func _ready() -> void:
if not DisplayServer.is_touchscreen_available() and visibility_mode == Visibility_mode.TOUCHSCREEN_ONLY:
hide()
func _input(event: InputEvent) -> void:
if event is InputEventScreenTouch:
if event.pressed:
if _is_point_inside_joystick_area(event.position) and _touch_index == -1:
if joystick_mode == Joystick_mode.DYNAMIC or joystick_mode == Joystick_mode.FOLLOWING or (joystick_mode == Joystick_mode.FIXED and _is_point_inside_base(event.position)):
if joystick_mode == Joystick_mode.DYNAMIC or joystick_mode == Joystick_mode.FOLLOWING:
_move_base(event.position)
_touch_index = event.index
_tip.modulate = pressed_color
_update_joystick(event.position)
get_viewport().set_input_as_handled()
elif event.index == _touch_index:
_reset()
get_viewport().set_input_as_handled()
elif event is InputEventScreenDrag:
if event.index == _touch_index:
_update_joystick(event.position)
get_viewport().set_input_as_handled()
func _move_base(new_position: Vector2) -> void:
_base.global_position = new_position - _base.pivot_offset * get_global_transform_with_canvas().get_scale()
func _move_tip(new_position: Vector2) -> void:
_tip.global_position = new_position - _tip.pivot_offset * _base.get_global_transform_with_canvas().get_scale()
func _is_point_inside_joystick_area(point: Vector2) -> bool:
var x: bool = point.x >= global_position.x and point.x <= global_position.x + (size.x * get_global_transform_with_canvas().get_scale().x)
var y: bool = point.y >= global_position.y and point.y <= global_position.y + (size.y * get_global_transform_with_canvas().get_scale().y)
return x and y
func _get_base_radius() -> Vector2:
return _base.size * _base.get_global_transform_with_canvas().get_scale() / 2
func _is_point_inside_base(point: Vector2) -> bool:
var _base_radius = _get_base_radius()
var center : Vector2 = _base.global_position + _base_radius
var vector : Vector2 = point - center
if vector.length_squared() <= _base_radius.x * _base_radius.x:
return true
else:
return false
func _update_joystick(touch_position: Vector2) -> void:
var _base_radius = _get_base_radius()
var center : Vector2 = _base.global_position + _base_radius
var vector : Vector2 = touch_position - center
vector = vector.limit_length(clampzone_size)
if joystick_mode == Joystick_mode.FOLLOWING and touch_position.distance_to(center) > clampzone_size:
_move_base(touch_position - vector)
_move_tip(center + vector)
if vector.length_squared() > deadzone_size * deadzone_size:
is_pressed = true
output = (vector - (vector.normalized() * deadzone_size)) / (clampzone_size - deadzone_size)
else:
is_pressed = false
output = Vector2.ZERO
if use_input_actions:
if output.x > 0:
if Input.is_action_pressed(action_left):
Input.action_release(action_left)
_update_input_action(action_right, output.x)
else:
if Input.is_action_pressed(action_right):
Input.action_release(action_right)
_update_input_action(action_left, -output.x)
if output.y > 0:
if Input.is_action_pressed(action_up):
Input.action_release(action_up)
_update_input_action(action_down, output.y)
else:
if Input.is_action_pressed(action_down):
Input.action_release(action_down)
_update_input_action(action_up, -output.y)
func _update_input_action(action:String, value:float):
if value > InputMap.action_get_deadzone(action):
Input.action_press(action, value)
elif Input.is_action_pressed(action):
Input.action_release(action)
func _reset():
is_pressed = false
output = Vector2.ZERO
_touch_index = -1
_tip.modulate = _default_color
_base.position = _base_default_position
_tip.position = _tip_default_position
if use_input_actions:
for action in [action_left, action_right, action_down, action_up]:
if Input.is_action_pressed(action) or Input.is_action_just_pressed(action):
Input.action_release(action)

View File

@@ -0,0 +1,51 @@
[gd_scene load_steps=4 format=3 uid="uid://dmr0fcamx7t56"]
[ext_resource type="Script" path="res://joystick/virtual_joystick.gd" id="1_8x4dy"]
[ext_resource type="Texture2D" uid="uid://bm30au8mjfc2f" path="res://joystick/textures/joystick_base_outline.png" id="2_jhjs2"]
[ext_resource type="Texture2D" uid="uid://dt13r06u87fib" path="res://joystick/textures/joystick_tip_arrows.png" id="3_3etdg"]
[node name="Virtual Joystick" type="Control"]
layout_mode = 3
anchors_preset = 2
anchor_top = 1.0
anchor_bottom = 1.0
offset_top = -308.0
offset_right = 300.0
offset_bottom = -8.0
grow_vertical = 0
script = ExtResource("1_8x4dy")
[node name="Base" type="TextureRect" parent="."]
layout_mode = 1
anchors_preset = 8
anchor_left = 0.5
anchor_top = 0.5
anchor_right = 0.5
anchor_bottom = 0.5
offset_left = -100.0
offset_top = -100.0
offset_right = 100.0
offset_bottom = 100.0
grow_horizontal = 2
grow_vertical = 2
pivot_offset = Vector2(100, 100)
mouse_force_pass_scroll_events = false
texture = ExtResource("2_jhjs2")
stretch_mode = 5
[node name="Tip" type="TextureRect" parent="Base"]
layout_mode = 1
anchors_preset = 8
anchor_left = 0.5
anchor_top = 0.5
anchor_right = 0.5
anchor_bottom = 0.5
offset_left = -50.0
offset_top = -50.0
offset_right = 50.0
offset_bottom = 50.0
grow_horizontal = 2
grow_vertical = 2
pivot_offset = Vector2(50, 50)
texture = ExtResource("3_3etdg")
stretch_mode = 5

Binary file not shown.

View File

@@ -0,0 +1,19 @@
[remap]
importer="oggvorbisstr"
type="AudioStreamOggVorbis"
uid="uid://c0q17pglcb2w6"
path="res://.godot/imported/310-world-map-loop.ogg-6a6b9a1c7fc346ec31c4245cf35d0469.oggvorbisstr"
[deps]
source_file="res://music/310-world-map-loop.ogg"
dest_files=["res://.godot/imported/310-world-map-loop.ogg-6a6b9a1c7fc346ec31c4245cf35d0469.oggvorbisstr"]
[params]
loop=true
loop_offset=0
bpm=0
beat_count=0
bar_beats=4

BIN
music/a-2-3-groovy-bgm.ogg Normal file

Binary file not shown.

View File

@@ -0,0 +1,19 @@
[remap]
importer="oggvorbisstr"
type="AudioStreamOggVorbis"
uid="uid://trlrbhagbe3s"
path="res://.godot/imported/a-2-3-groovy-bgm.ogg-078f4206b386dc8622fcdf96bc2459fc.oggvorbisstr"
[deps]
source_file="res://music/a-2-3-groovy-bgm.ogg"
dest_files=["res://.godot/imported/a-2-3-groovy-bgm.ogg-078f4206b386dc8622fcdf96bc2459fc.oggvorbisstr"]
[params]
loop=true
loop_offset=0
bpm=0
beat_count=0
bar_beats=4

BIN
music/logo.wav Normal file

Binary file not shown.

24
music/logo.wav.import Normal file
View File

@@ -0,0 +1,24 @@
[remap]
importer="wav"
type="AudioStreamWAV"
uid="uid://bub2p8fvv46yx"
path="res://.godot/imported/logo.wav-2399cc045034add6fef47360adc2af5d.sample"
[deps]
source_file="res://music/logo.wav"
dest_files=["res://.godot/imported/logo.wav-2399cc045034add6fef47360adc2af5d.sample"]
[params]
force/8_bit=false
force/mono=false
force/max_rate=false
force/max_rate_hz=44100
edit/trim=false
edit/normalize=false
edit/loop_mode=0
edit/loop_begin=0
edit/loop_end=-1
compress/mode=0

99
project.godot Normal file
View File

@@ -0,0 +1,99 @@
; Engine configuration file.
; It's best edited using the editor UI and not directly,
; since the parameters that go here are not all obvious.
;
; Format:
; [section] ; section goes between []
; param=value ; assign values to parameters
config_version=5
[application]
config/name="YFinGames - Reactive Wave"
run/main_scene="res://scenes/levels/TestLevel.tscn"
config/use_custom_user_dir=true
config/features=PackedStringArray("4.2")
config/icon="res://icon.svg"
[autoload]
Music="*res://singletons/Music.tscn"
Dialogs="*res://singletons/Dialogs.gd"
Inventory="*res://singletons/Inventory.gd"
Quest="*res://singletons/Quest.gd"
Globals="*res://singletons/Globals.gd"
[debug]
gdscript/warnings/return_value_discarded=false
[display]
window/stretch/mode="2d"
[editor]
version_control/plugin_name="GitPlugin"
version_control/autoload_on_startup=true
[input]
move_up={
"deadzone": 0.5,
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":4194320,"physical_keycode":4194320,"key_label":4194320,"unicode":0,"echo":false,"script":null)
, Object(InputEventJoypadMotion,"resource_local_to_scene":false,"resource_name":"","device":0,"axis":1,"axis_value":-1.0,"script":null)
, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":0,"button_index":11,"pressure":0.0,"pressed":false,"script":null)
]
}
move_left={
"deadzone": 0.5,
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":4194319,"physical_keycode":0,"key_label":0,"unicode":0,"echo":false,"script":null)
, Object(InputEventJoypadMotion,"resource_local_to_scene":false,"resource_name":"","device":0,"axis":0,"axis_value":-1.0,"script":null)
, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":0,"button_index":13,"pressure":0.0,"pressed":false,"script":null)
]
}
move_down={
"deadzone": 0.5,
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":4194322,"physical_keycode":0,"key_label":0,"unicode":0,"echo":false,"script":null)
, Object(InputEventJoypadMotion,"resource_local_to_scene":false,"resource_name":"","device":0,"axis":1,"axis_value":1.0,"script":null)
, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":0,"button_index":12,"pressure":0.0,"pressed":false,"script":null)
]
}
move_right={
"deadzone": 0.5,
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":4194321,"physical_keycode":0,"key_label":0,"unicode":0,"echo":false,"script":null)
, Object(InputEventJoypadMotion,"resource_local_to_scene":false,"resource_name":"","device":0,"axis":0,"axis_value":1.0,"script":null)
, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":0,"button_index":14,"pressure":0.0,"pressed":false,"script":null)
]
}
attack={
"deadzone": 0.5,
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":4194326,"physical_keycode":0,"key_label":0,"unicode":0,"echo":false,"script":null)
, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":0,"button_index":2,"pressure":0.0,"pressed":false,"script":null)
]
}
roll={
"deadzone": 0.5,
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":32,"physical_keycode":0,"key_label":0,"unicode":0,"echo":false,"script":null)
, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":0,"button_index":0,"pressure":0.0,"pressed":false,"script":null)
]
}
interact={
"deadzone": 0.5,
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":69,"physical_keycode":0,"key_label":0,"unicode":0,"echo":false,"script":null)
, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":0,"button_index":1,"pressure":0.0,"pressed":false,"script":null)
]
}
pause={
"deadzone": 0.5,
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":4194305,"physical_keycode":0,"key_label":0,"unicode":0,"echo":false,"script":null)
, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":0,"button_index":6,"pressure":0.0,"pressed":false,"script":null)
]
}
[rendering]
renderer/rendering_method="gl_compatibility"
textures/vram_compression/import_etc2_astc=true
environment/defaults/default_environment="res://default_env.tres"

View File

@@ -0,0 +1,8 @@
extends CPUParticles2D
func _ready():
emitting = true
await get_tree().create_timer(0.8).timeout
queue_free()
pass # Replace with function body.

135
scenes/characters/Enemy.gd Normal file
View File

@@ -0,0 +1,135 @@
extends CharacterBody2D
class_name Enemy
"""
This implements a very rudimentary state machine. There are better implementations
in the AssetLib if you want to make something more complex. Also it shares code with Enemy.gd
and probably both should extend some parent script
"""
@export var WALK_SPEED: int = 350
@export var ROLL_SPEED: int = 1000
@export var hitpoints: int = 3
var despawn_fx = preload("res://scenes/misc/DespawnFX.tscn")
var linear_vel = Vector2()
@export var facing = "down" # (String, "up", "down", "left", "right")
var anim = ""
var new_anim = ""
enum { STATE_IDLE, STATE_WALKING, STATE_ATTACK, STATE_ROLL, STATE_DIE, STATE_HURT }
var state = STATE_IDLE
func _ready():
randomize()
func _physics_process(_delta):
match state:
STATE_IDLE:
new_anim = "idle_" + facing
STATE_WALKING:
set_velocity(linear_vel)
move_and_slide()
linear_vel = velocity
var target_speed = Vector2()
if facing == "down":
target_speed += Vector2.DOWN
if facing == "left":
target_speed += Vector2.LEFT
if facing == "right":
target_speed += Vector2.RIGHT
if facing == "up":
target_speed += Vector2.UP
target_speed *= WALK_SPEED
linear_vel = linear_vel.lerp(target_speed, 0.9)
new_anim = ""
if abs(linear_vel.x) > abs(linear_vel.y):
if linear_vel.x < 0:
facing = "left"
if linear_vel.x > 0:
facing = "right"
if abs(linear_vel.y) > abs(linear_vel.x):
if linear_vel.y < 0:
facing = "up"
if linear_vel.y > 0:
facing = "down"
if linear_vel != Vector2.ZERO:
new_anim = "walk_" + facing
else:
state = STATE_IDLE
pass
STATE_ATTACK:
new_anim = "slash_" + facing
pass
STATE_ROLL:
set_velocity(linear_vel)
move_and_slide()
linear_vel = velocity
var target_speed = Vector2()
if facing == "up":
target_speed.y = -1
if facing == "down":
target_speed.y = 1
if facing == "left":
target_speed.x = -1
if facing == "right":
target_speed.x = 1
target_speed *= ROLL_SPEED
linear_vel = linear_vel.lerp(target_speed, 0.9)
new_anim = "roll"
pass
STATE_DIE:
new_anim = "die"
STATE_HURT:
new_anim = "hurt"
if new_anim != anim:
anim = new_anim
$anims.play(anim)
pass
func goto_idle():
state = STATE_IDLE
func _on_state_changer_timeout():
$state_changer.wait_time = randf_range(1.0, 5.0)
#state = randi() %3
state = STATE_ATTACK
facing = ["left", "right", "up", "down"][randi()%3]
pass # Replace with function body.
func _on_hurtbox_area_entered(area):
if state != STATE_DIE and area.name == "player_sword":
hitpoints -= 1
var pushback_direction = (global_position - area.global_position).normalized()
set_velocity(pushback_direction * 5000)
move_and_slide()
state = STATE_HURT
$state_changer.start()
if hitpoints <= 0:
$state_changer.stop()
state = STATE_DIE
pass # Replace with function body.
func despawn():
var despawn_particles = despawn_fx.instantiate()
get_parent().add_child(despawn_particles)
despawn_particles.global_position = global_position
if has_node("item_spawner"):
get_node("item_spawner").spawn()
queue_free()
pass

1226
scenes/characters/Enemy.tscn Normal file

File diff suppressed because it is too large Load Diff

54
scenes/characters/Npc.gd Normal file
View File

@@ -0,0 +1,54 @@
extends Area2D
"""
It just wraps around a sequence of dialogs. If it contains a child node named 'Quest'
which should be an instance of Quest.gd it'll become a quest giver and show whatever
text Quest.process() returns
"""
var active = false
@export var character_name: String = "Nameless NPC"
@export var dialogs = ["..."] # (Array, String, MULTILINE)
var current_dialog = 0
# Called when the node enters the scene tree for the first time.
func _ready():
randomize()
# warning-ignore:return_value_discarded
body_entered.connect(_on_body_entered)
# warning-ignore:return_value_discarded
body_exited.connect(_on_body_exited)
pass # Replace with function body.
func _input(event):
# Bail if npc not active (player not inside the collider)
if not active:
return
# Bail if Dialogs singleton is showing another dialog
if Dialogs.active:
return
# Bail if the event is not a pressed "interact" action
if not event.is_action_pressed("interact"):
return
# If the character is a questgiver delegate getting the text
# to the Quest node, show it and end the function
if has_node("Quest"):
var quest_dialog = get_node("Quest").process()
if quest_dialog != "":
Dialogs.show_dialog(quest_dialog, character_name)
return
# If we reached here and there are generic dialogs to show, rotate among them
if not dialogs.is_empty():
Dialogs.show_dialog(dialogs[current_dialog], character_name)
current_dialog = wrapi(current_dialog + 1, 0, dialogs.size())
func _on_body_entered(body):
if body is Player:
active = true
func _on_body_exited(body):
if body is Player:
active = false

View File

@@ -0,0 +1,57 @@
[gd_scene load_steps=5 format=3 uid="uid://b7p1kli4j11fo"]
[ext_resource type="Script" path="res://scenes/characters/Npc.gd" id="1"]
[sub_resource type="Animation" id="1"]
resource_name = "idle"
length = 2.0
loop_mode = 1
tracks/0/type = "value"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath("sprite:position")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/keys = {
"times": PackedFloat32Array(0, 1),
"transitions": PackedFloat32Array(1, 1),
"update": 0,
"values": [Vector2(0.564087, 2.50995), Vector2(0.564087, 4.44937)]
}
tracks/1/type = "value"
tracks/1/imported = false
tracks/1/enabled = true
tracks/1/path = NodePath("sprite:scale")
tracks/1/interp = 1
tracks/1/loop_wrap = true
tracks/1/keys = {
"times": PackedFloat32Array(0, 1),
"transitions": PackedFloat32Array(1, 1),
"update": 0,
"values": [Vector2(1, 1), Vector2(1, 0.944064)]
}
[sub_resource type="AnimationLibrary" id="AnimationLibrary_k00qb"]
_data = {
"idle": SubResource("1")
}
[sub_resource type="RectangleShape2D" id="2"]
size = Vector2(163.651, 144.825)
[node name="NPC" type="Area2D"]
script = ExtResource("1")
[node name="sprite" type="Sprite2D" parent="."]
position = Vector2(0.564087, 2.50995)
offset = Vector2(3.3446, -93.3282)
[node name="anims" type="AnimationPlayer" parent="."]
libraries = {
"": SubResource("AnimationLibrary_k00qb")
}
autoplay = "idle"
[node name="trigger" type="CollisionShape2D" parent="."]
position = Vector2(0, 88.8296)
shape = SubResource("2")

203
scenes/characters/Player.gd Normal file
View File

@@ -0,0 +1,203 @@
extends CharacterBody2D
class_name Player
"""
This implements a very rudimentary state machine. There are better implementations
in the AssetLib if you want to make something more complex. Also it shares code with Enemy.gd
and probably both should extend some parent script
"""
@export var WALK_SPEED: int = 70 # pixels per second
@export var ROLL_SPEED: int = 1000 # pixels per second
@export var hitpoints: int = 3
var linear_vel = Vector2()
var roll_direction = Vector2.DOWN
signal health_changed(current_hp)
var despawn_fx = preload("res://scenes/misc/DespawnFX.tscn")
var anim = ""
var new_anim = ""
const N = Vector2.UP
const NE = Vector2(cos(1*PI/4),sin(1*PI/4))
const E = Vector2.RIGHT
const SE = Vector2(cos(7*PI/4),sin(7*PI/4))
const S = Vector2.DOWN
const SW = Vector2(cos(5*PI/4),sin(5*PI/4))
const W = Vector2.LEFT
const NW = Vector2(cos(3*PI/4),sin(3*PI/4))
enum { STATE_BLOCKED, STATE_IDLE, STATE_WALKING, STATE_ATTACK, STATE_ROLL, STATE_DIE, STATE_HURT }
@export var facing = "S" # (String, "up", "down", "left", "right")
var state = STATE_IDLE
var direction = S
# Move the player to the corresponding spawnpoint, if any and connect to the dialog system
func _ready():
var spawnpoints = get_tree().get_nodes_in_group("spawnpoints")
for spawnpoint in spawnpoints:
if spawnpoint.name == Globals.spawnpoint:
global_position = spawnpoint.global_position
break
if not (
Dialogs.dialog_started.connect(_on_dialog_started) == OK and
Dialogs.dialog_ended.connect(_on_dialog_ended) == OK ):
printerr("Error connecting to dialog system")
pass
func _physics_process(_delta):
## PROCESS STATES
match state:
STATE_BLOCKED:
# new_anim = "idle_" + facing
$anims.stop()
pass
STATE_IDLE:
if (
Input.is_action_pressed("move_down") or
Input.is_action_pressed("move_left") or
Input.is_action_pressed("move_right") or
Input.is_action_pressed("move_up")
):
state = STATE_WALKING
if Input.is_action_just_pressed("attack"):
state = STATE_ATTACK
# if Input.is_action_just_pressed("roll"):
# state = STATE_ROLL
# roll_direction = Vector2(
# - int( Input.is_action_pressed("move_left") ) + int( Input.is_action_pressed("move_right") ),
# -int( Input.is_action_pressed("move_up") ) + int( Input.is_action_pressed("move_down") )
# ).normalized()
# _update_facing()
# new_anim = "idle_" + facing
$anims.stop()
pass
STATE_WALKING:
if Input.is_action_just_pressed("attack"):
state = STATE_ATTACK
if Input.is_action_just_pressed("roll"):
state = STATE_ROLL
linear_vel = velocity
var target_speed = Vector2(0,0)
if Input.is_action_pressed("move_down"):
target_speed += Vector2.DOWN
if Input.is_action_pressed("move_left"):
target_speed += Vector2.LEFT
if Input.is_action_pressed("move_right"):
target_speed += Vector2.RIGHT
if Input.is_action_pressed("move_up"):
target_speed += Vector2.UP
target_speed = target_speed.normalized() * WALK_SPEED
target_speed.y *= 0.50 # compensa visione isometrica
#linear_vel = linear_vel.linear_interpolate(target_speed, 0.9)
linear_vel = target_speed
set_velocity(linear_vel)
roll_direction = linear_vel.normalized()
move_and_slide()
_update_facing()
if linear_vel.length() > 5:
new_anim = "walk_" + facing
$anims.play()
else:
goto_idle()
pass
STATE_ATTACK:
new_anim = "walk_" + facing # was splash_
pass
STATE_ROLL:
if roll_direction == Vector2.ZERO:
state = STATE_IDLE
else:
set_velocity(linear_vel)
move_and_slide()
linear_vel = velocity
var target_speed = Vector2()
target_speed = roll_direction
target_speed *= ROLL_SPEED
#linear_vel = linear_vel.linear_interpolate(target_speed, 0.9)
linear_vel = target_speed
new_anim = "roll"
STATE_DIE:
new_anim = "die"
STATE_HURT:
new_anim = "hurt"
## UPDATE ANIMATION
if new_anim != anim:
anim = new_anim
$anims.play(anim)
pass
func _on_dialog_started():
state = STATE_BLOCKED
func _on_dialog_ended():
state = STATE_IDLE
## HELPER FUNCS
func goto_idle():
linear_vel = Vector2.ZERO
# new_anim = "idle_" + facing
state = STATE_IDLE
func _update_facing():
if Input.is_action_pressed("move_left"):
facing = "W"
if Input.is_action_pressed("move_right"):
facing = "E"
if Input.is_action_pressed("move_up"):
facing = "N"
if Input.is_action_pressed("move_left"):
facing = "NW"
if Input.is_action_pressed("move_right"):
facing = "NE"
if Input.is_action_pressed("move_down"):
facing = "S"
if Input.is_action_pressed("move_left"):
facing = "SW"
if Input.is_action_pressed("move_right"):
facing = "SE"
func despawn():
var despawn_particles = despawn_fx.instantiate()
get_parent().add_child(despawn_particles)
despawn_particles.global_position = global_position
hide()
await get_tree().create_timer(5.0).timeout
get_tree().reload_current_scene()
pass
func _on_hurtbox_area_entered(area):
if state != STATE_DIE and area.is_in_group("enemy_weapons"):
hitpoints -= 1
emit_signal("health_changed", hitpoints)
var pushback_direction = (global_position - area.global_position).normalized()
set_velocity(pushback_direction * 5000)
move_and_slide()
state = STATE_HURT
if hitpoints <= 0:
state = STATE_DIE
pass

View File

@@ -0,0 +1,806 @@
[gd_scene load_steps=27 format=3 uid="uid://ctd3mgp0s172q"]
[ext_resource type="Script" path="res://scenes/characters/Player.gd" id="2"]
[ext_resource type="Texture2D" uid="uid://3au1pfa7jj5l" path="res://textures/kid/kid.png" id="2_rhd3n"]
[ext_resource type="PackedScene" path="res://scenes/characters/debug_character.tscn" id="3"]
[sub_resource type="CapsuleShape2D" id="1"]
radius = 9.00003
height = 42.119
[sub_resource type="Animation" id="2"]
resource_name = "die"
tracks/0/type = "value"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath("sprite:frame")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/keys = {
"times": PackedFloat32Array(0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8),
"transitions": PackedFloat32Array(1, 1, 1, 1, 1, 1, 1, 1, 1),
"update": 1,
"values": [9, 11, 13, 12, 9, 11, 13, 12, 9]
}
tracks/1/type = "value"
tracks/1/imported = false
tracks/1/enabled = true
tracks/1/path = NodePath("sprite:flip_h")
tracks/1/interp = 1
tracks/1/loop_wrap = true
tracks/1/keys = {
"times": PackedFloat32Array(0, 0.2, 0.4, 0.7),
"transitions": PackedFloat32Array(1, 1, 1, 1),
"update": 1,
"values": [true, false, true, false]
}
tracks/2/type = "method"
tracks/2/imported = false
tracks/2/enabled = true
tracks/2/path = NodePath(".")
tracks/2/interp = 1
tracks/2/loop_wrap = true
tracks/2/keys = {
"times": PackedFloat32Array(1),
"transitions": PackedFloat32Array(1),
"values": [{
"args": [],
"method": &"despawn"
}]
}
[sub_resource type="Animation" id="3"]
resource_name = "hurt"
tracks/0/type = "value"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath("sprite:modulate")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/keys = {
"times": PackedFloat32Array(0, 0.1),
"transitions": PackedFloat32Array(2, 1),
"update": 0,
"values": [Color(0, 0, 0, 1), Color(1, 1, 1, 1)]
}
tracks/1/type = "method"
tracks/1/imported = false
tracks/1/enabled = true
tracks/1/path = NodePath(".")
tracks/1/interp = 1
tracks/1/loop_wrap = true
tracks/1/keys = {
"times": PackedFloat32Array(0.1),
"transitions": PackedFloat32Array(1),
"values": [{
"args": [],
"method": &"goto_idle"
}]
}
[sub_resource type="Animation" id="6"]
resource_name = "idle_E"
loop_mode = 1
tracks/0/type = "value"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath("sprite:frame")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/keys = {
"times": PackedFloat32Array(0, 1),
"transitions": PackedFloat32Array(1, 1),
"update": 1,
"values": [154, 163]
}
tracks/1/type = "value"
tracks/1/imported = false
tracks/1/enabled = true
tracks/1/path = NodePath("sprite:flip_h")
tracks/1/interp = 1
tracks/1/loop_wrap = true
tracks/1/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 1,
"values": [false]
}
tracks/2/type = "value"
tracks/2/imported = false
tracks/2/enabled = true
tracks/2/path = NodePath("hurtbox:position")
tracks/2/interp = 1
tracks/2/loop_wrap = true
tracks/2/keys = {
"times": PackedFloat32Array(0, 1),
"transitions": PackedFloat32Array(1, 1),
"update": 0,
"values": [Vector2(0, 0), Vector2(0, -3.49902)]
}
[sub_resource type="Animation" id="7"]
resource_name = "idle_N"
loop_mode = 1
tracks/0/type = "value"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath("sprite:frame")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/keys = {
"times": PackedFloat32Array(0, 1),
"transitions": PackedFloat32Array(1, 1),
"update": 1,
"values": [22, 43]
}
tracks/1/type = "value"
tracks/1/imported = false
tracks/1/enabled = true
tracks/1/path = NodePath("sprite:flip_h")
tracks/1/interp = 1
tracks/1/loop_wrap = true
tracks/1/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 1,
"values": [false]
}
tracks/2/type = "value"
tracks/2/imported = false
tracks/2/enabled = true
tracks/2/path = NodePath("hurtbox:position")
tracks/2/interp = 1
tracks/2/loop_wrap = true
tracks/2/keys = {
"times": PackedFloat32Array(0, 1),
"transitions": PackedFloat32Array(1, 1),
"update": 0,
"values": [Vector2(0, 0), Vector2(0, -3.49902)]
}
[sub_resource type="Animation" id="4"]
resource_name = "idle_S"
loop_mode = 1
tracks/0/type = "value"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath("sprite:frame")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/keys = {
"times": PackedFloat32Array(0, 1),
"transitions": PackedFloat32Array(1, 1),
"update": 1,
"values": [88, 97]
}
tracks/1/type = "value"
tracks/1/imported = false
tracks/1/enabled = true
tracks/1/path = NodePath("sprite:flip_h")
tracks/1/interp = 1
tracks/1/loop_wrap = true
tracks/1/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 1,
"values": [false]
}
tracks/2/type = "value"
tracks/2/imported = false
tracks/2/enabled = true
tracks/2/path = NodePath("hurtbox:position")
tracks/2/interp = 1
tracks/2/loop_wrap = true
tracks/2/keys = {
"times": PackedFloat32Array(0, 1),
"transitions": PackedFloat32Array(1, 1),
"update": 0,
"values": [Vector2(0, 0), Vector2(0, -3.49902)]
}
[sub_resource type="Animation" id="5"]
resource_name = "idle_W"
loop_mode = 1
tracks/0/type = "value"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath("sprite:frame")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/keys = {
"times": PackedFloat32Array(0, 1),
"transitions": PackedFloat32Array(1, 1),
"update": 1,
"values": [11, 21]
}
tracks/1/type = "value"
tracks/1/imported = false
tracks/1/enabled = true
tracks/1/path = NodePath("sprite:flip_h")
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("hurtbox:position")
tracks/2/interp = 1
tracks/2/loop_wrap = true
tracks/2/keys = {
"times": PackedFloat32Array(0, 1),
"transitions": PackedFloat32Array(1, 1),
"update": 0,
"values": [Vector2(0, 0), Vector2(0, -3.49902)]
}
[sub_resource type="Animation" id="8"]
length = 0.001
tracks/0/type = "value"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath("sprite:frame")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 1,
"values": [2]
}
tracks/1/type = "value"
tracks/1/imported = false
tracks/1/enabled = true
tracks/1/path = NodePath("sprite:flip_h")
tracks/1/interp = 1
tracks/1/loop_wrap = true
tracks/1/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 1,
"values": [false]
}
tracks/2/type = "value"
tracks/2/imported = false
tracks/2/enabled = true
tracks/2/path = NodePath("player_sword:monitorable")
tracks/2/interp = 1
tracks/2/loop_wrap = true
tracks/2/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 1,
"values": [true]
}
tracks/3/type = "value"
tracks/3/imported = false
tracks/3/enabled = true
tracks/3/path = NodePath("sprite: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)]
}
tracks/4/type = "value"
tracks/4/imported = false
tracks/4/enabled = true
tracks/4/path = NodePath("hurtbox:position")
tracks/4/interp = 1
tracks/4/loop_wrap = true
tracks/4/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 0,
"values": [Vector2(0, 0)]
}
[sub_resource type="Animation" id="9"]
length = 0.5
loop_mode = 1
tracks/0/type = "value"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath("sprite:frame")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/keys = {
"times": PackedFloat32Array(0, 0.1, 0.2, 0.3, 0.4),
"transitions": PackedFloat32Array(1, 1, 1, 1, 1),
"update": 1,
"values": [15, 16, 17, 18, 19]
}
tracks/1/type = "value"
tracks/1/imported = false
tracks/1/enabled = true
tracks/1/path = NodePath("sprite:flip_h")
tracks/1/interp = 1
tracks/1/loop_wrap = true
tracks/1/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 1,
"values": [false]
}
tracks/2/type = "method"
tracks/2/imported = false
tracks/2/enabled = true
tracks/2/path = NodePath(".")
tracks/2/interp = 1
tracks/2/loop_wrap = true
tracks/2/keys = {
"times": PackedFloat32Array(0.5),
"transitions": PackedFloat32Array(1),
"values": [{
"args": [],
"method": &"goto_idle"
}]
}
[sub_resource type="Animation" id="10"]
length = 0.3
tracks/0/type = "value"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath("sprite:frame")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/keys = {
"times": PackedFloat32Array(0, 0.1, 0.2),
"transitions": PackedFloat32Array(1, 1, 1),
"update": 1,
"values": [0, 1, 2]
}
tracks/1/type = "value"
tracks/1/imported = false
tracks/1/enabled = true
tracks/1/path = NodePath("sprite:flip_h")
tracks/1/interp = 1
tracks/1/loop_wrap = true
tracks/1/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 1,
"values": [false]
}
tracks/2/type = "method"
tracks/2/imported = false
tracks/2/enabled = true
tracks/2/path = NodePath(".")
tracks/2/interp = 1
tracks/2/loop_wrap = true
tracks/2/keys = {
"times": PackedFloat32Array(0.3),
"transitions": PackedFloat32Array(1),
"values": [{
"args": [],
"method": &"goto_idle"
}]
}
[sub_resource type="Animation" id="11"]
length = 0.3
tracks/0/type = "value"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath("sprite:frame")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/keys = {
"times": PackedFloat32Array(0, 0.1, 0.2),
"transitions": PackedFloat32Array(1, 1, 1),
"update": 1,
"values": [3, 4, 5]
}
tracks/1/type = "value"
tracks/1/imported = false
tracks/1/enabled = true
tracks/1/path = NodePath("sprite:flip_h")
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 = "method"
tracks/2/imported = false
tracks/2/enabled = true
tracks/2/path = NodePath(".")
tracks/2/interp = 1
tracks/2/loop_wrap = true
tracks/2/keys = {
"times": PackedFloat32Array(0.3),
"transitions": PackedFloat32Array(1),
"values": [{
"args": [],
"method": &"goto_idle"
}]
}
[sub_resource type="Animation" id="12"]
length = 0.3
tracks/0/type = "value"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath("sprite:frame")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/keys = {
"times": PackedFloat32Array(0, 0.1, 0.2),
"transitions": PackedFloat32Array(1, 1, 1),
"update": 1,
"values": [3, 4, 5]
}
tracks/1/type = "value"
tracks/1/imported = false
tracks/1/enabled = true
tracks/1/path = NodePath("sprite:flip_h")
tracks/1/interp = 1
tracks/1/loop_wrap = true
tracks/1/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 1,
"values": [false]
}
tracks/2/type = "method"
tracks/2/imported = false
tracks/2/enabled = true
tracks/2/path = NodePath(".")
tracks/2/interp = 1
tracks/2/loop_wrap = true
tracks/2/keys = {
"times": PackedFloat32Array(0.3),
"transitions": PackedFloat32Array(1),
"values": [{
"args": [],
"method": &"goto_idle"
}]
}
[sub_resource type="Animation" id="13"]
length = 0.3
tracks/0/type = "value"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath("sprite:frame")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/keys = {
"times": PackedFloat32Array(0, 0.1, 0.2),
"transitions": PackedFloat32Array(1, 1, 1),
"update": 1,
"values": [6, 7, 8]
}
tracks/1/type = "value"
tracks/1/imported = false
tracks/1/enabled = true
tracks/1/path = NodePath("sprite:flip_h")
tracks/1/interp = 1
tracks/1/loop_wrap = true
tracks/1/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 1,
"values": [false]
}
tracks/2/type = "method"
tracks/2/imported = false
tracks/2/enabled = true
tracks/2/path = NodePath(".")
tracks/2/interp = 1
tracks/2/loop_wrap = true
tracks/2/keys = {
"times": PackedFloat32Array(0.3),
"transitions": PackedFloat32Array(1),
"values": [{
"args": [],
"method": &"goto_idle"
}]
}
[sub_resource type="Animation" id="Animation_qdqhh"]
resource_name = "walk_E"
loop_mode = 1
tracks/0/type = "value"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath("sprite:frame")
tracks/0/interp = 1
tracks/0/loop_wrap = false
tracks/0/keys = {
"times": PackedFloat32Array(0, 1),
"transitions": PackedFloat32Array(1, 1),
"update": 0,
"values": [154, 175]
}
tracks/1/type = "value"
tracks/1/imported = false
tracks/1/enabled = true
tracks/1/path = NodePath("sprite:flip_h")
tracks/1/interp = 1
tracks/1/loop_wrap = true
tracks/1/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 1,
"values": [false]
}
[sub_resource type="Animation" id="Animation_ef7ow"]
resource_name = "walk_N"
loop_mode = 1
tracks/0/type = "value"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath("sprite:frame")
tracks/0/interp = 1
tracks/0/loop_wrap = false
tracks/0/keys = {
"times": PackedFloat32Array(0, 1),
"transitions": PackedFloat32Array(1, 1),
"update": 0,
"values": [22, 43]
}
tracks/1/type = "value"
tracks/1/imported = false
tracks/1/enabled = true
tracks/1/path = NodePath("sprite:flip_h")
tracks/1/interp = 1
tracks/1/loop_wrap = true
tracks/1/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 1,
"values": [false]
}
[sub_resource type="Animation" id="Animation_m2uo2"]
resource_name = "walk_NE"
loop_mode = 1
tracks/0/type = "value"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath("sprite:frame")
tracks/0/interp = 1
tracks/0/loop_wrap = false
tracks/0/keys = {
"times": PackedFloat32Array(0, 1),
"transitions": PackedFloat32Array(1, 1),
"update": 0,
"values": [66, 87]
}
tracks/1/type = "value"
tracks/1/imported = false
tracks/1/enabled = true
tracks/1/path = NodePath("sprite:flip_h")
tracks/1/interp = 1
tracks/1/loop_wrap = true
tracks/1/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 1,
"values": [false]
}
[sub_resource type="Animation" id="Animation_bcwxc"]
resource_name = "walk_NW"
loop_mode = 1
tracks/0/type = "value"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath("sprite:frame")
tracks/0/interp = 1
tracks/0/loop_wrap = false
tracks/0/keys = {
"times": PackedFloat32Array(0, 1),
"transitions": PackedFloat32Array(1, 1),
"update": 0,
"values": [44, 65]
}
tracks/1/type = "value"
tracks/1/imported = false
tracks/1/enabled = true
tracks/1/path = NodePath("sprite:flip_h")
tracks/1/interp = 1
tracks/1/loop_wrap = true
tracks/1/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 1,
"values": [false]
}
[sub_resource type="Animation" id="Animation_ixjcm"]
resource_name = "walk_S"
loop_mode = 1
tracks/0/type = "value"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath("sprite:frame")
tracks/0/interp = 1
tracks/0/loop_wrap = false
tracks/0/keys = {
"times": PackedFloat32Array(0, 1),
"transitions": PackedFloat32Array(1, 1),
"update": 0,
"values": [88, 109]
}
tracks/1/type = "value"
tracks/1/imported = false
tracks/1/enabled = true
tracks/1/path = NodePath("sprite:flip_h")
tracks/1/interp = 1
tracks/1/loop_wrap = true
tracks/1/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 1,
"values": [false]
}
[sub_resource type="Animation" id="Animation_fq7dv"]
resource_name = "walk_SE"
loop_mode = 1
tracks/0/type = "value"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath("sprite:frame")
tracks/0/interp = 1
tracks/0/loop_wrap = false
tracks/0/keys = {
"times": PackedFloat32Array(0, 1),
"transitions": PackedFloat32Array(1, 1),
"update": 0,
"values": [132, 153]
}
tracks/1/type = "value"
tracks/1/imported = false
tracks/1/enabled = true
tracks/1/path = NodePath("sprite:flip_h")
tracks/1/interp = 1
tracks/1/loop_wrap = true
tracks/1/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 1,
"values": [false]
}
[sub_resource type="Animation" id="Animation_ek8m1"]
resource_name = "walk_SW"
loop_mode = 1
tracks/0/type = "value"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath("sprite:frame")
tracks/0/interp = 1
tracks/0/loop_wrap = false
tracks/0/keys = {
"times": PackedFloat32Array(0, 1),
"transitions": PackedFloat32Array(1, 1),
"update": 0,
"values": [110, 131]
}
tracks/1/type = "value"
tracks/1/imported = false
tracks/1/enabled = true
tracks/1/path = NodePath("sprite:flip_h")
tracks/1/interp = 1
tracks/1/loop_wrap = true
tracks/1/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 1,
"values": [false]
}
[sub_resource type="Animation" id="14"]
resource_name = "walk_W"
loop_mode = 1
tracks/0/type = "value"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath("sprite:frame")
tracks/0/interp = 1
tracks/0/loop_wrap = false
tracks/0/keys = {
"times": PackedFloat32Array(0, 1),
"transitions": PackedFloat32Array(1, 1),
"update": 0,
"values": [0, 21]
}
tracks/1/type = "value"
tracks/1/imported = false
tracks/1/enabled = true
tracks/1/path = NodePath("sprite:flip_h")
tracks/1/interp = 1
tracks/1/loop_wrap = true
tracks/1/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 1,
"values": [false]
}
[sub_resource type="AnimationLibrary" id="AnimationLibrary_qdvjb"]
_data = {
"die": SubResource("2"),
"hurt": SubResource("3"),
"idle_E": SubResource("6"),
"idle_N": SubResource("7"),
"idle_S": SubResource("4"),
"idle_W": SubResource("5"),
"reset": SubResource("8"),
"roll": SubResource("9"),
"slash_down": SubResource("10"),
"slash_left": SubResource("11"),
"slash_right": SubResource("12"),
"slash_up": SubResource("13"),
"walk_E": SubResource("Animation_qdqhh"),
"walk_N": SubResource("Animation_ef7ow"),
"walk_NE": SubResource("Animation_m2uo2"),
"walk_NW": SubResource("Animation_bcwxc"),
"walk_S": SubResource("Animation_ixjcm"),
"walk_SE": SubResource("Animation_fq7dv"),
"walk_SW": SubResource("Animation_ek8m1"),
"walk_W": SubResource("14")
}
[sub_resource type="CapsuleShape2D" id="18"]
radius = 25.0
height = 80.0
[node name="Player" type="CharacterBody2D" groups=["player"]]
position = Vector2(585.638, 309.087)
script = ExtResource("2")
[node name="sprite" type="Sprite2D" parent="."]
position = Vector2(6.362, -53.087)
scale = Vector2(2, 2)
texture = ExtResource("2_rhd3n")
hframes = 22
vframes = 8
frame = 88
[node name="hitbox" type="CollisionShape2D" parent="."]
visible = false
position = Vector2(0.421509, -10.1996)
rotation = 1.5708
shape = SubResource("1")
[node name="player_sword" type="Area2D" parent="."]
visible = false
position = Vector2(6.362, -53.087)
[node name="anims" type="AnimationPlayer" parent="."]
libraries = {
"": SubResource("AnimationLibrary_qdvjb")
}
[node name="camera" type="Camera2D" parent="."]
position = Vector2(6.362, -53.087)
zoom = Vector2(0.5, 0.5)
[node name="debug" parent="." instance=ExtResource("3")]
path_to_node = NodePath("..")
properties = ["linear_vel", "roll_direction", "facing"]
enabled = false
[node name="hurtbox" type="Area2D" parent="."]
visible = false
[node name="col" type="CollisionShape2D" parent="hurtbox"]
visible = false
position = Vector2(0.362, -48.087)
shape = SubResource("18")
[connection signal="area_entered" from="hurtbox" to="." method="_on_hurtbox_area_entered"]

View File

@@ -0,0 +1,42 @@
extends CanvasLayer
"""
This can be added to any scene and be use to show some properties for debug purposes
"""
@export var path_to_node: NodePath
@export var properties = [] # (Array, String)
@export var enabled: bool = true: get = _get_enabled, set = _set_enabled
var node = null
@onready var stats = $Control/stats
# Called when the node enters the scene tree for the first time.
func _ready():
node = get_node(path_to_node)
pass # Replace with function body.
# Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(_delta):
var output = ""
for property in properties:
if not property in node:
printerr("Property %s not found in %s" % [property, node])
properties.erase(property)
continue
output += property + ": " + str(node[property]) + "\n"
stats.text = output
pass
func _set_enabled(value):
enabled = value
if value == true:
$Control.show()
set_process(true)
else:
$Control.hide()
set_process(false)
func _get_enabled():
return enabled

View File

@@ -0,0 +1,29 @@
[gd_scene load_steps=4 format=2]
[ext_resource path="res://fonts/Candy Demo.ttf" type="FontFile" id=1]
[ext_resource path="res://scenes/characters/debug_character.gd" type="Script" id=2]
[sub_resource type="FontFile" id=1]
size = 32
font_data = ExtResource( 1 )
[node name="debug" type="CanvasLayer"]
script = ExtResource( 2 )
[node name="Control" type="Control" parent="."]
anchor_right = 1.0
anchor_bottom = 1.0
__meta__ = {
"_edit_use_anchors_": false
}
[node name="stats" type="Label" parent="Control"]
offset_left = 17.0
offset_top = 16.0
offset_right = 285.0
offset_bottom = 211.0
theme_override_fonts/font = SubResource( 1 )
theme_override_colors/font_color = Color( 0.803922, 0.0784314, 0.0784314, 1 )
__meta__ = {
"_edit_use_anchors_": false
}

15
scenes/items/Item.gd Normal file
View File

@@ -0,0 +1,15 @@
extends Area2D
@export var item_type: String = "Generic Item"
@export var amount: int = 1
func _ready():
body_entered.connect(_on_Item_body_entered)
pass
func _on_Item_body_entered(body):
if body is Player:
body_entered.disconnect(_on_Item_body_entered)
Inventory.add_item(item_type, amount)
$anims.play("collected")
pass

182
scenes/items/Item.tscn Normal file
View File

@@ -0,0 +1,182 @@
[gd_scene load_steps=9 format=3 uid="uid://naq6pppaamdx"]
[ext_resource type="Texture2D" uid="uid://dswhkcoafxmtb" path="res://textures/item.png" id="1"]
[ext_resource type="Script" path="res://scenes/items/Item.gd" id="2"]
[ext_resource type="AudioStream" uid="uid://bkqm1wbxr2gg5" path="res://sounds/item_collected.wav" id="3"]
[sub_resource type="CircleShape2D" id="1"]
radius = 63.7874
[sub_resource type="Animation" id="2"]
resource_name = "collected"
length = 0.4
tracks/0/type = "value"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath("pickup:playing")
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 = "method"
tracks/1/imported = false
tracks/1/enabled = true
tracks/1/path = NodePath(".")
tracks/1/interp = 1
tracks/1/loop_wrap = true
tracks/1/keys = {
"times": PackedFloat32Array(0.4),
"transitions": PackedFloat32Array(1),
"values": [{
"args": [],
"method": &"queue_free"
}]
}
tracks/2/type = "value"
tracks/2/imported = false
tracks/2/enabled = true
tracks/2/path = NodePath("sprite:visible")
tracks/2/interp = 1
tracks/2/loop_wrap = true
tracks/2/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 1,
"values": [false]
}
[sub_resource type="Animation" id="3"]
length = 0.001
tracks/0/type = "value"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath("sprite:position")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 0,
"values": [Vector2(0, 0)]
}
tracks/1/type = "value"
tracks/1/imported = false
tracks/1/enabled = true
tracks/1/path = NodePath("sprite:rotation_degrees")
tracks/1/interp = 1
tracks/1/loop_wrap = true
tracks/1/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 0,
"values": [0.0]
}
tracks/2/type = "value"
tracks/2/imported = false
tracks/2/enabled = true
tracks/2/path = NodePath("sprite:scale")
tracks/2/interp = 1
tracks/2/loop_wrap = true
tracks/2/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 0,
"values": [Vector2(1, 1)]
}
tracks/3/type = "value"
tracks/3/imported = false
tracks/3/enabled = true
tracks/3/path = NodePath("sprite:visible")
tracks/3/interp = 1
tracks/3/loop_wrap = true
tracks/3/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 1,
"values": [true]
}
[sub_resource type="Animation" id="4"]
length = 0.3
step = 0.01
tracks/0/type = "value"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath("sprite:position")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/keys = {
"times": PackedFloat32Array(0, 0.05, 0.1, 0.2, 0.225, 0.3),
"transitions": PackedFloat32Array(1, 1, 1, 1, 1, 1),
"update": 0,
"values": [Vector2(0, 0), Vector2(0, -26.4704), Vector2(0, -84.7684), Vector2(0, 0), Vector2(0, 0), Vector2(0, 0)]
}
tracks/1/type = "value"
tracks/1/imported = false
tracks/1/enabled = true
tracks/1/path = NodePath("sprite:rotation_degrees")
tracks/1/interp = 1
tracks/1/loop_wrap = true
tracks/1/keys = {
"times": PackedFloat32Array(0, 0.05, 0.1, 0.2, 0.225, 0.3),
"transitions": PackedFloat32Array(1, 1, 1, 1, 1, 1),
"update": 0,
"values": [0.0, 0.0, 0.0, 0.0, 0.0, 0.0]
}
tracks/2/type = "value"
tracks/2/imported = false
tracks/2/enabled = true
tracks/2/path = NodePath("sprite:scale")
tracks/2/interp = 1
tracks/2/loop_wrap = true
tracks/2/keys = {
"times": PackedFloat32Array(0, 0.05, 0.1, 0.2, 0.225, 0.3),
"transitions": PackedFloat32Array(1, 1, 1, 1, 1, 1),
"update": 0,
"values": [Vector2(1.72, 0.159999), Vector2(0.336001, 1.448), Vector2(1, 1), Vector2(1, 1), Vector2(1.36, 0.68), Vector2(1, 1)]
}
tracks/3/type = "value"
tracks/3/imported = false
tracks/3/enabled = true
tracks/3/path = NodePath("sprite:visible")
tracks/3/interp = 1
tracks/3/loop_wrap = true
tracks/3/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 1,
"values": [true]
}
[sub_resource type="AnimationLibrary" id="AnimationLibrary_hhnq1"]
_data = {
"collected": SubResource("2"),
"reset": SubResource("3"),
"spawn": SubResource("4")
}
[node name="Item" type="Area2D" groups=["items"]]
script = ExtResource("2")
[node name="sprite" type="Sprite2D" parent="."]
visible = false
scale = Vector2(1.72, 0.159999)
texture = ExtResource("1")
offset = Vector2(0.36261, -19.2809)
[node name="hitbox" type="CollisionShape2D" parent="."]
position = Vector2(0, -13.2074)
shape = SubResource("1")
[node name="pickup" type="AudioStreamPlayer2D" parent="."]
stream = ExtResource("3")
[node name="anims" type="AnimationPlayer" parent="."]
libraries = {
"": SubResource("AnimationLibrary_hhnq1")
}
autoplay = "spawn"

10
scenes/levels/Controls.gd Normal file
View File

@@ -0,0 +1,10 @@
extends Control
func _ready():
$Button.grab_focus()
pass
func _on_Button_pressed():
get_tree().change_scene_to_file("res://scenes/levels/Menu.tscn")
pass # Replace with function body.

View File

@@ -0,0 +1,37 @@
[gd_scene load_steps=4 format=2]
[ext_resource path="res://scenes/levels/Controls.gd" type="Script" id=1]
[ext_resource path="res://textures/misc/controls.png" type="Texture2D" id=2]
[ext_resource path="res://fonts/dialog.tres" type="FontFile" id=3]
[node name="Controls" type="Control"]
anchor_right = 1.0
anchor_bottom = 1.0
script = ExtResource( 1 )
__meta__ = {
"_edit_use_anchors_": false
}
[node name="controls" type="TextureRect" parent="."]
anchor_right = 1.0
anchor_bottom = 1.0
texture = ExtResource( 2 )
[node name="Button" type="Button" parent="."]
anchor_left = 1.0
anchor_top = 0.5
anchor_right = 1.0
anchor_bottom = 0.5
offset_left = -114.361
offset_top = 234.378
offset_right = -7.36102
offset_bottom = 283.378
theme_override_fonts/font = ExtResource( 3 )
theme_override_colors/font_color = Color( 0, 0, 0, 1 )
theme_override_colors/font_hover_color = Color( 0.364706, 0.364706, 0.364706, 1 )
text = "Back"
flat = true
__meta__ = {
"_editor_description_": ""
}
[connection signal="pressed" from="Button" to="." method="_on_Button_pressed"]

240
scenes/levels/Intro.tscn Normal file
View File

@@ -0,0 +1,240 @@
[gd_scene load_steps=8 format=3 uid="uid://cqjxhlcvohevs"]
[ext_resource type="Texture2D" uid="uid://xriucyfo0o30" path="res://textures/misc/logo-bg.png" id="1"]
[ext_resource type="Texture2D" uid="uid://bc8oc41wxytr1" path="res://textures/misc/logo-logo.png" id="2"]
[ext_resource type="Texture2D" uid="uid://dqt0n5ytc0a4r" path="res://textures/misc/logo-studio.png" id="3"]
[ext_resource type="AudioStream" uid="uid://bub2p8fvv46yx" path="res://music/logo.wav" id="4"]
[sub_resource type="Animation" id="1"]
resource_name = "Intro"
length = 4.5
step = 0.01
tracks/0/type = "audio"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath("logo")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/keys = {
"clips": [{
"end_offset": 0.219207,
"start_offset": 0.0,
"stream": ExtResource("4")
}],
"times": PackedFloat32Array(1.29)
}
tracks/0/use_blend = true
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, 0.99, 1.49, 3.55, 3.99),
"transitions": PackedFloat32Array(0.5, 0.5, 1, 2, 1),
"update": 0,
"values": [Color(0, 0, 0, 1), Color(0, 0, 0, 1), Color(0, 0, 0, 0), Color(0, 0, 0, 0), Color(0, 0, 0, 1)]
}
tracks/2/type = "value"
tracks/2/imported = false
tracks/2/enabled = true
tracks/2/path = NodePath("logo-logo:position")
tracks/2/interp = 2
tracks/2/loop_wrap = true
tracks/2/keys = {
"times": PackedFloat32Array(0, 1.49, 1.6, 1.64, 1.67, 1.83),
"transitions": PackedFloat32Array(0, 2, 1, 1, 1, 1),
"update": 0,
"values": [Vector2(504, 733), Vector2(504, 733), Vector2(446, -45), Vector2(212, 109), Vector2(109, 56), Vector2(212, 109)]
}
tracks/3/type = "value"
tracks/3/imported = false
tracks/3/enabled = true
tracks/3/path = NodePath("logo-logo:rotation")
tracks/3/interp = 2
tracks/3/loop_wrap = true
tracks/3/keys = {
"times": PackedFloat32Array(0, 1.49, 1.6, 1.64, 1.67, 1.83),
"transitions": PackedFloat32Array(0, 1, 1, 1, 1, 1),
"update": 0,
"values": [0.0, 0.0, 0.0, 0.0, 0.0, 0.0]
}
tracks/4/type = "value"
tracks/4/imported = false
tracks/4/enabled = true
tracks/4/path = NodePath("logo-logo:size")
tracks/4/interp = 2
tracks/4/loop_wrap = true
tracks/4/keys = {
"times": PackedFloat32Array(0, 1.49, 1.6, 1.64, 1.67, 1.83),
"transitions": PackedFloat32Array(0, 2, 1, 1, 1, 1),
"update": 0,
"values": [Vector2(16, 382), Vector2(16, 382), Vector2(132, 689), Vector2(600, 382), Vector2(806, 488), Vector2(600, 382)]
}
tracks/5/type = "value"
tracks/5/imported = false
tracks/5/enabled = true
tracks/5/path = NodePath("logo-studio:position")
tracks/5/interp = 2
tracks/5/loop_wrap = true
tracks/5/keys = {
"times": PackedFloat32Array(0, 1.88, 2.01, 2.04, 2.07, 2.1, 2.13),
"transitions": PackedFloat32Array(0, 1, 1, 1, 1, 1, 1),
"update": 0,
"values": [Vector2(185.667, -300.401), Vector2(185.667, -300.401), Vector2(207, -355.62), Vector2(212, 109), Vector2(196.35, 12.4492), Vector2(133, 59), Vector2(212, 109)]
}
tracks/6/type = "value"
tracks/6/imported = false
tracks/6/enabled = true
tracks/6/path = NodePath("logo-studio:rotation")
tracks/6/interp = 2
tracks/6/loop_wrap = true
tracks/6/keys = {
"times": PackedFloat32Array(0, 1.88, 2.01, 2.04, 2.07, 2.1, 2.13),
"transitions": PackedFloat32Array(0, 1, 1, 1, 1, 1, 1),
"update": 0,
"values": [0.0, 0.0, 0.0, 0.0, 4.49367, 0.0, 0.0]
}
tracks/7/type = "value"
tracks/7/imported = false
tracks/7/enabled = true
tracks/7/path = NodePath("logo-studio:size")
tracks/7/interp = 2
tracks/7/loop_wrap = true
tracks/7/keys = {
"times": PackedFloat32Array(0, 1.88, 2.01, 2.04, 2.07, 2.1, 2.13),
"transitions": PackedFloat32Array(0, 1, 1, 1, 1, 1, 1),
"update": 0,
"values": [Vector2(652.667, 415.667), Vector2(652.667, 415.667), Vector2(611, 1452), Vector2(600, 382), Vector2(679, 432.5), Vector2(758, 483), Vector2(600, 382)]
}
tracks/8/type = "value"
tracks/8/imported = false
tracks/8/enabled = true
tracks/8/path = NodePath("logo-bg:position")
tracks/8/interp = 2
tracks/8/loop_wrap = true
tracks/8/keys = {
"times": PackedFloat32Array(0, 2.55, 2.63, 2.68, 2.74),
"transitions": PackedFloat32Array(0, 1, 1, 1, 1),
"update": 0,
"values": [Vector2(212, 491), Vector2(212, 491), Vector2(212, 109), Vector2(141, 64), Vector2(212, 109)]
}
tracks/9/type = "value"
tracks/9/imported = false
tracks/9/enabled = true
tracks/9/path = NodePath("logo-bg:rotation")
tracks/9/interp = 2
tracks/9/loop_wrap = true
tracks/9/keys = {
"times": PackedFloat32Array(0, 2.55, 2.63, 2.68, 2.74),
"transitions": PackedFloat32Array(0, 1, 1, 1, 1),
"update": 0,
"values": [0.0, 0.0, 0.0, 0.0, 0.0]
}
tracks/10/type = "value"
tracks/10/imported = false
tracks/10/enabled = true
tracks/10/path = NodePath("logo-bg:size")
tracks/10/interp = 2
tracks/10/loop_wrap = true
tracks/10/keys = {
"times": PackedFloat32Array(0, 2.55, 2.63, 2.68, 2.74),
"transitions": PackedFloat32Array(0, 1, 1, 1, 1),
"update": 0,
"values": [Vector2(600, 0), Vector2(600, 0), Vector2(600, 382), Vector2(742, 472), Vector2(600, 382)]
}
[sub_resource type="AnimationLibrary" id="AnimationLibrary_riwan"]
_data = {
"Intro": SubResource("1")
}
[sub_resource type="GDScript" id="2"]
script/source = "extends AnimationPlayer
# Declare member variables here. Examples:
# var a = 2
# var b = \"text\"
# Called when the node enters the scene tree for the first time.
func _ready():
pass # Replace with function body.
# Called every frame. 'delta' is the elapsed time since the previous frame.
#func _process(delta):
# pass
func _on_anims_animation_finished(_anim_name):
get_tree().change_scene_to_file(\"res://scenes/levels/Menu.tscn\")
pass # Replace with function body.
"
[node name="Intro" type="Control"]
layout_mode = 3
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
[node name="ColorRect" type="ColorRect" parent="."]
layout_mode = 0
anchor_right = 1.0
anchor_bottom = 1.0
color = Color(0, 0, 0, 1)
[node name="logo-bg" type="TextureRect" parent="."]
layout_mode = 0
anchor_left = 0.5
anchor_top = 0.5
anchor_right = 0.5
anchor_bottom = 0.5
offset_left = -300.0
offset_top = 191.0
offset_right = 300.0
offset_bottom = 191.0
texture = ExtResource("1")
expand_mode = 1
[node name="logo-logo" type="TextureRect" parent="."]
layout_mode = 0
anchor_left = 0.5
anchor_top = 0.5
anchor_right = 0.5
anchor_bottom = 0.5
offset_left = -8.0
offset_top = 433.0
offset_right = 8.0
offset_bottom = 815.0
texture = ExtResource("2")
expand_mode = 1
[node name="logo-studio" type="TextureRect" parent="."]
layout_mode = 0
anchor_left = 0.5
anchor_top = 0.5
anchor_right = 0.5
anchor_bottom = 0.5
offset_left = -326.333
offset_top = -600.401
offset_right = 326.334
offset_bottom = -184.734
texture = ExtResource("3")
expand_mode = 1
[node name="logo" type="AudioStreamPlayer" parent="."]
stream = ExtResource("4")
[node name="anims" type="AnimationPlayer" parent="."]
libraries = {
"": SubResource("AnimationLibrary_riwan")
}
autoplay = "Intro"
script = SubResource("2")
[connection signal="animation_finished" from="anims" to="anims" method="_on_anims_animation_finished"]

46
scenes/levels/Menu.gd Normal file
View File

@@ -0,0 +1,46 @@
extends Control
@export var initial_level = "" # (String, FILE, "*.tscn")
func _ready():
grab_focus()
if Globals.load_game(true):
$continue.disabled = false
else:
$continue.disabled = true
func _on_continue_pressed():
Globals.load_game()
if Globals.current_level != "":
if get_tree().change_scene_to_file(Globals.current_level) != OK:
push_error("Error changing scenes")
else:
push_error("Error: current_level shouldn't be empty")
pass # Replace with function body.
func _on_new_game_pressed():
if initial_level != "":
Globals.current_level = initial_level
if Globals.save_game() == false:
push_error("Error saving game")
var err = get_tree().change_scene_to_file(initial_level)
if err != OK:
push_error("Error changing scene: %s" % err)
else:
push_error("Error: initial_level shouldn't be empty")
pass # Replace with function body.
func _on_quit_pressed():
get_tree().quit()
pass # Replace with function body.
func _on_controls_pressed():
get_tree().change_scene_to_file("res://scenes/levels/Controls.tscn")
pass # Replace with function body.

134
scenes/levels/Menu.tscn Normal file
View File

@@ -0,0 +1,134 @@
[gd_scene load_steps=5 format=2]
[ext_resource path="res://fonts/dialog.tres" type="FontFile" id=1]
[ext_resource path="res://textures/menu/game_title.png" type="Texture2D" id=2]
[ext_resource path="res://textures/menu/bg.png" type="Texture2D" id=3]
[ext_resource path="res://scenes/levels/Menu.gd" type="Script" id=4]
[node name="Menu" type="Control"]
anchor_right = 1.0
anchor_bottom = 1.0
focus_neighbor_left = NodePath("quit")
focus_neighbor_top = NodePath("continue")
focus_neighbor_right = NodePath("credits")
focus_neighbor_bottom = NodePath("new_game")
focus_mode = 2
script = ExtResource( 4 )
__meta__ = {
"_edit_use_anchors_": false
}
initial_level = "res://scenes/levels/Outside.tscn"
[node name="BG" type="TextureRect" parent="."]
anchor_right = 1.0
anchor_bottom = 1.0
texture = ExtResource( 3 )
expand = true
stretch_mode = 7
__meta__ = {
"_edit_use_anchors_": false
}
[node name="logo" type="TextureRect" parent="."]
anchor_left = 0.5
anchor_top = 0.5
anchor_right = 0.5
anchor_bottom = 0.5
offset_left = -236.0
offset_top = -185.634
offset_right = 237.0
offset_bottom = -5.63416
texture = ExtResource( 2 )
expand = true
stretch_mode = 6
__meta__ = {
"_edit_use_anchors_": false
}
[node name="new_game" type="Button" parent="."]
anchor_left = 0.5
anchor_top = 0.5
anchor_right = 0.5
anchor_bottom = 0.5
offset_left = -57.5
offset_top = 47.9168
offset_right = 57.5
offset_bottom = 96.9168
focus_neighbor_left = NodePath("../quit")
focus_neighbor_top = NodePath("../quit")
focus_neighbor_right = NodePath("../controls")
focus_neighbor_bottom = NodePath("../continue")
theme_override_fonts/font = ExtResource( 1 )
theme_override_colors/font_color = Color( 0, 0, 0, 1 )
theme_override_colors/font_hover_color = Color( 0.364706, 0.364706, 0.364706, 1 )
text = "New Game"
flat = true
__meta__ = {
"_edit_use_anchors_": false
}
[node name="continue" type="Button" parent="."]
anchor_left = 0.5
anchor_top = 0.5
anchor_right = 0.5
anchor_bottom = 0.5
offset_left = -50.5
offset_top = 123.626
offset_right = 50.5
offset_bottom = 172.626
focus_neighbor_left = NodePath("../quit")
focus_neighbor_top = NodePath("../new_game")
focus_neighbor_right = NodePath("../controls")
focus_neighbor_bottom = NodePath("../controls")
theme_override_fonts/font = ExtResource( 1 )
theme_override_colors/font_disabled_color = Color( 0.780392, 0.780392, 0.780392, 1 )
theme_override_colors/font_color = Color( 0, 0, 0, 1 )
theme_override_colors/font_hover_color = Color( 0.364706, 0.364706, 0.364706, 1 )
disabled = true
text = "Continue"
flat = true
__meta__ = {
"_edit_use_anchors_": false
}
[node name="controls" type="Button" parent="."]
anchor_left = 1.0
anchor_top = 0.5
anchor_right = 1.0
anchor_bottom = 0.5
offset_left = -114.361
offset_top = 234.378
offset_right = -13.3615
offset_bottom = 283.378
focus_neighbor_left = NodePath("../quit")
focus_neighbor_top = NodePath("../continue")
focus_neighbor_right = NodePath("../quit")
focus_neighbor_bottom = NodePath("../new_game")
theme_override_fonts/font = ExtResource( 1 )
text = "Controls"
flat = true
__meta__ = {
"_edit_use_anchors_": false
}
[node name="quit" type="Button" parent="."]
anchor_top = 1.0
anchor_bottom = 1.0
offset_left = 12.9543
offset_top = -69.3568
offset_right = 113.954
offset_bottom = -20.3568
focus_neighbor_left = NodePath("../controls")
focus_neighbor_top = NodePath("../continue")
focus_neighbor_right = NodePath("../controls")
focus_neighbor_bottom = NodePath("../new_game")
theme_override_fonts/font = ExtResource( 1 )
text = "Quit"
flat = true
__meta__ = {
"_edit_use_anchors_": false
}
[connection signal="pressed" from="new_game" to="." method="_on_new_game_pressed"]
[connection signal="pressed" from="continue" to="." method="_on_continue_pressed"]
[connection signal="pressed" from="controls" to="." method="_on_controls_pressed"]
[connection signal="pressed" from="quit" to="." method="_on_quit_pressed"]

View File

@@ -0,0 +1,53 @@
[gd_scene load_steps=6 format=3 uid="uid://c5oh2rmcwksmt"]
[ext_resource type="TileSet" uid="uid://c2mhyv81hyxbt" path="res://scenes/tilesets/castle.tres" id="3_ojvwt"]
[ext_resource type="PackedScene" uid="uid://cixovgrvqr2p2" path="res://scenes/props/tree6.tscn" id="4_f0l61"]
[ext_resource type="PackedScene" uid="uid://dvmm1keyq3r5c" path="res://scenes/props/tree2.tscn" id="4_f5et7"]
[ext_resource type="PackedScene" uid="uid://ctd3mgp0s172q" path="res://scenes/characters/Player.tscn" id="5_7pfs4"]
[ext_resource type="PackedScene" uid="uid://deqgnj30xx13t" path="res://scenes/misc/UI.tscn" id="14_jp8qw"]
[node name="test_scene" type="Node"]
[node name="level" type="Node2D" parent="."]
y_sort_enabled = true
position = Vector2(208, 82)
[node name="TileMap" type="TileMap" parent="level"]
y_sort_enabled = true
position = Vector2(1407, 792)
tile_set = ExtResource("3_ojvwt")
format = 2
layer_0/name = "base"
layer_0/y_sort_enabled = true
layer_0/tile_data = PackedInt32Array(-2, 0, 0, 65534, 0, 0, 131070, 65536, 0, 65533, 0, 0, 196606, 0, 0, 262142, 65536, 0, -65539, 0, 0, -3, 0, 0, -65540, 0, 0, -131075, 0, 0, -1, 0, 0, -65538, 0, 0, -131074, 0, 0, -196611, 0, 0, -4, 0, 0, 65532, 0, 0, 131069, 0, 0, 196605, 65536, 0, 131071, 0, 0, 65535, 0, 0, -65536, 65536, 0, -65537, 65536, 0, -131073, 65536, 0, -196610, 65536, 0, -262146, 0, 0, 65531, 65536, 0, 131068, 65536, 0, 196604, 65536, 0, 327676, 65536, 0, 262140, 65536, 0, 262141, 65536, 0, 196603, 65536, 0, 131067, 65536, 0, 65530, 65536, 0, -5, 65536, 0, -65541, 0, 0, -131076, 0, 0, -196612, 0, 0, 327677, 65536, 0, 327678, 65536, 0, 393213, 65536, 0, 458748, 65536, 0, 393214, 65536, 0, 458750, 0, 0, 393215, 65536, 0, 524285, 65536, 0, 458749, 65536, 0, 327675, 65536, 0, 393212, 65536, 0, 262139, 65536, 0, 327674, 0, 0, 393211, 65536, 0, 458746, 65536, 0, 524283, 65536, 0, 589819, 65536, 0, 655356, 65536, 0, 589820, 65536, 0, 458747, 65536, 0, 524284, 65536, 0, 131066, 65536, 0, 196602, 65536, 0, 262138, 65536, 0, 196601, 0, 0, 327673, 65536, 0, 393210, 0, 0, -65542, 65536, 0, -131078, 65536, 0, -65543, 65536, 0, -6, 65536, 0, -131077, 65536, 0, -196614, 0, 0, -262149, 65536, 0, -196613, 0, 0, -262148, 65536, 0, -327685, 0, 0, 262143, 65536, 0, 327679, 65536, 0, 196608, 0, 0, 196607, 65536, 0, 327680, 0, 0, 262144, 0, 0, 131072, 0, 0, 65536, 0, 0, 0, 65536, 0, 65537, 65536, 0, 524287, 65536, 0, 589822, 65536, 0, 655359, 65536, 0, 589823, 65536, 0, 458752, 65536, 0, 458751, 65536, 0, 524286, 65536, 0, -262147, 65536, 0, -327683, 65536, 0, -393218, 65536, 0, -327682, 65536, 0, -262145, 65536, 0, -196608, 65536, 0, -131072, 65536, 0, -196609, 65536, 0, 393216, 0, 0, 393217, 0, 0, 393218, 65536, 0, 393219, 65536, 0, 327683, 65536, 0, 262147, 65536, 0, 262146, 65536, 0, 262145, 65536, 0, 327681, 65536, 0, 196609, 0, 0, 131073, 0, 0, 196610, 0, 0, 131074, 0, 0, 1, 65536, 0, -65535, 65536, 0, -65534, 65536, 0, 2, 0, 0, 65538, 0, 0, 65539, 65536, 0, 131075, 65536, 0, 327682, 65536, 0, 524288, 65536, 0, 458753, 65536, 0, 589821, 65536, 0, 655357, 65536, 0, 655358, 65536, 0, 393209, 65536, 0, 458745, 65536, 0, 524281, 65536, 0, 524282, 65536, 0, 589818, 65536, 0, 262137, 65536, 0, 131065, 0, 0, 65529, 0, 0, -7, 0, 0, 131064, 65536, 0, 65528, 0, 0, -8, 0, 0, 196600, 65536, 0, 262136, 65536, 0, 327672, 65536, 0, -131079, 65536, 0, -65544, 0, 0, 196611, 65536, 0, -65545, 0, 0, -131081, 0, 0, -196617, 0, 0, -196616, 0, 0, -196615, 0, 0, -262150, 0, 0, 589824, 0, 0, 655353, 0, 0, 655354, 0, 0, 655355, 0, 0, -262151, 0, 0, -327687, 0, 0, -327686, 0, 0, -327684, 0, 0, -393219, 0, 0, -131080, 0, 0, 196599, 0, 0, 131063, 0, 0, 65527, 0, 0, -9, 0, 0, -10, 0, 0, -65546, 0, 0, 65526, 0, 0, 131062, 0, 0, -393223, 0, 0, -458759, 0, 0, -458758, 0, 0, -393222, 0, 0, -393221, 0, 0, -458757, 0, 0, -393220, 0, 0, -458756, 0, 0, -327688, 0, 0, -393224, 0, 0, -458760, 0, 0, 655352, 0, 0, 589817, 0, 0, 589816, 0, 0, 524280, 0, 0, 458744, 0, 0, 393208, 0, 0, 327671, 0, 0, 262135, 0, 0, 262134, 0, 0, 196598, 0, 0)
layer_1/name = "wall"
layer_1/y_sort_enabled = true
layer_1/z_index = 1
layer_1/tile_data = PackedInt32Array(655356, 2, 3, 655357, 2, 3, 655358, 2, 3, 655359, 2, 3, 589824, 2, 3, 524288, 2, 3, 458752, 2, 3, 458753, 2, 3, -131080, 2, 3, -6, 65538, 3, 589817, 2, 3, 655353, 2, 3, 655352, 2, 3, 589816, 2, 3, 524280, 2, 3, 458744, 2, 3, 393208, 2, 3, 393207, 2, 3, 327671, 2, 3, 262135, 2, 3, -65546, 2, 3, -131082, 2, 3, -196618, 2, 3, -262154, 2, 3, -262153, 2, 3, -262152, 2, 3, 196598, 2, 3, 131062, 2, 3, 65526, 2, 3, -10, 2, 3, 655355, 65538, 3, -4, 65538, 3, 393218, 65538, 3, 393219, 65538, 3, 327683, 65538, 3, 262147, 65538, 3, 196611, 65538, 3, 131075, 65538, 3, 65539, 65538, 3, 2, 65538, 3, -65534, 65538, 3, -65535, 65538, 3, -196609, 65538, 3, -262145, 65538, 3, -327682, 65538, 3, -393218, 65538, 3, -393219, 65538, 3, -393224, 65538, 3, -327688, 65538, 3, -458760, 65538, 3, -458759, 65538, 3, -458758, 65538, 3, -458757, 65538, 3, -458756, 65538, 3, -2, 65538, 3, -8, 65538, 3)
[node name="Character" parent="level" instance=ExtResource("5_7pfs4")]
z_index = 1
position = Vector2(1009, 772)
[node name="Trees" type="Node2D" parent="level"]
z_index = 1
y_sort_enabled = true
[node name="Tree3" parent="level/Trees" instance=ExtResource("4_f0l61")]
position = Vector2(1385, 434)
scale = Vector2(1.4, 1.4)
[node name="Tree2" parent="level/Trees" instance=ExtResource("4_f5et7")]
position = Vector2(844, 606)
scale = Vector2(1.3, 1.3)
[node name="Tree4" parent="level/Trees" instance=ExtResource("4_f5et7")]
position = Vector2(1231, 1053)
scale = Vector2(1.3, 1.3)
[node name="Tree5" parent="level/Trees" instance=ExtResource("4_f5et7")]
position = Vector2(1608, 740)
scale = Vector2(1.3, 1.3)
[node name="UI" parent="." instance=ExtResource("14_jp8qw")]
visible = false

View File

@@ -0,0 +1,34 @@
[gd_scene load_steps=5 format=2]
[ext_resource path="res://scenes/characters/DespawnFx.gd" type="Script" id=1]
[ext_resource path="res://textures/pj/smoke_particle.png" type="Texture2D" id=2]
[sub_resource type="Curve" id=1]
min_value = -360.0
max_value = 360.0
_data = [ Vector2( 0, 1 ), 0.0, 0.0, 0, 0, Vector2( 1, 1 ), 0.0, 0.0, 0, 0 ]
[sub_resource type="Curve" id=2]
_data = [ Vector2( 0, 1 ), 0.0, 0.0, 0, 0, Vector2( 0.383915, 0.8806 ), -1.68353, -1.68353, 0, 0, Vector2( 1, 0.0885999 ), -0.00244711, 0.0, 0, 0 ]
[node name="despawn_fx" type="CPUParticles2D"]
position = Vector2( 443.999, 413.999 )
emitting = false
amount = 16
lifetime = 0.5
one_shot = true
explosiveness = 1.0
texture = ExtResource( 2 )
direction = Vector2( 0, -1 )
gravity = Vector2( 0, 0 )
initial_velocity = 1500.0
initial_velocity_random = 0.5
angular_velocity = 360.0
angular_velocity_random = 1.0
angular_velocity_curve = SubResource( 1 )
linear_accel = -5000.0
linear_accel_random = 0.2
damping = 100.0
scale_amount_random = 0.5
scale_amount_curve = SubResource( 2 )
script = ExtResource( 1 )

43
scenes/misc/Dialog_box.gd Normal file
View File

@@ -0,0 +1,43 @@
extends TextureRect
class_name DialogBox
"""
Exposes the show_dialog function to the Dialogs singleton.
Will show a dialog box with the name of the character and
dialog text, two lines at a time.
"""
@onready var dialog_text = $dialog_text
# warning-ignore:unused_signal
signal dialog_started
# warning-ignore:unused_signal
signal dialog_ended
var lines_to_skip = 0
func _ready():
Dialogs.dialog_box = self
hide()
pass # Replace with function body.
func show_dialog(new_text, speaker):
dialog_text.text = new_text
$nametag/label.text = speaker
lines_to_skip = 0
dialog_text.lines_skipped = lines_to_skip
$anims.play("appear")
pass
func _input(event):
if event.is_action_pressed("interact"):
match $anims.assigned_animation:
"show_text":
$anims.play("wait")
"wait":
lines_to_skip += 2
if lines_to_skip < dialog_text.get_line_count():
dialog_text.lines_skipped = lines_to_skip
$anims.play("show_text")
else:
$anims.play("disappear")

277
scenes/misc/Dialog_box.tscn Normal file
View File

@@ -0,0 +1,277 @@
[gd_scene load_steps=9 format=2]
[ext_resource path="res://fonts/dialog.tres" type="FontFile" id=1]
[ext_resource path="res://scenes/misc/Dialog_box.gd" type="Script" id=2]
[ext_resource path="res://textures/misc/dialog_box.png" type="Texture2D" id=3]
[ext_resource path="res://textures/misc/next_dialog_arrow.png" type="Texture2D" id=4]
[sub_resource type="Animation" id=1]
resource_name = "appear"
length = 0.1
step = 0.01
tracks/0/type = "value"
tracks/0/path = NodePath("dialog_text:visible_characters")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/keys = {
"times": PackedFloat32Array( 0 ),
"transitions": PackedFloat32Array( 1 ),
"update": 1,
"values": [ 0 ]
}
tracks/1/type = "value"
tracks/1/path = NodePath(".:modulate")
tracks/1/interp = 1
tracks/1/loop_wrap = true
tracks/1/imported = false
tracks/1/enabled = true
tracks/1/keys = {
"times": PackedFloat32Array( 0, 0.1 ),
"transitions": PackedFloat32Array( 1, 1 ),
"update": 0,
"values": [ Color( 1, 1, 1, 0 ), Color( 1, 1, 1, 1 ) ]
}
tracks/2/type = "value"
tracks/2/path = NodePath(".:visible")
tracks/2/interp = 1
tracks/2/loop_wrap = true
tracks/2/imported = false
tracks/2/enabled = true
tracks/2/keys = {
"times": PackedFloat32Array( 0 ),
"transitions": PackedFloat32Array( 1 ),
"update": 1,
"values": [ true ]
}
tracks/3/type = "method"
tracks/3/path = NodePath(".")
tracks/3/interp = 1
tracks/3/loop_wrap = true
tracks/3/imported = false
tracks/3/enabled = true
tracks/3/keys = {
"times": PackedFloat32Array( 0 ),
"transitions": PackedFloat32Array( 1 ),
"values": [ {
"args": [ "dialog_started" ],
"method": "emit_signal"
} ]
}
tracks/4/type = "value"
tracks/4/path = NodePath(".:position")
tracks/4/interp = 1
tracks/4/loop_wrap = true
tracks/4/imported = false
tracks/4/enabled = true
tracks/4/keys = {
"times": PackedFloat32Array( 0.00472333, 0.1 ),
"transitions": PackedFloat32Array( 1, 1 ),
"update": 0,
"values": [ Vector2( 0, 585 ), Vector2( 0, 427 ) ]
}
tracks/5/type = "method"
tracks/5/path = NodePath("dialog_text")
tracks/5/interp = 1
tracks/5/loop_wrap = true
tracks/5/imported = false
tracks/5/enabled = true
tracks/5/keys = {
"times": PackedFloat32Array( 0.1 ),
"transitions": PackedFloat32Array( 1 ),
"values": [ {
"args": [ "resized" ],
"method": "emit_signal"
} ]
}
[sub_resource type="Animation" id=2]
resource_name = "disappear"
length = 0.1
tracks/0/type = "value"
tracks/0/path = NodePath(".:modulate")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/keys = {
"times": PackedFloat32Array( 0, 0.1 ),
"transitions": PackedFloat32Array( 1, 1 ),
"update": 0,
"values": [ Color( 1, 1, 1, 1 ), Color( 1, 1, 1, 0 ) ]
}
tracks/1/type = "value"
tracks/1/path = NodePath(".:visible")
tracks/1/interp = 1
tracks/1/loop_wrap = true
tracks/1/imported = false
tracks/1/enabled = true
tracks/1/keys = {
"times": PackedFloat32Array( 0.1 ),
"transitions": PackedFloat32Array( 1 ),
"update": 1,
"values": [ false ]
}
tracks/2/type = "method"
tracks/2/path = NodePath(".")
tracks/2/interp = 1
tracks/2/loop_wrap = true
tracks/2/imported = false
tracks/2/enabled = true
tracks/2/keys = {
"times": PackedFloat32Array( 0 ),
"transitions": PackedFloat32Array( 1 ),
"values": [ {
"args": [ "dialog_ended" ],
"method": "emit_signal"
} ]
}
tracks/3/type = "value"
tracks/3/path = NodePath(".:position")
tracks/3/interp = 1
tracks/3/loop_wrap = true
tracks/3/imported = false
tracks/3/enabled = true
tracks/3/keys = {
"times": PackedFloat32Array( 0, 0.1 ),
"transitions": PackedFloat32Array( 1, 1 ),
"update": 0,
"values": [ Vector2( 0, 427 ), Vector2( 0, 582 ) ]
}
[sub_resource type="Animation" id=3]
length = 2.0
tracks/0/type = "value"
tracks/0/path = NodePath("dialog_text:visible_characters")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/keys = {
"times": PackedFloat32Array( 0, 2 ),
"transitions": PackedFloat32Array( 1, 1 ),
"update": 0,
"values": [ 0, 150 ]
}
tracks/1/type = "value"
tracks/1/path = NodePath("next_dialog_arrow:visible")
tracks/1/interp = 1
tracks/1/loop_wrap = true
tracks/1/imported = false
tracks/1/enabled = true
tracks/1/keys = {
"times": PackedFloat32Array( 0 ),
"transitions": PackedFloat32Array( 1 ),
"update": 1,
"values": [ false ]
}
[sub_resource type="Animation" id=4]
loop = true
tracks/0/type = "value"
tracks/0/path = NodePath("next_dialog_arrow:visible")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/keys = {
"times": PackedFloat32Array( 0, 0.5 ),
"transitions": PackedFloat32Array( 1, 1 ),
"update": 1,
"values": [ true, false ]
}
tracks/1/type = "value"
tracks/1/path = NodePath("dialog_text:visible_characters")
tracks/1/interp = 1
tracks/1/loop_wrap = true
tracks/1/imported = false
tracks/1/enabled = true
tracks/1/keys = {
"times": PackedFloat32Array( 0 ),
"transitions": PackedFloat32Array( 1 ),
"update": 1,
"values": [ 150 ]
}
[node name="Dialog_box" type="TextureRect"]
anchor_top = 1.0
anchor_right = 1.0
anchor_bottom = 1.0
offset_top = -173.0
offset_bottom = 1.00024
texture = ExtResource( 3 )
expand = true
stretch_mode = 6
script = ExtResource( 2 )
__meta__ = {
"_edit_use_anchors_": false
}
[node name="dialog_text" type="Label" parent="."]
anchor_right = 1.0
anchor_bottom = 1.0
offset_left = 54.0
offset_top = 45.0
offset_right = -58.0
offset_bottom = -38.0
theme_override_fonts/font = ExtResource( 1 )
theme_override_colors/font_color = Color( 0, 0, 0, 1 )
text = "Lorem ipsum dolor sit amet, consectetur adipiscing elit. In semper molestie erat, id aliquam nulla iaculis a. Suspendisse consectetur vehicula consequat. Integer mollis libero sed sem convallis, vitae rutrum metus dapibus. Phasellus purus quam, euismod id diam ut, semper sagittis ipsum. Aenean vel mollis lectus, quis placerat eros. Donec elementum vestibulum augue dignissim vehicula. Mauris ultricies lacus id odio aliquet, eu iaculis urna sodales. "
autowrap = true
clip_text = true
percent_visible = 0.0
__meta__ = {
"_edit_use_anchors_": false
}
[node name="next_dialog_arrow" type="TextureRect" parent="."]
visible = false
anchor_left = 1.0
anchor_top = 1.0
anchor_right = 1.0
anchor_bottom = 1.0
offset_left = -121.545
offset_top = -52.964
offset_right = -66.5452
offset_bottom = -6.96399
texture = ExtResource( 4 )
expand = true
stretch_mode = 6
__meta__ = {
"_edit_use_anchors_": false
}
[node name="nametag" type="TextureRect" parent="."]
offset_left = 31.0
offset_top = 1.0
offset_right = 524.0
offset_bottom = 45.0
texture = ExtResource( 3 )
expand = true
__meta__ = {
"_edit_use_anchors_": false
}
[node name="label" type="Label" parent="nametag"]
anchor_left = 0.5
anchor_top = 0.5
anchor_right = 0.5
anchor_bottom = 0.5
offset_left = -227.5
offset_top = -21.0
offset_right = 227.5
offset_bottom = 22.0
theme_override_fonts/font = ExtResource( 1 )
theme_override_colors/font_color = Color( 0, 0, 0, 1 )
text = "Character Name"
align = 1
clip_text = true
[node name="anims" type="AnimationPlayer" parent="."]
anims/appear = SubResource( 1 )
anims/disappear = SubResource( 2 )
anims/show_text = SubResource( 3 )
anims/wait = SubResource( 4 )
next/appear = "show_text"
next/show_text = "wait"

25
scenes/misc/Exit.gd Normal file
View File

@@ -0,0 +1,25 @@
extends Area2D
class_name Exit
"""
Add this to any area2d and it will send the player to the indicated scene and spawnpoint
"""
@export var to_scene = "" # (String, FILE, "*.tscn")
@export var spawnpoint: String = ""
# Called when the node enters the scene tree for the first time.
func _ready():
body_entered.connect(_on_body_entered, CONNECT_DEFERRED)
func _on_body_entered(body):
if body is Player:
if to_scene == "":
push_error("Error changing scenes: to_scene has no assigned scene")
return false
Globals.spawnpoint = spawnpoint
Globals.current_level = to_scene
if get_tree().change_scene_to_file(to_scene) != OK:
push_error("Error changing scene")
pass

31
scenes/misc/Healthbar.gd Normal file
View File

@@ -0,0 +1,31 @@
extends HBoxContainer
"""
Connects to the player node and shows a health bar in the form of hearts
"""
var player : Player = null
var heart_scene = preload("res://scenes/misc/Heart.tscn")
# Called when the node enters the scene tree for the first time.
func _ready():
# Try to get the player node. If null wait till next frame, rinse, repeat.
while (player == null):
var player_group = get_tree().get_nodes_in_group("player")
if not player_group.is_empty():
player = player_group.pop_front()
else:
await get_tree().idle_frame
player.health_changed.connect(_on_health_changed)
_on_health_changed(player.hitpoints)
pass # Replace with function body.
# You should probably rewrite this.
func _on_health_changed(new_hp):
for child in get_children():
child.queue_free()
for i in new_hp:
var heart = heart_scene.instantiate()
add_child(heart)

View File

@@ -0,0 +1,13 @@
[gd_scene load_steps=2 format=2]
[ext_resource path="res://scenes/misc/Healthbar.gd" type="Script" id=1]
[node name="Healthbar" type="HBoxContainer"]
offset_left = 8.0
offset_top = 11.0
offset_right = 115.0
offset_bottom = 39.0
script = ExtResource( 1 )
__meta__ = {
"_edit_use_anchors_": false
}

8
scenes/misc/Heart.tscn Normal file
View File

@@ -0,0 +1,8 @@
[gd_scene load_steps=2 format=3 uid="uid://dbue8p0cttono"]
[ext_resource type="Texture2D" uid="uid://d0ixmmo0xq2ua" path="res://textures/misc/heart.png" id="1"]
[node name="heart" type="TextureRect"]
offset_right = 33.0
offset_bottom = 28.0
texture = ExtResource("1")

View File

@@ -0,0 +1,19 @@
extends Marker2D
"""
Add this to any node. spawn instances an Item.tscn node with the defined values
"""
var item_scene = preload("res://scenes/items/Item.tscn")
@export var item_type: String = "Generic Item"
@export var amount: int = 1
func spawn():
var item = item_scene.instantiate()
owner.get_parent().add_child(item)
item.global_position = global_position
item.item_type = item_type
item.amount = amount
pass

View File

@@ -0,0 +1,6 @@
[gd_scene load_steps=2 format=2]
[ext_resource path="res://scenes/misc/ItemSpawner.gd" type="Script" id=1]
[node name="item_spawner" type="Marker2D"]
script = ExtResource( 1 )

Some files were not shown because too many files have changed in this diff Show More