ready for export
This commit is contained in:
1 parent
e0c93f0e19
commit
1caed8e5bd
38 files changed
+744
-119
No files matched your search
@@ -0,0 +1,37 @@
|
||||
#@tool
|
||||
#@icon(icon_path: String)
|
||||
#class_name MyNode
|
||||
extends Node
|
||||
## Documentation comments
|
||||
|
||||
#signal
|
||||
#enum
|
||||
#const
|
||||
|
||||
const LEVEL_0 = preload("uid://1mhb537c1qxd")
|
||||
|
||||
#@export var
|
||||
#var
|
||||
|
||||
@onready var start_button: Button = %StartButton
|
||||
|
||||
## OVERRIDES
|
||||
|
||||
func _ready() -> void:
|
||||
start_button.connect("pressed", on_start_button_pressed)
|
||||
|
||||
func _process(_delta: float) -> void:
|
||||
pass
|
||||
|
||||
func _physics_process(_delta: float) -> void:
|
||||
pass
|
||||
|
||||
## CORE
|
||||
|
||||
## PRIVATE/HELPER
|
||||
|
||||
## RECEIVERS
|
||||
func on_start_button_pressed() -> void:
|
||||
get_tree().change_scene_to_packed(LEVEL_0)
|
||||
|
||||
## SETTERS/GETTERS
|
||||
@@ -0,0 +1 @@
|
||||
uid://o45uvey2wnsb
|
||||
+47
-21
@@ -7,45 +7,71 @@ extends Node2D
|
||||
#signal
|
||||
#enum
|
||||
#const
|
||||
const EINE_KLEINE_BLANK = preload("uid://diaivgv13xa8k")
|
||||
const OUTRO = preload("uid://c7eypje2fjbyx")
|
||||
|
||||
@export var level_number: int = 0
|
||||
@export var instruction_strings: Array[String]
|
||||
|
||||
# Musicians
|
||||
@onready var conductor: Musician = %Conductor
|
||||
@onready var violinist: Musician = %Violinist
|
||||
@onready var cellist: Musician = %Cellist
|
||||
@onready var bassist: Musician = %Bassist
|
||||
#var musicians: Array[Musician]
|
||||
var next_instruction: String
|
||||
|
||||
@onready var ok_button: Button = %OKButton
|
||||
@onready var instructions: Label = %Instructions
|
||||
@onready var tilemaps: Tilemaps = $Tilemaps
|
||||
|
||||
|
||||
|
||||
## Musicians
|
||||
@onready var conductor: Musician = %Conductor
|
||||
@onready var bassist: Musician = %Bassist
|
||||
@onready var cellist: Musician = %Cellist
|
||||
@onready var violinist: Musician = %Violinist
|
||||
|
||||
## OVERRIDES
|
||||
|
||||
func _ready() -> void:
|
||||
_connect_signals()
|
||||
tilemaps.canvas_modulate.visible = true
|
||||
SceneManager.build_level(level_number)
|
||||
|
||||
#if instruction_strings:
|
||||
#next_instruction = instruction_strings.pop_front()
|
||||
#SceneManager.load_level(level_number)
|
||||
if level_number < 3:
|
||||
violinist.queue_free()
|
||||
if level_number < 2:
|
||||
cellist.queue_free()
|
||||
if level_number < 1:
|
||||
bassist.queue_free()
|
||||
else:
|
||||
conductor.audio.stream = EINE_KLEINE_BLANK
|
||||
conductor.input_prompt.visible = false
|
||||
#musicians = [
|
||||
#conductor,
|
||||
#bassist,
|
||||
#cellist,
|
||||
#violinist
|
||||
#]
|
||||
#func _process(_delta: float) -> void:
|
||||
#pass
|
||||
#
|
||||
#func _physics_process(_delta: float) -> void:
|
||||
#pass
|
||||
|
||||
func _unhandled_input(event: InputEvent) -> void:
|
||||
if event.is_action_pressed("ready"):
|
||||
conductor.enter_exit()
|
||||
if event.is_action_pressed("viol"):
|
||||
violinist.enter_exit()
|
||||
if event.is_action_pressed("cello"):
|
||||
cellist.enter_exit()
|
||||
if event.is_action_pressed("bass"):
|
||||
bassist.enter_exit()
|
||||
|
||||
## CORE
|
||||
func ui_continue() -> void:
|
||||
if instruction_strings.size() > 0:
|
||||
instructions.text = instruction_strings.pop_front()
|
||||
else:
|
||||
level_number += 1
|
||||
if level_number <= 3:
|
||||
SceneManager.load_level(level_number)
|
||||
else:
|
||||
get_tree().change_scene_to_packed(OUTRO)
|
||||
|
||||
## PRIVATE/HELPER
|
||||
|
||||
|
||||
func _connect_signals() -> void:
|
||||
ok_button.connect("pressed", on_ok_button_pressed)
|
||||
|
||||
## RECEIVERS
|
||||
func on_ok_button_pressed() -> void:
|
||||
ui_continue()
|
||||
|
||||
## SETTERS/GETTERS
|
||||
+51
-29
@@ -8,18 +8,19 @@ extends AnimatedSprite2D
|
||||
#enum
|
||||
#const
|
||||
|
||||
@export_group("Input Textures")
|
||||
@export var solid_texture: Texture2D
|
||||
@export var outline_texture: Texture2D
|
||||
#@export_group("Input Textures")
|
||||
#@export var solid_texture: Texture2D
|
||||
#@export var outline_texture: Texture2D
|
||||
|
||||
@export var beats_per_boost: int = 4
|
||||
@export var song_tempo: int = 120
|
||||
|
||||
@export_enum("sample", "viol", "cello", "bass", "ready") var input_action: String
|
||||
@export_enum("whole:4", "half:2", "quarter:1") var boost_note_type: int
|
||||
@export_enum("sample", "viol", "cello", "bass", "execute") var input_action: String
|
||||
|
||||
var beat_count: int = 0
|
||||
var decay_length: float
|
||||
var decay_rate: float
|
||||
var is_active: bool = false
|
||||
var is_playing_music: bool = false
|
||||
var is_boosted: bool
|
||||
var is_over_boosted: bool = false
|
||||
var seconds_per_beat: float
|
||||
@@ -30,17 +31,19 @@ var useconds_per_beat: int
|
||||
@onready var occluder: LightOccluder2D = %Occluder
|
||||
@onready var input_prompt: Sprite2D = %InputPrompt
|
||||
@onready var volume_bar: ProgressBar = %VolumeBar
|
||||
@onready var beat_timer: Timer = %BeatTimer
|
||||
@onready var boost_timer: Timer = %BoostTimer
|
||||
@onready var beat_particles: CPUParticles2D = $BeatParticles
|
||||
|
||||
## OVERRIDES
|
||||
|
||||
func _ready() -> void:
|
||||
light.visible = false
|
||||
_connect_signals()
|
||||
|
||||
input_prompt.texture = outline_texture
|
||||
#input_prompt.texture = outline_texture
|
||||
seconds_per_beat = 60.0/float(song_tempo)
|
||||
decay_length = beats_per_boost * seconds_per_beat
|
||||
beat_timer.wait_time = seconds_per_beat
|
||||
decay_length = boost_note_type * seconds_per_beat
|
||||
print("this musician's boosts will last %s seconds" % decay_length)
|
||||
boost_timer.wait_time = decay_length
|
||||
decay_rate = 80.0 / decay_length
|
||||
@@ -48,8 +51,8 @@ func _ready() -> void:
|
||||
|
||||
func _process(delta: float) -> void:
|
||||
if is_over_boosted:
|
||||
distort_pitch(sin(Time.get_ticks_msec()))
|
||||
if is_active and not is_boosted:
|
||||
distort_pitch()
|
||||
if is_playing_music and not is_boosted:
|
||||
drop_volume(decay_rate * delta)
|
||||
volume_bar.value = audio.volume_db
|
||||
|
||||
@@ -67,39 +70,58 @@ func boost_volume() -> void:
|
||||
is_boosted = true
|
||||
boost_timer.start()
|
||||
|
||||
func distort_pitch(distortion: float) -> void:
|
||||
print("distorting by %s" % distortion)
|
||||
audio.pitch_scale += distortion
|
||||
print("pitch scale is %s" % audio.pitch_scale)
|
||||
func distort_pitch() -> void:
|
||||
audio.pitch_scale += randf_range(-0.001, 0.0001)
|
||||
|
||||
func drop_volume(d_r: float) -> void:
|
||||
audio.volume_db -= d_r
|
||||
|
||||
func play_pause() -> void:
|
||||
if is_active:
|
||||
play("idle")
|
||||
audio.stop()
|
||||
light.visible = false
|
||||
is_active = false
|
||||
input_prompt.texture = outline_texture
|
||||
if not is_playing_music:
|
||||
_play()
|
||||
else:
|
||||
play("default")
|
||||
audio.play()
|
||||
if not is_boosted:
|
||||
is_boosted = true
|
||||
boost_timer.start()
|
||||
light.visible = true
|
||||
is_active = true
|
||||
input_prompt.texture = solid_texture
|
||||
_pause()
|
||||
|
||||
## PRIVATE/HELPER
|
||||
|
||||
func _connect_signals() -> void:
|
||||
boost_timer.connect("timeout", on_boost_timer_timeout)
|
||||
audio.connect("finished", play_pause)
|
||||
beat_timer.connect("timeout", on_beat_timer_timeout)
|
||||
|
||||
func _play() -> void:
|
||||
play("default")
|
||||
audio.play()
|
||||
beat_timer.start()
|
||||
if not is_boosted:
|
||||
is_boosted = true
|
||||
boost_timer.start()
|
||||
light.visible = true
|
||||
is_playing_music = true
|
||||
#input_prompt.texture = solid_texture
|
||||
|
||||
func _pause() -> void:
|
||||
play("idle")
|
||||
audio.stop()
|
||||
beat_timer.stop()
|
||||
light.visible = false
|
||||
is_playing_music = false
|
||||
#input_prompt.texture = outline_texture
|
||||
|
||||
## RECEIVERS
|
||||
|
||||
func on_beat_timer_timeout() -> void:
|
||||
beat_count += 1
|
||||
if beat_count % 4 == 0:
|
||||
beat_particles.color = Color.RED
|
||||
beat_particles.amount = 24
|
||||
beat_particles.lifetime = 0.2
|
||||
else:
|
||||
beat_particles.color = Color.WHITE
|
||||
beat_particles.amount = 8
|
||||
beat_particles.lifetime = 0.15
|
||||
beat_particles.restart()
|
||||
|
||||
func on_boost_timer_timeout() -> void:
|
||||
print("boost over")
|
||||
boost_timer.stop()
|
||||
|
||||
@@ -6,23 +6,37 @@ extends Node
|
||||
#signal
|
||||
#enum
|
||||
#const
|
||||
|
||||
const LEVEL_0 = preload("uid://1mhb537c1qxd")
|
||||
const LEVEL_1 = preload("uid://dwqw0ieu8smw7")
|
||||
const LEVEL_2 = preload("uid://cdbfis58lkruf")
|
||||
const LEVEL_3 = preload("uid://ccoc6j4r7yixt")
|
||||
|
||||
|
||||
#@export var
|
||||
var levels: Array[Level]
|
||||
var current_level: Level
|
||||
var levels: Array[PackedScene]
|
||||
var current_level: PackedScene
|
||||
#@onready var
|
||||
|
||||
## OVERRIDES
|
||||
|
||||
func _ready() -> void:
|
||||
pass
|
||||
levels = [
|
||||
LEVEL_0,
|
||||
LEVEL_1,
|
||||
LEVEL_2,
|
||||
LEVEL_3
|
||||
]
|
||||
|
||||
#func _process(_delta: float) -> void:
|
||||
#pass
|
||||
|
||||
|
||||
## CORE
|
||||
func build_level(level_number: int) -> void:
|
||||
func load_level(level_number: int) -> void:
|
||||
print_debug("Building level #%s" % level_number)
|
||||
get_tree().change_scene_to_packed(levels[level_number])
|
||||
|
||||
|
||||
## PRIVATE/HELPER
|
||||
|
||||
|
||||
Reference in new issue
Block a user