added sounds to ui and game, prepared interaction with character

This commit is contained in:
Luca 2024-10-12 14:30:39 +02:00
parent b5ace17da9
commit 21d7cf417a
42 changed files with 450 additions and 155 deletions

View file

@ -0,0 +1,22 @@
Hi! Thanks for downloading my pack!
# You don't need to credit me if you don't want, but I would be glad if you did so i can make more free packs for you in the future
# I can also make music specially for your game! If you want to work together text me at alkakrab04@gmail.com
Info:
Ambient: Used for ambience in walking and exploring your world!
Light Ambient: More light ambient tracks can be used at night time and perfect in the mix with normal Ambient.
Dark Ambient: Can be used in Caves, Ruins and other dark unsafe locations
Action: Used for fights and other action momments. Can be looped. (if you dont know how to loop trakcs i recomend you to check this video > https://www.youtube.com/watch?v=mEsDh-1szAQ&t=926s&ab_channel=StevenMelin
Fx: Used for Effects like Death or discovering something.
Enjoy!

Binary file not shown.

View file

@ -0,0 +1,19 @@
[remap]
importer="mp3"
type="AudioStreamMP3"
uid="uid://5r4hxp5tapmd"
path="res://.godot/imported/Unexpected Fight.mp3-e2d2805cd003ca2e49842b6283690843.mp3str"
[deps]
source_file="res://assets/sounds/ambient/Unexpected Fight.mp3"
dest_files=["res://.godot/imported/Unexpected Fight.mp3-e2d2805cd003ca2e49842b6283690843.mp3str"]
[params]
loop=false
loop_offset=0
bpm=0
beat_count=0
bar_beats=4

Binary file not shown.

View file

@ -0,0 +1,19 @@
[remap]
importer="mp3"
type="AudioStreamMP3"
uid="uid://djer0u77qblah"
path="res://.godot/imported/Unexplored Fields (A1).mp3-89ac2728509e940ddd11cc93d62a2984.mp3str"
[deps]
source_file="res://assets/sounds/ambient/Unexplored Fields (A1).mp3"
dest_files=["res://.godot/imported/Unexplored Fields (A1).mp3-89ac2728509e940ddd11cc93d62a2984.mp3str"]
[params]
loop=false
loop_offset=0
bpm=0
beat_count=0
bar_beats=4

View file

@ -0,0 +1,21 @@
Music Jingles
by Kenney Vleugels (Kenney.nl)
------------------------------
License (Creative Commons Zero, CC0)
http://creativecommons.org/publicdomain/zero/1.0/
You may use these assets in personal and commercial projects.
Credit (Kenney or www.kenney.nl) would be nice but is not mandatory.
------------------------------
Donate: http://support.kenney.nl
Request: http://request.kenney.nl
Follow on Twitter for updates:
@KenneyNL

Binary file not shown.

View file

@ -0,0 +1,24 @@
[remap]
importer="wav"
type="AudioStreamWAV"
uid="uid://cyv77gkpxckyg"
path="res://.godot/imported/fallback.wav-12dace9d086a520720d5a8c85629ab73.sample"
[deps]
source_file="res://assets/sounds/sfx/fallback.wav"
dest_files=["res://.godot/imported/fallback.wav-12dace9d086a520720d5a8c85629ab73.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

Binary file not shown.

View file

@ -0,0 +1,24 @@
[remap]
importer="wav"
type="AudioStreamWAV"
uid="uid://dpqlg53sl4k77"
path="res://.godot/imported/hit_sound.wav-16af41e62b08c76a4982f02b8056c4f5.sample"
[deps]
source_file="res://assets/sounds/sfx/hit_sound.wav"
dest_files=["res://.godot/imported/hit_sound.wav-16af41e62b08c76a4982f02b8056c4f5.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

Binary file not shown.

View file

@ -0,0 +1,19 @@
[remap]
importer="oggvorbisstr"
type="AudioStreamOggVorbis"
uid="uid://kj8vsi0sbfrk"
path="res://.godot/imported/jingles_STEEL10.ogg-3c9a36f5b2c4b9553b178dabc61a4d93.oggvorbisstr"
[deps]
source_file="res://assets/sounds/sfx/jingles_STEEL10.ogg"
dest_files=["res://.godot/imported/jingles_STEEL10.ogg-3c9a36f5b2c4b9553b178dabc61a4d93.oggvorbisstr"]
[params]
loop=false
loop_offset=0
bpm=0
beat_count=0
bar_beats=4

View file

@ -0,0 +1,22 @@
Interface Sounds (1.0)
Created/distributed by Kenney (www.kenney.nl)
Creation date: 11-02-2020
------------------------------
License: (Creative Commons Zero, CC0)
http://creativecommons.org/publicdomain/zero/1.0/
This content is free to use in personal, educational and commercial projects.
Support us by crediting Kenney or www.kenney.nl (this is not mandatory)
------------------------------
Donate: http://support.kenney.nl
Patreon: http://patreon.com/kenney/
Follow on Twitter for updates:
http://twitter.com/KenneyNL

Binary file not shown.

View file

@ -0,0 +1,19 @@
[remap]
importer="oggvorbisstr"
type="AudioStreamOggVorbis"
uid="uid://cb5ns3mxxh3xo"
path="res://.godot/imported/click_001.ogg-c14a202335a2fcf5fe71b3cf0e3bb6a6.oggvorbisstr"
[deps]
source_file="res://assets/sounds/sfx/ui/click_001.ogg"
dest_files=["res://.godot/imported/click_001.ogg-c14a202335a2fcf5fe71b3cf0e3bb6a6.oggvorbisstr"]
[params]
loop=false
loop_offset=0
bpm=0
beat_count=0
bar_beats=4

21
default_bus_layout.tres Normal file
View file

@ -0,0 +1,21 @@
[gd_resource type="AudioBusLayout" format=3 uid="uid://dtn45ifcd5a3w"]
[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/2/name = &"SFX"
bus/2/solo = false
bus/2/mute = false
bus/2/bypass_fx = false
bus/2/volume_db = 0.0
bus/2/send = &"Master"
bus/3/name = &"UI"
bus/3/solo = false
bus/3/mute = false
bus/3/bypass_fx = false
bus/3/volume_db = 0.0
bus/3/send = &"Master"

View file

@ -1,5 +1 @@
extends Node3D
func _on_area_3d_body_entered(body: Node3D) -> void:
print("%s entered" % body.name)
pass # Replace with function body.

View file

@ -1,9 +1,10 @@
[gd_scene load_steps=4 format=3 uid="uid://dibg4wpthwdov"]
[gd_scene load_steps=5 format=3 uid="uid://dibg4wpthwdov"]
[ext_resource type="Script" path="res://entities/healing_station/healing_station.gd" id="1_7biqd"]
[ext_resource type="ArrayMesh" uid="uid://dotngcuyvdg1v" path="res://assets/models/environment/kenney_nature-kit/bed.obj" id="2_m00qm"]
[sub_resource type="BoxShape3D" id="BoxShape3D_qkiex"]
size = Vector3(3.6, 2.5, 2.6)
size = Vector3(0.358923, 0.296997, 0.806982)
[sub_resource type="CylinderShape3D" id="CylinderShape3D_3nvn0"]
height = 1.0
@ -12,21 +13,22 @@ radius = 1.1
[node name="HealingStation" type="Node3D"]
script = ExtResource("1_7biqd")
[node name="Mesh" type="Node3D" parent="."]
[node name="Bed" type="MeshInstance3D" parent="."]
mesh = ExtResource("2_m00qm")
[node name="Collision" type="StaticBody3D" parent="."]
collision_layer = 2
collision_mask = 5
[node name="CollisionShape3D" type="CollisionShape3D" parent="Collision"]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1.25, 0)
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.0159729, 0.148499, -0.0114014)
shape = SubResource("BoxShape3D_qkiex")
[node name="InteractableArea" type="Area3D" parent="."]
collision_layer = 8
[node name="CollisionShape3D" type="CollisionShape3D" parent="InteractableArea"]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 1.6, 0.5, 0)
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.5, 0)
shape = SubResource("CylinderShape3D_3nvn0")
[connection signal="body_entered" from="InteractableArea" to="." method="_on_area_3d_body_entered"]

