Compare commits

...

2 Commits

30 changed files with 283 additions and 24 deletions

View File

@@ -23,6 +23,7 @@ Point-and-click adventure game developed using Escoria framework and Godot engin
## Sound attributions:
- button_clicking.ogg | Button Clicking 1 by Sheyvan -- https://freesound.org/s/475188/ -- License: Creative Commons 0
- menu_button.ogg | Videogame Menu BUTTON CLICK by Christopherderp -- https://freesound.org/s/342200/ -- License: Creative Commons 0
- birds_ambient_loop.ogg | https://freesound.org/people/Garuda1982/sounds/691629/ -- License: Creative Commons 0
## Icon attributions:
- Translate button: Noun Project. Public domain

View File

@@ -6,7 +6,6 @@ extends TextureButton
@export var music_disabled_texture: Texture2D
@export var music_disabled_hover_texture: Texture2D
# Called when the node enters the scene tree for the first time.
func _ready():
gymkhana.music_manager.toggled.connect(_music_toggled)
set_texture(gymkhana.music_manager.music_enabled)

View File

@@ -1,4 +1,4 @@
# `music_enable`
# `force_music`
#
# Enable music volume
#

View File

@@ -0,0 +1,34 @@
# `play_game_music`
#
# Enable music volume
#
# @ESC
extends ESCBaseCommand
class_name PlayGameMusic
# Return the descriptor of the arguments of this command
func configure() -> ESCCommandArgumentDescriptor:
return ESCCommandArgumentDescriptor.new(
0,
[TYPE_INT],
[0]
)
# Validate wether the given arguments match the command descriptor
func validate(arguments: Array):
if gymkhana.music_manager.game_songs.size() <= arguments[0]:
return false
return super.validate(arguments)
# Run the command
func run(command_params: Array) -> int:
gymkhana.music_manager.play_game(command_params[0])
return ESCExecution.RC_OK
# Function called when the command is interrupted.
func interrupt():
# Do nothing
pass

View File

@@ -0,0 +1 @@
uid://djaltfgdliq57

View File

@@ -0,0 +1,28 @@
# `play_menu_music`
#
# Enable music volume
#
# @ESC
extends ESCBaseCommand
class_name PlayMenuMusic
# Return the descriptor of the arguments of this command
func configure() -> ESCCommandArgumentDescriptor:
return ESCCommandArgumentDescriptor.new()
# Validate wether the given arguments match the command descriptor
func validate(arguments: Array):
return super.validate(arguments)
# Run the command
func run(command_params: Array) -> int:
gymkhana.music_manager.play_menu()
return ESCExecution.RC_OK
# Function called when the command is interrupted.
func interrupt():
# Do nothing
pass

View File

@@ -0,0 +1 @@
uid://fk5rxeuobhve

View File

@@ -0,0 +1,28 @@
# `play_menu_music`
#
# Enable music volume
#
# @ESC
extends ESCBaseCommand
class_name PlayPalestinaMusic
# Return the descriptor of the arguments of this command
func configure() -> ESCCommandArgumentDescriptor:
return ESCCommandArgumentDescriptor.new()
# Validate wether the given arguments match the command descriptor
func validate(arguments: Array):
return super.validate(arguments)
# Run the command
func run(command_params: Array) -> int:
gymkhana.music_manager.play_palestina()
return ESCExecution.RC_OK
# Function called when the command is interrupted.
func interrupt():
# Do nothing
pass

View File

@@ -0,0 +1 @@
uid://b843rkmac55l6

View File

@@ -0,0 +1,34 @@
# `set_distance_to_music`
#
# Set audio filter resonance simulating distance to music
#
# @ESC
extends ESCBaseCommand
class_name SetDistanceToMusic
# Return the descriptor of the arguments of this command
func configure() -> ESCCommandArgumentDescriptor:
return ESCCommandArgumentDescriptor.new(
0,
[TYPE_INT, TYPE_FLOAT],
[0, 0.0]
)
# Validate wether the given arguments match the command descriptor
func validate(arguments: Array):
if gymkhana.music_manager.game_songs.size() <= arguments[0]:
return false
return super.validate(arguments)
# Run the command
func run(command_params: Array) -> int:
gymkhana.music_manager.set_distance_to_music(command_params[0], command_params[1])
return ESCExecution.RC_OK
# Function called when the command is interrupted.
func interrupt():
# Do nothing
pass

View File

@@ -0,0 +1 @@
uid://b6hle34ay06py

View File

