Post Game jam commit
This commit is contained in:
commit
6db2131520
164 changed files with 172524 additions and 0 deletions
12
scripts/singletons/event_bus.gd
Normal file
12
scripts/singletons/event_bus.gd
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
extends Node
|
||||
|
||||
signal dialogue_requested(text: String)
|
||||
signal dialogue_finished()
|
||||
signal debug_print(text : String)
|
||||
signal mask_changed(new : Types.mask_types)
|
||||
signal mask_uses_changed(new : int)
|
||||
signal health_changed(new : int)
|
||||
signal player_dmg()
|
||||
signal screenshake(intensity : float)
|
||||
signal mask_time_changed(time : float)
|
||||
signal cut_grass_at(p, r)
|
||||
1
scripts/singletons/event_bus.gd.uid
Normal file
1
scripts/singletons/event_bus.gd.uid
Normal file
|
|
@ -0,0 +1 @@
|
|||
uid://b31uw84k0w7x3
|
||||
71
scripts/singletons/scene_transition.gd
Normal file
71
scripts/singletons/scene_transition.gd
Normal file
|
|
@ -0,0 +1,71 @@
|
|||
extends CanvasLayer
|
||||
|
||||
@onready var rect = $ColorRect
|
||||
@onready var log_display = $RichTextLabel
|
||||
|
||||
func _ready():
|
||||
rect.modulate.a = 0
|
||||
log_display.text = ""
|
||||
log_display.visible = false
|
||||
# Ensure the rect doesn't block clicks while invisible
|
||||
rect.mouse_filter = Control.MOUSE_FILTER_IGNORE
|
||||
|
||||
## Combined function to handle both success and error transitions
|
||||
func change_scene(target_path: String, is_error: bool = false):
|
||||
rect.mouse_filter = Control.MOUSE_FILTER_STOP
|
||||
|
||||
# Set color based on status
|
||||
if is_error:
|
||||
rect.color = Color.CRIMSON
|
||||
else:
|
||||
rect.color = Color.from_string("#364388", Color.BLUE)
|
||||
|
||||
# Fade In
|
||||
var tween_in = create_tween()
|
||||
await tween_in.tween_property(rect, "modulate:a", 1.0, 0.3).finished
|
||||
|
||||
# Display Log
|
||||
log_display.visible = true
|
||||
var log_file = "res://hex.txt" if is_error else "res://log.txt"
|
||||
await display_log_file(log_file)
|
||||
|
||||
await get_tree().create_timer(0.5).timeout
|
||||
|
||||
# Change Scene
|
||||
var error = get_tree().change_scene_to_file(target_path)
|
||||
if error != OK:
|
||||
push_error("Failed to load scene: " + target_path)
|
||||
|
||||
# Cleanup and Fade Out
|
||||
log_display.visible = false
|
||||
log_display.text = ""
|
||||
|
||||
var tween_out = create_tween()
|
||||
await tween_out.tween_property(rect, "modulate:a", 0.0, 0.5).finished
|
||||
rect.mouse_filter = Control.MOUSE_FILTER_IGNORE
|
||||
|
||||
func display_log_file(file_path: String):
|
||||
if not FileAccess.file_exists(file_path):
|
||||
log_display.add_text("ERROR: " + file_path + " not found in build.\n")
|
||||
# Check Project -> Export -> Resources -> Filters to include non-resource files
|
||||
return
|
||||
|
||||
var file = FileAccess.open(file_path, FileAccess.READ)
|
||||
if not file:
|
||||
log_display.add_text("ERROR: Could not open file.\n")
|
||||
return
|
||||
|
||||
# Reading line by line for that "hacker" effect
|
||||
while not file.eof_reached():
|
||||
var line = file.get_line()
|
||||
if line.strip_edges() == "": continue # Skip empty lines if desired
|
||||
|
||||
log_display.add_text(line + "\n")
|
||||
# Auto-scroll to bottom
|
||||
log_display.scroll_to_line(log_display.get_line_count())
|
||||
|
||||
var delay = 0#randf_range(0.0001, 0.00015)
|
||||
#if randf() > 0.95:
|
||||
#delay += 0.2 # Random "loading" hitch for realism
|
||||
|
||||
await get_tree().create_timer(delay).timeout
|
||||
1
scripts/singletons/scene_transition.gd.uid
Normal file
1
scripts/singletons/scene_transition.gd.uid
Normal file
|
|
@ -0,0 +1 @@
|
|||
uid://dktk18oihl6xf
|
||||
36
scripts/singletons/settings.gd
Normal file
36
scripts/singletons/settings.gd
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
extends Node
|
||||
|
||||
var master_volume: float = 1.0
|
||||
var fullscreen: bool = false
|
||||
var vsync : bool = false
|
||||
var max_fps: int = 60
|
||||
|
||||
func apply_volume():
|
||||
var bus_index := AudioServer.get_bus_index("Master")
|
||||
AudioServer.set_bus_volume_db(
|
||||
bus_index,
|
||||
linear_to_db(master_volume)
|
||||
)
|
||||
|
||||
func apply_fullscreen():
|
||||
DisplayServer.window_set_mode(
|
||||
DisplayServer.WINDOW_MODE_FULLSCREEN if fullscreen
|
||||
else DisplayServer.WINDOW_MODE_WINDOWED
|
||||
)
|
||||
if not fullscreen:
|
||||
get_window().size = Vector2i(480*3, 270*3);
|
||||
|
||||
func apply_vsync():
|
||||
DisplayServer.window_set_vsync_mode(
|
||||
DisplayServer.VSYNC_ENABLED if vsync
|
||||
else DisplayServer.VSYNC_DISABLED
|
||||
)
|
||||
|
||||
func apply_max_fps():
|
||||
Engine.max_fps = max_fps
|
||||
|
||||
func apply_all():
|
||||
apply_volume()
|
||||
apply_fullscreen()
|
||||
apply_vsync()
|
||||
apply_max_fps()
|
||||
1
scripts/singletons/settings.gd.uid
Normal file
1
scripts/singletons/settings.gd.uid
Normal file
|
|
@ -0,0 +1 @@
|
|||
uid://cyoitmcbh2sw5
|
||||
72
scripts/singletons/sound_manager.gd
Normal file
72
scripts/singletons/sound_manager.gd
Normal file
|
|
@ -0,0 +1,72 @@
|
|||
extends Node
|
||||
|
||||
const SFX_DEATH = preload("res://assets/sfx/death.mp3")
|
||||
const SFX_HEART = preload("res://assets/sfx/heart.mp3")
|
||||
const SFX_SWING = preload("res://assets/sfx/swing.mp3")
|
||||
const SFX_CLICK = preload("res://assets/sfx/click.mp3")
|
||||
|
||||
const MUSIC_TITLE = preload("res://assets/music/title.wav")
|
||||
|
||||
# Configuration
|
||||
var pool_size = 10
|
||||
var sfx_dict = {}
|
||||
var music_dict = {}
|
||||
var sfx_pool = []
|
||||
var current_pool_index = 0
|
||||
|
||||
@onready var music_player_1 := AudioStreamPlayer.new()
|
||||
@onready var music_player_2 := AudioStreamPlayer.new()
|
||||
|
||||
func _ready():
|
||||
process_mode = Node.PROCESS_MODE_ALWAYS
|
||||
|
||||
sfx_dict = {
|
||||
"death": SFX_DEATH,
|
||||
"heart": SFX_HEART,
|
||||
"swing": SFX_SWING,
|
||||
"click": SFX_CLICK
|
||||
}
|
||||
|
||||
music_dict = {
|
||||
"title": MUSIC_TITLE
|
||||
}
|
||||
|
||||
for i in range(pool_size):
|
||||
var asp = AudioStreamPlayer.new()
|
||||
asp.bus = "SFX"
|
||||
add_child(asp)
|
||||
sfx_pool.append(asp)
|
||||
|
||||
add_child(music_player_1)
|
||||
add_child(music_player_2)
|
||||
music_player_1.bus = "Music"
|
||||
music_player_2.bus = "Music"
|
||||
|
||||
|
||||
func play_sfx(sound_name: String):
|
||||
if sfx_dict.has(sound_name):
|
||||
var asp : AudioStreamPlayer = sfx_pool[current_pool_index]
|
||||
asp.stream = sfx_dict[sound_name]
|
||||
asp.play()
|
||||
current_pool_index = (current_pool_index + 1) % pool_size
|
||||
|
||||
func play_music(music_name: String, fade_duration: float = 1.0):
|
||||
if not music_dict.has(music_name): return
|
||||
var next_track = music_dict[music_name]
|
||||
|
||||
|
||||
var active = music_player_1 if music_player_1.playing else music_player_2
|
||||
var idle = music_player_2 if music_player_1.playing else music_player_1
|
||||
|
||||
if active.stream == next_track: return
|
||||
|
||||
idle.stream = next_track
|
||||
idle.volume_db = -80
|
||||
idle.play()
|
||||
|
||||
var tween = create_tween().set_parallel(true)
|
||||
tween.tween_property(active, "volume_db", -80, fade_duration)
|
||||
tween.tween_property(idle, "volume_db", 0, fade_duration)
|
||||
|
||||
await tween.finished
|
||||
active.stop()
|
||||
1
scripts/singletons/sound_manager.gd.uid
Normal file
1
scripts/singletons/sound_manager.gd.uid
Normal file
|
|
@ -0,0 +1 @@
|
|||
uid://buunplrqixmky
|
||||
7
scripts/singletons/types.gd
Normal file
7
scripts/singletons/types.gd
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
extends Node
|
||||
|
||||
enum mask_types {
|
||||
Melee,
|
||||
Ranged,
|
||||
Spit
|
||||
}
|
||||
1
scripts/singletons/types.gd.uid
Normal file
1
scripts/singletons/types.gd.uid
Normal file
|
|
@ -0,0 +1 @@
|
|||
uid://ixakrcerxwlj
|
||||
3
scripts/singletons/world_state.gd
Normal file
3
scripts/singletons/world_state.gd
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
extends Node
|
||||
|
||||
var done_tuto = false
|
||||
1
scripts/singletons/world_state.gd.uid
Normal file
1
scripts/singletons/world_state.gd.uid
Normal file
|
|
@ -0,0 +1 @@
|
|||
uid://csi5hjjkyps56
|
||||
Loading…
Add table
Add a link
Reference in a new issue