View file

@ -41,7 +41,7 @@ func _physics_process(delta: float) -> void:
var collider: Object = collision.get_collider()
# if the monster collided with the player...
if collider.name == "Player":
if collider.name == "Player" and collider.battle_state == Enums.BattleState.NOT_IN_BATTLE:
velocity = Vector3.ZERO
in_battle = true
collider.start_battle(self)

View file

@ -10,13 +10,17 @@ var player_monster: Monster = null
var enemy: Monster = null
## Movement
const SPEED : float = 5.0
const JUMP_VELOCITY : float = 4.5
const SPEED: float = 5.0
const JUMP_VELOCITY: float = 4.5
const ROTATION_SPEED: float = 12.0
func _ready() -> void:
# Set the global reference to the player
Utils.set_player(self)
# Connect the event from the joysticks click
get_viewport().get_tree().get_root().find_child("JoystickPanel", true, false).connect("on_interact", interact)
func _physics_process(delta: float) -> void:
# If the player is in a battle, handle it via start_battle and then handle_battle
@ -59,7 +63,8 @@ func _physics_process(delta: float) -> void:
# Move character to the direction
if direction.length() != 0:
$GobotSkin.rotation.y = atan2(direction.x,direction.z)
var target_angle: float = Vector3.BACK.signed_angle_to(direction, Vector3.UP)
$GobotSkin.rotation.y = lerp_angle(%GobotSkin.rotation.y, target_angle, ROTATION_SPEED * delta)
if direction:
velocity.x = direction.x * SPEED
@ -77,6 +82,7 @@ func _physics_process(delta: float) -> void:
func on_save_game(saved_data : Array[SavedData]) -> void:
var data : SavedData = SavedData.new()
data.position = global_position
data.rotation = rotation
data.scene_path = scene_file_path
saved_data.append(data)
@ -88,11 +94,16 @@ func on_before_load_game() -> void:
func on_load_game(saved_data: SavedData) -> void:
global_position = saved_data.position
rotation = saved_data.rotation
# Update the global reference to the player
Utils.set_player(self)
func interact() -> void:
print("interact")
func handle_battle() -> void:
match battle_state:
@ -123,6 +134,7 @@ func handle_battle() -> void:
# The enemy can currently only attack
var damage_amount: int = enemy.attack_enemy(player_monster)
UI.battle_ui.set_message("The enemy attacked you for %s damage!" % str(damage_amount))
SoundManager.play_sound_effect("Hit")
await get_tree().create_timer(1.0).timeout
UI.battle_ui.update()
@ -134,11 +146,14 @@ func handle_battle() -> void:
await get_tree().create_timer(3.0).timeout
Enums.BattleState.WIN:
SoundManager.play_sound_effect("Battle Win")
SoundManager.play_background_music("Unexplored Fields")
UI.battle_ui.disable()
UI.battle_ui.set_message("You won!")
await get_tree().create_timer(2.0).timeout
# End the battle and reset some states
# TODO: Maybe add a cooldown of 1.5s after the battle ended
battle_state = Enums.BattleState.NOT_IN_BATTLE
enemy.queue_free()
player_monster.queue_free()
@ -150,17 +165,19 @@ func handle_battle() -> void:
print("You gained %s xp!" % str(gained_xp))
Enums.BattleState.LOSE:
print("LOSE")
SoundManager.play_sound_effect("Lost Battle")
await get_tree().create_timer(3.0).timeout
## This method sets up a battle between the player and an enemy monster
func start_battle(p_enemy: Monster) -> void:
# Don't start a battle if we are already in one
# TODO: Maybe add a cooldown of 1.5s after the battle ended
if battle_state != Enums.BattleState.NOT_IN_BATTLE:
return
# TODO: Add a "surprise!" sound effect and an emoji to the players head
SoundManager.play_background_music("Unexpected Fight")
# Stop the player
velocity = Vector3.ZERO
animated_mesh.idle()
@ -172,12 +189,16 @@ func start_battle(p_enemy: Monster) -> void:
var local_z: Vector3 = camera.global_transform.basis.z
# Get the new player and monster positions
var new_player_position: Vector3 = camera.global_transform.origin + local_z * 3
var monster_position: Vector3 = camera.global_transform.origin + local_z * 3
var new_player_position: Vector3 = camera.global_transform.origin + local_z * 4
var monster_position: Vector3 = camera.global_transform.origin + local_z * 2
# Set the players new position
position = Vector3(new_player_position.x, position.y, new_player_position.z)
# and set the camera to the middle of the two involved monsters
#var new_camera_root_position: Vector3 = (p_enemy.global_position - monster_position) / 2.0 + monster_position
#%CameraRoot.global_position = Vector3(new_camera_root_position.x, %CameraRoot.global_position.y, new_camera_root_position.z)
# Change the UI
UI.show_battle_ui(true)
UI.show_ingame_controls(false)
@ -191,8 +212,9 @@ func start_battle(p_enemy: Monster) -> void:
# And add it to the monster
player_monster.data = monster_data
player_monster.idle = true
player_monster.position = Vector3(monster_position.x, position.y + 1, monster_position.z)
add_child(player_monster)
self.add_child(player_monster)
player_monster.global_position = Vector3(monster_position.x, position.y + 1, monster_position.z)
player_monster.look_at(enemy.position, Vector3.UP, true)
# Get into the battle and switch between the states
battle_state = Enums.BattleState.STARTED
@ -202,9 +224,10 @@ func start_battle(p_enemy: Monster) -> void:
func attack_enemy() -> void:
UI.battle_ui.disable()
UI.battle_ui.set_message("You attacked the enemy!")
SoundManager.play_sound_effect("Hit")
await get_tree().create_timer(1.0).timeout
# this should rather be player_monster.attack_enemy(enemy) for correct values
# FIXME: this must be changed to player_monster.attack_enemy(enemy) for correct values
enemy.take_damage(10)
UI.battle_ui.update()
await get_tree().create_timer(1.0).timeout