@@ -76,11 +76,14 @@ func _init():
gymkhana.dev_tools_registry.register(preload("res://addons/escoria-ui-return-monkey-island/tools/dev/global_inspector.tscn").instantiate())
gymkhana.dev_tools_registry.register(preload("res://addons/escoria-ui-return-monkey-island/tools/dev/globals_watcher.tscn").instantiate())
func _ready():
# Must call after video player child is ready.
gymkhana.video_manager = RTMIVideoManager.new(video_player)
# Must call after escoria music player child is ready.
var esc_music_player = escoria.object_manager.get_object("_music").node
gymkhana.music_manager.esc_music_player = esc_music_player
tooltip_node = rtmi_tooltip_node
# We need a slightly modified version of Action Manager to combine items with different actions.
escoria.action_manager = ESCActionManagerMonkey.new()
@@ -94,6 +97,7 @@ func _ready():
func _enter_tree():
# We get current day and month
var time = Time.get_datetime_dict_from_system()
var day = time["day"]
@@ -308,7 +312,7 @@ func unpause_game():
escoria.main.current_scene.game.show_ui()
escoria.main.current_scene.show()
escoria.set_game_paused(false)
gymkhana.music_manager.play_game()
gymkhana.music_manager.resume()
func pause_game():
if escoria.current_state == escoria.GAME_STATE.PAUSED:

View File

@@ -0,0 +1 @@
uid://b3d1ai8oqx343

View File

@@ -10,6 +10,59 @@ var state: String:
set(new_state):
escoria.object_manager.get_object("_music").node.set_state(new_state)
var esc_music_player: ESCMusicPlayer:
set(music_player_node):
esc_music_player = music_player_node
esc_music_player.stream.connect("finished", _on_song_finished)
var _menu_song: String = "res://gymkhana/sounds/intro_menu_loop.ogg"
var _palestina_song: String = "res://gymkhana/sounds/music/leve palestina.ogg"
var game_songs: Array[String] = [
"res://gymkhana/sounds/music/Bossa do Uli.ogg",
"res://gymkhana/sounds/music/Orient minor.ogg",
"res://gymkhana/sounds/music/Rural latin.ogg",
"res://gymkhana/sounds/music/Swinging in the mountain.ogg",
"res://gymkhana/sounds/music/Windy chill.ogg",
]
var _is_menu = false
var _current_song_index: int = 0
var _last_playback_position
var _filter_effect: AudioEffect
var _filter_base_cutoff: float = 12000.0
var _filter_map: Dictionary = {
0: 12000.0,
1: 1000.0,
2: 500.0,
}
var _filter_base_gain: float = 1.0
var _filter_gain_ratio: float = 0.3
var _panner_effect: AudioEffectPanner
var _panner_default: float = 0
func _init() -> void:
#_filter_effect = AudioEffectFilter.new()
_filter_effect = AudioEffectLowPassFilter.new()
_filter_effect.cutoff_hz = _filter_map[0]
_filter_effect.resonance = 1.0
AudioServer.add_bus_effect(
AudioServer.get_bus_index(escoria.BUS_MUSIC),
_filter_effect)
_panner_effect = AudioEffectPanner.new()
_panner_effect.pan = _panner_default
AudioServer.add_bus_effect(
AudioServer.get_bus_index(escoria.BUS_MUSIC),
_panner_effect)
func toggle() -> void:
music_enabled = !music_enabled
@@ -21,21 +74,46 @@ func toggle() -> void:
toggled.emit(music_enabled)
func play_menu() -> void:
escoria.object_manager.get_object("_music").node.set_state(
"res://gymkhana/sounds/intro_menu_loop.ogg"
)
_disable_effects()
if state != "off" or state != "default":
_last_playback_position = esc_music_player.get_playback_position()
_play(_menu_song, true)
func play_game(index: int = 0) -> void:
_enable_effects()
if state == "off" or state == "default":
_play(game_songs[_current_song_index])
func play_palestina(index: int = 0) -> void:
if state != _palestina_song:
_last_playback_position = esc_music_player.get_playback_position()
_play(_palestina_song)
func pause() -> void:
if state != "off":
_last_playback_position = esc_music_player.get_playback_position()
esc_music_player.set_state("paused")
func resume() -> void:
_enable_effects()
if state == "paused" or state == _menu_song:
_play(_get_song_by_index(_current_song_index), false, _last_playback_position)
func _play(song_resource: String, loop: bool = false, from_seconds: float = 0.0):
var resource = load(song_resource)
resource.loop = loop
esc_music_player.state = song_resource
esc_music_player.stream.stream = resource
esc_music_player.stream.play(from_seconds)
func play_game() -> void:
escoria.object_manager.get_object("_music").node.set_state(
"res://gymkhana/sounds/music_loop.ogg"
)
func stop() -> void:
# From stop_snd() command
var sound_player = escoria.object_manager.get_object("_music").node
if sound_player:
sound_player.set_state("off")
esc_music_player.set_state("off")
func force_music() -> void:
_disable_effects()
AudioServer.set_bus_mute(
AudioServer.get_bus_index(escoria.BUS_MUSIC),
false
@@ -46,3 +124,31 @@ func force_music() -> void:
1.0
)
)
func _on_song_finished() -> void:
play_next_song()
func play_next_song() -> void:
_update_next_song_index()
_play(_get_song_by_index(_current_song_index))
func _get_song_by_index(index: int) -> String:
return game_songs[index]
func _update_next_song_index() -> void:
_current_song_index += 1
if _current_song_index == game_songs.size():
_current_song_index = 0
func _disable_effects() -> void:
AudioServer.set_bus_bypass_effects(AudioServer.get_bus_index(escoria.BUS_MUSIC), true)
func _enable_effects() -> void:
AudioServer.set_bus_bypass_effects(AudioServer.get_bus_index(escoria.BUS_MUSIC), false)
func set_distance_to_music(distance: int, pan: float = 0) -> void:
_filter_effect.gain = _filter_base_gain - distance * _filter_gain_ratio
_filter_effect.cutoff_hz = _filter_map[distance]
_panner_effect.pan = pan

