diff --git a/common/scene.gd b/common/scene.gd index aa38c47..9328f43 100644 --- a/common/scene.gd +++ b/common/scene.gd @@ -1,10 +1,19 @@ extends Node2D +var bg_sprite + signal on_scene_ready signal on_scene_start func _ready(): + # internal state + var new_sprite = Sprite.new() + new_sprite.name = "background" + new_sprite.centered = false + add_child(new_sprite) + bg_sprite = new_sprite + if not Game.game_started: Game.game_started = true emit_signal("on_scene_ready") @@ -14,4 +23,7 @@ func _ready(): func on_scene_start(): - emit_signal("on_scene_start") \ No newline at end of file + emit_signal("on_scene_start") + +func set_background(bg_tex): + bg_sprite.texture = bg_tex \ No newline at end of file diff --git a/dialog/introduction.txt b/dialog/introduction.txt index 556d718..57d5c13 100644 --- a/dialog/introduction.txt +++ b/dialog/introduction.txt @@ -1,3 +1,4 @@ +> SET_BACKGROUND [INTRO_BG] ... You wake up to the sound of sirens blaring. ... maybe it's time to go to school? > SWITCH_SCENE [FIRST_SCENE] diff --git a/game.gd b/game.gd index 5682a0f..74da3aa 100644 --- a/game.gd +++ b/game.gd @@ -21,8 +21,6 @@ signal on_reading_speed_changed(new_value) signal on_settings_enter() signal on_settings_exit() -const Themes = {} - # voices for characters const brain_voice = null const arborator_voice = null @@ -55,8 +53,24 @@ const Scenes = { } +const Themes = {} + +const Images = { + INTRO_BG = "res://img/intro_bg.png" +} + func _register_functions(): + + # default VN.. functions current_registry["SWITCH_SCENE"] = funcref(self, "_switch_scene_fnc") + current_registry["SET_BACKGROUND"] = funcref(self, "_set_background_fnc") + + +func _set_background_fnc(args): + if args.size() == 1: + var bg_name = args[0] + var bg_texture = load(Images[bg_name]) + SceneSwitcher.current_scene.set_background(bg_texture) func _switch_scene_fnc(args): if args.size() == 1: diff --git a/img/intro_bg.ase b/img/intro_bg.ase new file mode 100644 index 0000000..e7d6920 --- /dev/null +++ b/img/intro_bg.ase @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:16a0dc9804984b96e99f92d2791552ce8bba631fe0b85b3275168862bbaa11cd +size 2799 diff --git a/img/intro_bg.png b/img/intro_bg.png new file mode 100644 index 0000000..f94e4b1 --- /dev/null +++ b/img/intro_bg.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:3e14f639d9142b2d01afc2b057067f2ea5f974008316225c5df9a0884f1cfbf3 +size 3851 diff --git a/img/intro_bg.png.import b/img/intro_bg.png.import new file mode 100644 index 0000000..2c6eb9f --- /dev/null +++ b/img/intro_bg.png.import @@ -0,0 +1,29 @@ +[remap] + +importer="texture" +type="StreamTexture" +path="res://.import/intro_bg.png-365e7af536365a75b19afe8d8934b7d7.stex" + +[deps] + +source_file="res://img/intro_bg.png" +dest_files=[ "res://.import/intro_bg.png-365e7af536365a75b19afe8d8934b7d7.stex" ] + +[params] + +compress/mode=0 +compress/lossy_quality=0.7 +compress/hdr_mode=0 +compress/normal_map=0 +flags/repeat=0 +flags/filter=true +flags/mipmaps=false +flags/anisotropic=false +flags/srgb=2 +process/fix_alpha_border=true +process/premult_alpha=false +process/HDR_as_SRGB=false +stream=false +size_limit=0 +detect_3d=true +svg/scale=1.0 diff --git a/scenes/intro.tscn b/scenes/intro.tscn index d290c38..06d38b7 100644 --- a/scenes/intro.tscn +++ b/scenes/intro.tscn @@ -8,9 +8,7 @@ script = ExtResource( 1 ) -[node name="background" type="Sprite" parent="." index="0"] - -[node name="dialog_layer" type="CanvasLayer" parent="." index="1"] +[node name="dialog_layer" type="CanvasLayer" parent="." index="0"] layer = 0 offset = Vector2( 0, 0 ) diff --git a/ui/dialog_box.tscn b/ui/dialog_box.tscn index cf31294..a26daa6 100644 --- a/ui/dialog_box.tscn +++ b/ui/dialog_box.tscn @@ -84,7 +84,7 @@ group = null text = "auto" flat = true align = 1 -_sections_unfolded = [ "custom_constants" ] +_sections_unfolded = [ "custom_colors", "custom_constants" ] [node name="ffwd_btn" type="Button" parent="top_panel" index="1"]