View file

@ -22,6 +22,7 @@ transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.85, 0)
shape = SubResource("CapsuleShape3D_xuba7")
[node name="CameraRoot" type="Node3D" parent="."]
unique_name_in_owner = true
[node name="SpringArm3D" type="SpringArm3D" parent="CameraRoot"]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 2.64528, 2.83335)

View file

@ -1,5 +1,5 @@
extends Resource
class_name MusicFile
class_name SoundFile
@export var file: AudioStream
@export var name: String

View file

@ -1,10 +0,0 @@
extends Node
@export var music: Array[MusicFile]
func play(_file: String) -> void:
pass
# Called when the node enters the scene tree for the first time.
func _ready() -> void:
pass # Replace with function body.

View file

@ -1,12 +0,0 @@
[gd_scene load_steps=4 format=3 uid="uid://boxny6sh3y05y"]
[ext_resource type="Script" path="res://globals/background_music_manager.gd" id="1_ngng4"]
[ext_resource type="Script" path="res://globals/MusicFile.gd" id="2_d24t4"]
[sub_resource type="Resource" id="Resource_rphwp"]
script = ExtResource("2_d24t4")
name = ""
[node name="BackgroundMusicManager" type="Node"]
script = ExtResource("1_ngng4")
music = Array[ExtResource("2_d24t4")]([SubResource("Resource_rphwp")])

39
globals/sound_manager.gd Normal file
View file

@ -0,0 +1,39 @@
extends Node
@export var music: Array[SoundFile]
@export var sfx: Array[SoundFile]
const FALLBACK: AudioStream = preload("res://assets/sounds/sfx/fallback.wav")
@onready var background_music_player: AudioStreamPlayer = %BackgroundMusicPlayer
var current_background_music: SoundFile = null
func play_background_music(resource_name: String) -> void:
var sound_file: SoundFile = get_sound_file_resource(resource_name, music)
background_music_player.stream = sound_file.file
background_music_player.play()
current_background_music = sound_file
func play_sound_effect(resource_name: String, p_bus: String = "SFX") -> void:
var sound_file: SoundFile = get_sound_file_resource(resource_name, sfx)
# Create a new unlocalized sound effect
var sfx_player: AudioStreamPlayer = AudioStreamPlayer.new()
sfx_player.bus = p_bus
sfx_player.stream = sound_file.file
sfx_player.finished.connect(sfx_player.queue_free)
self.add_child(sfx_player)
sfx_player.play()
func get_sound_file_resource(_name: String, array: Array) -> Variant:
for sound_file: SoundFile in array:
if sound_file.name == _name:
return sound_file
# No sound file with the specified name could be found. Oops!
push_warning("No Sound effect named \"%s\" could be found." % _name)
var oops: SoundFile = SoundFile.new()
oops.file = FALLBACK
return oops

View file

