testing bg stuff

This commit is contained in:
Robin Hübner 2018-09-21 19:45:08 +02:00
parent 50dbda5f27
commit 05b6bdb73b
8 changed files with 67 additions and 7 deletions

View File

@ -1,10 +1,19 @@
extends Node2D extends Node2D
var bg_sprite
signal on_scene_ready signal on_scene_ready
signal on_scene_start signal on_scene_start
func _ready(): 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: if not Game.game_started:
Game.game_started = true Game.game_started = true
emit_signal("on_scene_ready") emit_signal("on_scene_ready")
@ -15,3 +24,6 @@ func _ready():
func on_scene_start(): func on_scene_start():
emit_signal("on_scene_start") emit_signal("on_scene_start")
func set_background(bg_tex):
bg_sprite.texture = bg_tex

View File

@ -1,3 +1,4 @@
> SET_BACKGROUND [INTRO_BG]
<BRAIN> ... You wake up to the sound of sirens blaring. <BRAIN> ... You wake up to the sound of sirens blaring.
... maybe it's time to go to school? ... maybe it's time to go to school?
> SWITCH_SCENE [FIRST_SCENE] > SWITCH_SCENE [FIRST_SCENE]

18
game.gd
View File

@ -21,8 +21,6 @@ signal on_reading_speed_changed(new_value)
signal on_settings_enter() signal on_settings_enter()
signal on_settings_exit() signal on_settings_exit()
const Themes = {}
# voices for characters # voices for characters
const brain_voice = null const brain_voice = null
const arborator_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(): func _register_functions():
# default VN.. functions
current_registry["SWITCH_SCENE"] = funcref(self, "_switch_scene_fnc") 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): func _switch_scene_fnc(args):
if args.size() == 1: if args.size() == 1:

BIN
img/intro_bg.ase (Stored with Git LFS) Normal file

Binary file not shown.

BIN
img/intro_bg.png (Stored with Git LFS) Normal file

Binary file not shown.

29
img/intro_bg.png.import Normal file
View File

@ -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

View File

@ -8,9 +8,7 @@
script = ExtResource( 1 ) script = ExtResource( 1 )
[node name="background" type="Sprite" parent="." index="0"] [node name="dialog_layer" type="CanvasLayer" parent="." index="0"]
[node name="dialog_layer" type="CanvasLayer" parent="." index="1"]
layer = 0 layer = 0
offset = Vector2( 0, 0 ) offset = Vector2( 0, 0 )

View File

@ -84,7 +84,7 @@ group = null
text = "auto" text = "auto"
flat = true flat = true
align = 1 align = 1
_sections_unfolded = [ "custom_constants" ] _sections_unfolded = [ "custom_colors", "custom_constants" ]
[node name="ffwd_btn" type="Button" parent="top_panel" index="1"] [node name="ffwd_btn" type="Button" parent="top_panel" index="1"]