View File

@@ -2,8 +2,6 @@ class_name RTMIVideoManager
var _video_player: RTMIVideoPlayer
var _last_music_state: String
var is_playing: bool:
get:
return _video_player.is_playing()
@@ -17,8 +15,7 @@ func _init(video_player: RTMIVideoPlayer) -> void:
func play_video(video_file: String) -> void:
escoria.game_scene.hide_ui()
escoria.game_scene.clear_tooltip()
_last_music_state = gymkhana.music_manager.state
gymkhana.music_manager.stop()
gymkhana.music_manager.pause()
_video_player.visible = true
_video_player.play(video_file)
@@ -27,7 +24,7 @@ func skip() -> void:
func _on_video_player_finished() -> void:
escoria.game_scene.show_ui()
gymkhana.music_manager.state = _last_music_state
gymkhana.music_manager.resume()
func get_video_player():
return _video_player

View File

@@ -4,6 +4,7 @@
global turno_cocina_mikel_playing
:setup
set_distance_to_music(0)
# Position player depending of last scene
if ESC_LAST_SCENE == "cocina_detras":
teleport($player, $puerta_detras_start)
@@ -41,6 +42,8 @@
say($player, "No se me ocurre ningún plato, debería buscar un libro de recetas.", "cocina_intro_1")
say($player, "Si mantienes MAYÚSCULAS pulsado los objetos con los que puedes interactuar aparecerán marcados.", "cocina_intro_2")
accept_input("ALL")
play_game_music()
else:
set_active($turno_cocina_economica, true)
set_active($turno_cocina_peso, true)

View File

@@ -6,6 +6,7 @@
global turno_cocina_pan_mojado_playing
:setup
set_distance_to_music(1)
if not cocina_delante_intro_played:
accept_input("SKIP")
stop_snd()
@@ -48,7 +49,6 @@
# Go to cocina
queue_event($cocina_delante_puerta_cocina, "action1", "intro_dialog_channel", true)
accept_input("ALL")
play_snd("res://gymkhana/sounds/music_loop.ogg", _music)
if intro_dialog2_playing:
accept_input("SKIP")

View File

@@ -1,4 +1,5 @@
:setup
set_distance_to_music(1)
if ESC_LAST_SCENE == "cocina_delante":
teleport($player,$puerta_delante_start)
set_angle($player,180)

View File

@@ -19,7 +19,7 @@
say($oier_dancing, "Hmm, mejor no.", "turno_cocina_creditos_8")
say($oier_dancing, "Lanzamos los créditos?", "turno_cocina_creditos_9")
say($eneko_dancing, "Daleee!", "turno_cocina_creditos_10")
play_snd("res://gymkhana/sounds/intro_menu_loop.ogg", "_music")
play_menu_music()
force_music()
set_global("turno_credits_rolling", true)
set_global("turno_cocina_credits_dancing", true)

View File

@@ -1,4 +1,5 @@
:setup
set_distance_to_music(2,1)
global turno_cocina_patata_grande_picked
teleport($player, "start")

View File

@@ -0,0 +1,17 @@
shader_type canvas_item;
render_mode blend_add;
uniform vec2 rect_size = vec2(.1, .1);
uniform float bness = 1.0;
uniform float fall_off_scale = 3.0;
uniform float b_offset = 0.0;
void fragment() {
vec2 uv = UV - vec2(.5);
vec2 cloest_rect_point;
cloest_rect_point = uv;
cloest_rect_point.x = clamp(uv.x, -rect_size.x, rect_size.x);
cloest_rect_point.y = clamp(uv.y, -rect_size.y, rect_size.y);
vec2 cuv = uv - cloest_rect_point;
float d2c = length(cuv);
COLOR.a = - log(d2c*fall_off_scale + b_offset) * bness;
}

View File

@@ -0,0 +1 @@
uid://vuqikns8fyrc

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.

View File

@@ -3,8 +3,8 @@
# change_scene res://gymkhana/rooms/intro/intro_room.tscn false
show_menu("main")
# When control is passed back after the logo, start the music
play_snd ("res://gymkhana/sounds/intro_menu_loop.ogg",_music)
play_menu_music()
:newgame
set_global("new_game", true)
# Ingredientes start value