@ -0,0 +1,19 @@
[gd_scene load_steps=8 format=3 uid="uid://boxny6sh3y05y"]
[ext_resource type="Script" path="res://globals/sound_manager.gd" id="1_n6pv8"]
[ext_resource type="Script" path="res://globals/SoundFile.gd" id="2_vxk68"]
[ext_resource type="Resource" uid="uid://bva8fufmwcsey" path="res://resources/sounds/unexplored_fields.tres" id="3_f5ali"]
[ext_resource type="Resource" uid="uid://cuxdo1enalicx" path="res://resources/sounds/unexpected_fight.tres" id="4_fn62j"]
[ext_resource type="Resource" uid="uid://b3j8y8bt76o12" path="res://resources/sounds/battle_win.tres" id="5_tids3"]
[ext_resource type="Resource" uid="uid://dydn8rsdjxa5k" path="res://resources/sounds/hit.tres" id="6_ntddr"]
[ext_resource type="Resource" uid="uid://bk3bsmccptmuo" path="res://resources/sounds/ui_click.tres" id="7_sleq4"]
[node name="SoundManager" type="Node"]
script = ExtResource("1_n6pv8")
music = Array[ExtResource("2_vxk68")]([ExtResource("3_f5ali"), ExtResource("4_fn62j")])
sfx = Array[ExtResource("2_vxk68")]([ExtResource("5_tids3"), ExtResource("6_ntddr"), ExtResource("7_sleq4")])
[node name="BackgroundMusicPlayer" type="AudioStreamPlayer" parent="."]
unique_name_in_owner = true
volume_db = 5.0
bus = &"Music"

View file

@ -22,13 +22,13 @@ Enums="*res://globals/enums.gd"
Utils="*res://globals/utils.gd"
SaveManager="*res://resources/save_game/save_manager.gd"
SceneManager="*res://globals/scene_manager.gd"
BackgroundMusicManager="*res://globals/background_music_manager.tscn"
SoundManager="*res://globals/sound_manager.tscn"
UI="*res://ui/ui.tscn"
[debug]
gdscript/warnings/untyped_declaration=1
gdscript/warnings/inferred_declaration=1
gdscript/warnings/untyped_declaration=2
gdscript/warnings/inferred_declaration=2
[display]

View file

@ -4,7 +4,9 @@ extends Resource
# Every node's save data extends from this class
# Position of the node to save
@export var position : Vector3 = Vector3.ZERO
@export var position: Vector3 = Vector3.ZERO
@export var rotation: Vector3 = Vector3.ZERO
# Path to the scene of the node
@export var scene_path : String = ""
@export var scene_path: String = ""

View file

@ -0,0 +1,9 @@
[gd_resource type="Resource" script_class="SoundFile" load_steps=3 format=3 uid="uid://b3j8y8bt76o12"]
[ext_resource type="AudioStream" uid="uid://kj8vsi0sbfrk" path="res://assets/sounds/sfx/jingles_STEEL10.ogg" id="1_ip0sm"]
[ext_resource type="Script" path="res://globals/SoundFile.gd" id="2_1fdy4"]
[resource]
script = ExtResource("2_1fdy4")
file = ExtResource("1_ip0sm")
name = "Battle Win"

View file

@ -0,0 +1,9 @@
[gd_resource type="Resource" script_class="SoundFile" load_steps=3 format=3 uid="uid://dydn8rsdjxa5k"]
[ext_resource type="AudioStream" uid="uid://dpqlg53sl4k77" path="res://assets/sounds/sfx/hit_sound.wav" id="1_ch1it"]
[ext_resource type="Script" path="res://globals/SoundFile.gd" id="2_7bpbo"]
[resource]
script = ExtResource("2_7bpbo")
file = ExtResource("1_ch1it")
name = "Hit"

View file

@ -0,0 +1,9 @@
[gd_resource type="Resource" script_class="SoundFile" load_steps=3 format=3 uid="uid://bk3bsmccptmuo"]
[ext_resource type="AudioStream" uid="uid://cb5ns3mxxh3xo" path="res://assets/sounds/sfx/ui/click_001.ogg" id="1_10jjn"]
[ext_resource type="Script" path="res://globals/SoundFile.gd" id="2_7itki"]
[resource]
script = ExtResource("2_7itki")
file = ExtResource("1_10jjn")
name = "ui_click"

View file

@ -0,0 +1,9 @@
[gd_resource type="Resource" script_class="SoundFile" load_steps=3 format=3 uid="uid://cuxdo1enalicx"]
[ext_resource type="Script" path="res://globals/SoundFile.gd" id="1_p7ue7"]
[ext_resource type="AudioStream" uid="uid://5r4hxp5tapmd" path="res://assets/sounds/ambient/Unexpected Fight.mp3" id="1_ubk4a"]
[resource]
script = ExtResource("1_p7ue7")
file = ExtResource("1_ubk4a")
name = "Unexpected Fight"

View file

@ -0,0 +1,9 @@
[gd_resource type="Resource" script_class="SoundFile" load_steps=3 format=3 uid="uid://bva8fufmwcsey"]
[ext_resource type="AudioStream" uid="uid://djer0u77qblah" path="res://assets/sounds/ambient/Unexplored Fields (A1).mp3" id="1_yf875"]
[ext_resource type="Script" path="res://globals/SoundFile.gd" id="2_rb28l"]
[resource]
script = ExtResource("2_rb28l")
file = ExtResource("1_yf875")
name = "Unexplored Fields"

View file

@ -1,4 +1,4 @@
[gd_resource type="Theme" load_steps=25 format=3 uid="uid://xfq6d5yqsdh5"]
[gd_resource type="Theme" load_steps=29 format=3 uid="uid://xfq6d5yqsdh5"]
[ext_resource type="FontFile" uid="uid://diuo1i0qhrx72" path="res://assets/fonts/Kenney Future.ttf" id="1_7olm8"]
[ext_resource type="Texture2D" uid="uid://dqvcyivxd6quf" path="res://assets/textures/kenney_ui-pack/PNG/Grey/Double/button_rectangle_flat.png" id="1_cagdw"]
@ -6,6 +6,7 @@
[ext_resource type="Texture2D" uid="uid://0mrw1tw5533y" path="res://assets/textures/kenney_ui-pack/PNG/Blue/Double/check_square_grey.png" id="4_ejwd8"]
[ext_resource type="Texture2D" uid="uid://fuvect3s8xob" path="res://assets/textures/kenney_ui-pack/PNG/Extra/Double/input_outline_rectangle.png" id="5_0ives"]
[ext_resource type="Texture2D" uid="uid://bssj4xg6tgdon" path="res://assets/textures/kenney_ui-pack/PNG/Grey/Double/button_rectangle_depth_flat.png" id="6_afi76"]
[ext_resource type="Texture2D" uid="uid://bgc1chloftw3i" path="res://assets/textures/kenney_ui-pack/PNG/Red/Double/button_rectangle_flat.png" id="7_2hwk4"]
[ext_resource type="Texture2D" uid="uid://2aourrhwc2vr" path="res://assets/textures/kenney_ui-pack/PNG/Blue/Double/slide_hangle_rotated.png" id="7_d7yi5"]
[ext_resource type="Texture2D" uid="uid://sy5kn23lahn0" path="res://assets/textures/kenney_ui-pack/PNG/Grey/Double/slide_hangle_rotated.png" id="8_vvus7"]
[ext_resource type="Texture2D" uid="uid://yivq8q3se8t" path="res://assets/textures/kenney_ui-pack/PNG/Blue/Double/slide_vertical_grey.png" id="9_epdci"]
@ -96,6 +97,17 @@ texture_margin_bottom = 8.0
[sub_resource type="StyleBoxTexture" id="StyleBoxTexture_cwwj3"]
texture = ExtResource("6_afi76")
texture_margin_left = 12.0
texture_margin_top = 12.0
texture_margin_right = 12.0
texture_margin_bottom = 20.0
expand_margin_left = 4.0
expand_margin_top = 4.0
expand_margin_right = 4.0
expand_margin_bottom = 4.0
[sub_resource type="StyleBoxTexture" id="StyleBoxTexture_nkhdn"]
texture = ExtResource("6_afi76")
texture_margin_left = 8.0
texture_margin_top = 8.0
texture_margin_right = 8.0
@ -105,6 +117,21 @@ expand_margin_top = 4.0
expand_margin_right = 4.0
expand_margin_bottom = 4.0
[sub_resource type="StyleBoxTexture" id="StyleBoxTexture_k5ktt"]
texture = ExtResource("7_2hwk4")
texture_margin_left = 20.0
texture_margin_top = 14.0
texture_margin_right = 20.0
texture_margin_bottom = 14.0
modulate_color = Color(0.8, 0.8, 0.8, 1)
[sub_resource type="StyleBoxTexture" id="StyleBoxTexture_35fmy"]
texture = ExtResource("7_2hwk4")
texture_margin_left = 20.0
texture_margin_top = 14.0
texture_margin_right = 20.0
texture_margin_bottom = 14.0
[sub_resource type="StyleBoxTexture" id="StyleBoxTexture_872kh"]
texture = ExtResource("9_epdci")
region_rect = Rect2(8, 30, 16, 16)
@ -121,6 +148,7 @@ Button/colors/font_color = Color(0.301961, 0.301961, 0.301961, 1)
Button/colors/font_disabled_color = Color(0.7, 0.7, 0.7, 0.784314)
Button/colors/font_hover_color = Color(0.2, 0.2, 0.2, 1)
Button/colors/font_pressed_color = Color(0.4, 0.4, 0.4, 1)
Button/colors/icon_normal_color = Color(0.827833, 0.105612, 0.719122, 1)
Button/font_sizes/font_size = 24
Button/fonts/font = ExtResource("1_7olm8")
Button/styles/disabled = SubResource("StyleBoxTexture_p6kuw")
@ -146,6 +174,12 @@ Label/fonts/font = ExtResource("1_7olm8")
LineEdit/colors/font_color = Color(0.301961, 0.301961, 0.301961, 1)
LineEdit/styles/normal = SubResource("StyleBoxTexture_g7r8o")
Panel/styles/panel = SubResource("StyleBoxTexture_cwwj3")
PanelContainer/styles/panel = SubResource("StyleBoxTexture_nkhdn")
RedButton/base_type = &"Button"
RedButton/colors/font_color = Color(1, 1, 1, 1)
RedButton/colors/font_hover_color = Color(0.7, 0.7, 0.7, 1)
RedButton/styles/hover = SubResource("StyleBoxTexture_k5ktt")
RedButton/styles/normal = SubResource("StyleBoxTexture_35fmy")
VSlider/icons/grabber = ExtResource("7_d7yi5")
VSlider/icons/grabber_disabled = ExtResource("8_vvus7")
VSlider/icons/grabber_highlight = ExtResource("7_d7yi5")

View file

@ -2,6 +2,14 @@ extends Control
@onready var battle_moves_menu: VBoxContainer = %BattleMovesMenu
@onready var party_fighter_level: Label = %PartyFighterLevel
@onready var party_fighter_name: Label = %PartyFighterName
@onready var party_fighter_healthbar: ProgressBar = %PartyFighterHealthbar
@onready var enemy_monster_level: Label = %EnemyMonsterLevel
@onready var enemy_monster_name: Label = %EnemyMonsterName
@onready var enemy_monster_healthbar: ProgressBar = %EnemyMonsterHealthbar
var move_button: PackedScene = preload("res://ui/battle_ui/battle_move_button.tscn")
# Called when the node enters the scene tree for the first time.
@ -15,15 +23,15 @@ func update() -> void:
var player: Node3D = Utils.get_player()
var player_fighter: MonsterData = SaveManager.current_save.party[0] as MonsterData
%PartyFighterLevel.text = "Lv. %s" % str(player_fighter.level)
%PartyFighterName.text = player_fighter.nickname if not player_fighter.nickname.is_empty() else player_fighter.name
%PartyFighterHealthbar.max_value = player_fighter.health
%PartyFighterHealthbar.value = player_fighter.current_health
party_fighter_level.text = "Lv. %s" % str(player_fighter.level)
party_fighter_name.text = player_fighter.nickname if not player_fighter.nickname.is_empty() else player_fighter.name
party_fighter_healthbar.max_value = player_fighter.health
party_fighter_healthbar.value = player_fighter.current_health
%EnemyMonsterLevel.text = "Lv. %s" % player.enemy.data.level
%EnemyMonsterName.text = player.enemy.data.name
%EnemyMonsterHealthbar.max_value = player.enemy.data.health
%EnemyMonsterHealthbar.value = player.enemy.data.current_health
enemy_monster_level.text = "Lv. %s" % player.enemy.data.level
enemy_monster_name.text = player.enemy.data.name
enemy_monster_healthbar.max_value = player.enemy.data.health
enemy_monster_healthbar.value = player.enemy.data.current_health
func _on_battle_button_pressed() -> void:
print("attacking enemy")

View file

@ -1,12 +1,10 @@
[gd_scene load_steps=21 format=3 uid="uid://dyroahq85mhws"]
[gd_scene load_steps=13 format=3 uid="uid://dyroahq85mhws"]
[ext_resource type="Script" path="res://ui/battle_ui/battle_ui.gd" id="1_jyqir"]
[ext_resource type="Texture2D" uid="uid://ve2k0qrfpwxw" path="res://assets/textures/Generic/Vector/generic_button_circle_fill.svg" id="2_keyyt"]
[ext_resource type="Texture2D" uid="uid://4t8cotroofge" path="res://assets/textures/Game Icons/Vector/2x/upRight.png" id="3_fa6tk"]
[ext_resource type="StyleBox" uid="uid://ddtjhp2lob6to" path="res://ui/styles/battle_ui_normal_button.tres" id="4_r2q1k"]
[ext_resource type="Texture2D" uid="uid://cxry7h4q17lir" path="res://assets/textures/Game Icons/Vector/2x/star.png" id="4_saqy8"]
[ext_resource type="Texture2D" uid="uid://c1dlsfah0ioi5" path="res://assets/textures/Game Icons/Vector/2x/massiveMultiplayer.png" id="5_pnobx"]
[ext_resource type="StyleBox" uid="uid://cv8ispcxuwjn5" path="res://ui/styles/battle_ui_pressed_button.tres" id="5_w48y1"]
[ext_resource type="Texture2D" uid="uid://dbycrn4i3wkhu" path="res://assets/textures/Game Icons/Vector/2x/menuList.png" id="6_ikm1n"]
[ext_resource type="Texture2D" uid="uid://cs84avwwjbn5q" path="res://assets/textures/Game Icons/Vector/2x/exitRight.png" id="7_tihhr"]
@ -56,28 +54,6 @@ expand_margin_top = 1.0
expand_margin_right = 1.0
expand_margin_bottom = 1.0
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_jwbwi"]
bg_color = Color(0, 0, 0, 1)
border_width_left = 3
border_width_top = 3
border_width_right = 3
border_width_bottom = 3
border_color = Color(1, 1, 1, 1)
corner_radius_top_left = 6
corner_radius_top_right = 6
corner_radius_bottom_right = 6
corner_radius_bottom_left = 6
[sub_resource type="LabelSettings" id="LabelSettings_5e62u"]
[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_eqgks"]
[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_4ki2k"]
[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_cabkl"]
[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_g6kqv"]
[node name="BattleUI" type="Control"]
layout_mode = 3
anchors_preset = 15
@ -219,7 +195,6 @@ size_flags_vertical = 3
[node name="PanelContainer" type="PanelContainer" parent="BottomMarginContainer/VBoxContainer/MessageContainer"]
custom_minimum_size = Vector2(0, 100)
layout_mode = 2
theme_override_styles/panel = SubResource("StyleBoxFlat_jwbwi")
[node name="MarginContainer" type="MarginContainer" parent="BottomMarginContainer/VBoxContainer/MessageContainer/PanelContainer"]
layout_mode = 2
@ -232,8 +207,8 @@ theme_override_constants/margin_bottom = 8
unique_name_in_owner = true
layout_mode = 2
size_flags_vertical = 1
theme_override_colors/font_color = Color(0, 0, 0, 1)
text = "A wild monster appeared!"
label_settings = SubResource("LabelSettings_5e62u")
[node name="HBoxContainer" type="HBoxContainer" parent="BottomMarginContainer/VBoxContainer"]
layout_mode = 2
@ -349,18 +324,6 @@ unique_name_in_owner = true
layout_mode = 2
theme_override_constants/h_separation = 18
theme_override_constants/icon_max_width = 20
theme_override_font_sizes/font_size = 26
theme_override_styles/focus = SubResource("StyleBoxEmpty_eqgks")
theme_override_styles/disabled_mirrored = ExtResource("4_r2q1k")
theme_override_styles/disabled = ExtResource("4_r2q1k")
theme_override_styles/hover_pressed_mirrored = ExtResource("4_r2q1k")
theme_override_styles/hover_pressed = ExtResource("4_r2q1k")
theme_override_styles/hover_mirrored = ExtResource("4_r2q1k")
theme_override_styles/hover = ExtResource("4_r2q1k")
theme_override_styles/pressed_mirrored = ExtResource("5_w48y1")
theme_override_styles/pressed = ExtResource("5_w48y1")
theme_override_styles/normal_mirrored = ExtResource("4_r2q1k")
theme_override_styles/normal = ExtResource("4_r2q1k")
text = "Attack"
icon = ExtResource("4_saqy8")
alignment = 0
@ -370,18 +333,6 @@ unique_name_in_owner = true
layout_mode = 2
theme_override_constants/h_separation = 18
theme_override_constants/icon_max_width = 20
theme_override_font_sizes/font_size = 26
theme_override_styles/focus = SubResource("StyleBoxEmpty_4ki2k")
theme_override_styles/disabled_mirrored = ExtResource("4_r2q1k")
theme_override_styles/disabled = ExtResource("4_r2q1k")
theme_override_styles/hover_pressed_mirrored = ExtResource("4_r2q1k")
theme_override_styles/hover_pressed = ExtResource("4_r2q1k")
theme_override_styles/hover_mirrored = ExtResource("4_r2q1k")
theme_override_styles/hover = ExtResource("4_r2q1k")
theme_override_styles/pressed_mirrored = ExtResource("5_w48y1")
theme_override_styles/pressed = ExtResource("5_w48y1")
theme_override_styles/normal_mirrored = ExtResource("4_r2q1k")
theme_override_styles/normal = ExtResource("4_r2q1k")
text = "Party"
icon = ExtResource("5_pnobx")
alignment = 0
@ -391,18 +342,6 @@ unique_name_in_owner = true
layout_mode = 2
theme_override_constants/h_separation = 18
theme_override_constants/icon_max_width = 20
theme_override_font_sizes/font_size = 26
theme_override_styles/focus = SubResource("StyleBoxEmpty_cabkl")
theme_override_styles/disabled_mirrored = ExtResource("4_r2q1k")
theme_override_styles/disabled = ExtResource("4_r2q1k")
theme_override_styles/hover_pressed_mirrored = ExtResource("4_r2q1k")
theme_override_styles/hover_pressed = ExtResource("4_r2q1k")
theme_override_styles/hover_mirrored = ExtResource("4_r2q1k")
theme_override_styles/hover = ExtResource("4_r2q1k")
theme_override_styles/pressed_mirrored = ExtResource("5_w48y1")
theme_override_styles/pressed = ExtResource("5_w48y1")
theme_override_styles/normal_mirrored = ExtResource("4_r2q1k")
theme_override_styles/normal = ExtResource("4_r2q1k")
text = "Items"
icon = ExtResource("6_ikm1n")
alignment = 0
@ -412,18 +351,6 @@ unique_name_in_owner = true
layout_mode = 2
theme_override_constants/h_separation = 18
theme_override_constants/icon_max_width = 20
theme_override_font_sizes/font_size = 26
theme_override_styles/focus = SubResource("StyleBoxEmpty_g6kqv")
theme_override_styles/disabled_mirrored = ExtResource("4_r2q1k")
theme_override_styles/disabled = ExtResource("4_r2q1k")
theme_override_styles/hover_pressed_mirrored = ExtResource("4_r2q1k")
theme_override_styles/hover_pressed = ExtResource("4_r2q1k")
theme_override_styles/hover_mirrored = ExtResource("4_r2q1k")
theme_override_styles/hover = ExtResource("4_r2q1k")
theme_override_styles/pressed_mirrored = ExtResource("5_w48y1")
theme_override_styles/pressed = ExtResource("5_w48y1")
theme_override_styles/normal_mirrored = ExtResource("4_r2q1k")
theme_override_styles/normal = ExtResource("4_r2q1k")
text = "Run"
icon = ExtResource("7_tihhr")
alignment = 0

View file

@ -27,9 +27,11 @@ func _process(delta: float) -> void:
save_timer += delta
func _on_menu_button_pressed() -> void:
SoundManager.play_sound_effect("ui_click", "UI")
menu_button_clicked.emit()
func _on_settings_button_pressed() -> void:
SoundManager.play_sound_effect("ui_click", "UI")
settings_button_clicked.emit()
# the save function should work as follows:
@ -38,10 +40,12 @@ func _on_settings_button_pressed() -> void:
# during holding down, the percentage increases until 100%
# a finishing animation plays, the game is saved and the countdown disappears again
func _on_save_button_button_down() -> void:
SoundManager.play_sound_effect("ui_click", "UI")
save_button_held_down = true
save_button_clicked.emit()
func _on_save_button_button_up() -> void:
SoundManager.play_sound_effect("ui_click", "UI")
save_button_held_down = false
save_button_released.emit()
save_timer = 0.0

View file

@ -1,5 +1,7 @@
extends Panel
signal on_interact
@onready var talk_a_texture: CompressedTexture2D = preload("res://assets/textures/Xbox Series/Vector/xbox_button_a.svg")
@onready var drag_texture: CompressedTexture2D = preload("res://assets/textures/Generic/Vector/generic_button_circle.svg")
@onready var thumbstick: TextureRect = %Thumbstick
@ -30,7 +32,8 @@ func _on_gui_input(event: InputEvent) -> void:
thumbstick.texture = talk_a_texture
if event is InputEventScreenTouch and pressed == true:
Input.action_press("ui_select")
SoundManager.play_sound_effect("ui_click", "UI")
on_interact.emit()
pressed = false
if event is InputEventScreenTouch and event.is_pressed():
@ -46,8 +49,10 @@ func _on_gui_input(event: InputEvent) -> void:
# visual thumbstick movement
var thumbstick_position: Vector2 = touch_position - thumbstick.size / 2.0
#var clamped_thumbstick_position = thumbstick_position.clampf(-40.0, 40.0)
thumbstick.position = thumbstick_position
var thumbstick_center: Vector2 = middle - thumbstick.size / 2.0
var clamped_thumbstick_position: Vector2 = thumbstick_position.clamp(thumbstick_center - Vector2(50.0, 50.0), thumbstick_center + Vector2(50.0, 50.0))
thumbstick.position = clamped_thumbstick_position
# actual value
var _delta: Vector2 = middle - touch_position

View file

@ -1,12 +1,9 @@
[gd_scene load_steps=6 format=3 uid="uid://bbvbnrcjatkrb"]
[gd_scene load_steps=4 format=3 uid="uid://bbvbnrcjatkrb"]
[ext_resource type="Script" path="res://ui/ingame_menu/ingame_menu.gd" id="1_beinb"]
[ext_resource type="Texture2D" uid="uid://bhh31i3wgww43" path="res://assets/textures/Game Icons/Vector/2x/singleplayer.png" id="2_c2ia0"]
[ext_resource type="Texture2D" uid="uid://c737p2osplq2o" path="res://assets/textures/Xbox Series/Vector/xbox_button_x_outline.svg" id="3_kgfth"]
[ext_resource type="Texture2D" uid="uid://cxry7h4q17lir" path="res://assets/textures/Game Icons/Vector/2x/star.png" id="3_oo4iu"]
[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_flvbu"]
[node name="IngameMenu" type="Control"]
layout_mode = 3
anchors_preset = 15
@ -109,20 +106,19 @@ theme_override_constants/margin_right = 20
[node name="VBoxContainer" type="VBoxContainer" parent="MarginContainer/PanelContainer/VBoxContainer/MonsterListEntryContainer"]
layout_mode = 2
theme_override_constants/separation = 20
[node name="CloseButtonContainer" type="MarginContainer" parent="MarginContainer/PanelContainer/VBoxContainer"]
layout_mode = 2
theme_override_constants/margin_top = 32
theme_override_constants/margin_bottom = 32
[node name="CloseButton" type="Button" parent="MarginContainer/PanelContainer/VBoxContainer/CloseButtonContainer"]
unique_name_in_owner = true
self_modulate = Color(0, 0, 0, 1)
custom_minimum_size = Vector2(120, 120)
layout_mode = 2
size_flags_horizontal = 4
theme_override_styles/focus = SubResource("StyleBoxEmpty_flvbu")
icon = ExtResource("3_kgfth")
flat = true
theme_type_variation = &"RedButton"
text = "Close"
icon_alignment = 1
expand_icon = true

View file

@ -1,25 +1,23 @@
[gd_scene load_steps=9 format=3 uid="uid://brp2sljqnkuhe"]
[gd_scene load_steps=8 format=3 uid="uid://brp2sljqnkuhe"]
[ext_resource type="Script" path="res://ui/ingame_menu/party_list_entry.gd" id="1_gdhy7"]
[ext_resource type="Texture2D" uid="uid://b6ylra30qxf30" path="res://assets/logo/logo.png" id="2_rogma"]
[ext_resource type="Texture2D" uid="uid://2vxx2waofxpw" path="res://assets/textures/Xbox Series/Vector/xbox_button_menu_outline.svg" id="3_etjt6"]
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_s3mod"]
content_margin_top = 24.0
content_margin_top = 12.0
bg_color = Color(0.4, 0.5, 0.455, 1)
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_nb1sm"]
bg_color = Color(0, 0.843137, 0.466667, 1)
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_fkb5g"]
content_margin_top = 12.0
content_margin_top = 4.0
bg_color = Color(0.4, 0.466667, 0.5, 1)
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_b4pov"]
bg_color = Color(0, 0.56, 0.84, 1)
[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_x2rfb"]
[node name="PartyListEntry" type="PanelContainer"]
anchors_preset = 10
anchor_right = 1.0
@ -32,10 +30,12 @@ layout_mode = 2
[node name="Thumbnail" type="TextureRect" parent="HBoxContainer"]
unique_name_in_owner = true
custom_minimum_size = Vector2(70, 70)
custom_minimum_size = Vector2(50, 50)
layout_mode = 2
size_flags_vertical = 4
texture = ExtResource("2_rogma")
expand_mode = 3
expand_mode = 1
stretch_mode = 5
[node name="VBoxContainer" type="VBoxContainer" parent="HBoxContainer"]
layout_mode = 2
@ -100,11 +100,11 @@ show_percentage = false
[node name="SwapPositionButton" type="Button" parent="HBoxContainer"]
unique_name_in_owner = true
self_modulate = Color(0, 0, 0, 1)
custom_minimum_size = Vector2(100, 100)
custom_minimum_size = Vector2(30, 30)
layout_mode = 2
size_flags_horizontal = 8
theme_override_styles/focus = SubResource("StyleBoxEmpty_x2rfb")
size_flags_vertical = 4
theme_override_constants/icon_max_width = 32
icon = ExtResource("3_etjt6")
flat = true
icon_alignment = 1
expand_icon = true

View file

@ -8,6 +8,8 @@ signal on_game_continued
# On ready, check which buttons to show
func _ready() -> void:
SoundManager.play_background_music("Unexplored Fields")
if SaveManager.save_exists():
continue_game_button.visible = true
new_game_button.visible = false

View file

@ -1,4 +1,4 @@
[gd_scene load_steps=30 format=3 uid="uid://bhhqaysqjw2d"]
[gd_scene load_steps=31 format=3 uid="uid://bhhqaysqjw2d"]
[ext_resource type="PackedScene" uid="uid://dawpmu4vvv3rs" path="res://entities/monster_spawnpoint/monster_spawnpoint.tscn" id="1_3qqsk"]
[ext_resource type="Script" path="res://entities/monster_spawnpoint/monster_spawnpoint_probability.gd" id="2_pmb72"]
@ -22,6 +22,7 @@
[ext_resource type="ArrayMesh" uid="uid://dvcxsgd2tjhce" path="res://assets/models/environment/kenney_nature-kit/tree_small.obj" id="20_p3pyd"]
[ext_resource type="ArrayMesh" uid="uid://kk0vopaeqry0" path="res://assets/models/environment/kenney_nature-kit/tree_fat.obj" id="21_m2vvv"]
[ext_resource type="ArrayMesh" uid="uid://bkbtamud66sc8" path="res://assets/models/environment/kenney_nature-kit/grass_large.obj" id="22_ee3ig"]
[ext_resource type="PackedScene" uid="uid://dibg4wpthwdov" path="res://entities/healing_station/healing_station.tscn" id="23_3e3mn"]
[sub_resource type="ProceduralSkyMaterial" id="ProceduralSkyMaterial_xgcdx"]
sky_horizon_color = Color(0.64625, 0.65575, 0.67075, 1)
@ -224,3 +225,6 @@ skeleton = NodePath("../..")
transform = Transform3D(-1.12264, 0, -1.6552, 0, 2.5, 0, 1.6552, 0, -1.12264, -1.61198, 2.38419e-07, -7.95919)
mesh = ExtResource("22_ee3ig")
skeleton = NodePath("../..")
[node name="HealingStation" parent="." instance=ExtResource("23_3e3mn")]
transform = Transform3D(2.20826, 0, -2.03067, 0, 3, 0, 2.03067, 0, 2.20826, -7.5878, 0, -3.23348)