diff --git a/images/Controls/PressA.png b/images/Controls/PressA.png new file mode 100644 index 0000000..43477af Binary files /dev/null and b/images/Controls/PressA.png differ diff --git a/images/Controls/PressA.png.import b/images/Controls/PressA.png.import new file mode 100644 index 0000000..5ac797c --- /dev/null +++ b/images/Controls/PressA.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="StreamTexture" +path="res://.import/PressA.png-e3ce1fae08387799463febc8df0536d3.stex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://images/Controls/PressA.png" +dest_files=[ "res://.import/PressA.png-e3ce1fae08387799463febc8df0536d3.stex" ] + +[params] + +compress/mode=0 +compress/lossy_quality=0.7 +compress/hdr_mode=0 +compress/bptc_ldr=0 +compress/normal_map=0 +flags/repeat=0 +flags/filter=false +flags/mipmaps=false +flags/anisotropic=false +flags/srgb=2 +process/fix_alpha_border=true +process/premult_alpha=false +process/HDR_as_SRGB=false +process/invert_color=false +stream=false +size_limit=0 +detect_3d=true +svg/scale=1.0 diff --git a/images/Controls/PressA.tres b/images/Controls/PressA.tres new file mode 100644 index 0000000..410e77e --- /dev/null +++ b/images/Controls/PressA.tres @@ -0,0 +1,19 @@ +[gd_resource type="SpriteFrames" load_steps=4 format=2] + +[ext_resource path="res://images/Controls/PressA.png" type="Texture" id=1] + +[sub_resource type="AtlasTexture" id=1] +atlas = ExtResource( 1 ) +region = Rect2( 0, 0, 8, 9 ) + +[sub_resource type="AtlasTexture" id=2] +atlas = ExtResource( 1 ) +region = Rect2( 8, 0, 8, 9 ) + +[resource] +animations = [ { +"frames": [ SubResource( 1 ), SubResource( 2 ) ], +"loop": true, +"name": "default", +"speed": 2.0 +} ] diff --git a/images/Controls/PressDown.png b/images/Controls/PressDown.png new file mode 100644 index 0000000..523c20c Binary files /dev/null and b/images/Controls/PressDown.png differ diff --git a/images/Controls/PressDown.png.import b/images/Controls/PressDown.png.import new file mode 100644 index 0000000..ffa91f2 --- /dev/null +++ b/images/Controls/PressDown.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="StreamTexture" +path="res://.import/PressDown.png-9c2b9a422d3d26e94891c5335e81a424.stex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://images/Controls/PressDown.png" +dest_files=[ "res://.import/PressDown.png-9c2b9a422d3d26e94891c5335e81a424.stex" ] + +[params] + +compress/mode=0 +compress/lossy_quality=0.7 +compress/hdr_mode=0 +compress/bptc_ldr=0 +compress/normal_map=0 +flags/repeat=0 +flags/filter=false +flags/mipmaps=false +flags/anisotropic=false +flags/srgb=2 +process/fix_alpha_border=true +process/premult_alpha=false +process/HDR_as_SRGB=false +process/invert_color=false +stream=false +size_limit=0 +detect_3d=true +svg/scale=1.0 diff --git a/images/Controls/PressDown.tres b/images/Controls/PressDown.tres new file mode 100644 index 0000000..edf61a7 --- /dev/null +++ b/images/Controls/PressDown.tres @@ -0,0 +1,19 @@ +[gd_resource type="SpriteFrames" load_steps=4 format=2] + +[ext_resource path="res://images/Controls/PressDown.png" type="Texture" id=1] + +[sub_resource type="AtlasTexture" id=1] +atlas = ExtResource( 1 ) +region = Rect2( 0, 0, 8, 9 ) + +[sub_resource type="AtlasTexture" id=2] +atlas = ExtResource( 1 ) +region = Rect2( 8, 0, 8, 9 ) + +[resource] +animations = [ { +"frames": [ SubResource( 1 ), SubResource( 2 ) ], +"loop": true, +"name": "default", +"speed": 2.0 +} ] diff --git a/images/Controls/PressLeft.png b/images/Controls/PressLeft.png new file mode 100644 index 0000000..5711e12 Binary files /dev/null and b/images/Controls/PressLeft.png differ diff --git a/images/Controls/PressLeft.png.import b/images/Controls/PressLeft.png.import new file mode 100644 index 0000000..b5cf460 --- /dev/null +++ b/images/Controls/PressLeft.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="StreamTexture" +path="res://.import/PressLeft.png-1c3be7a4ee3f4d68565bc7d29c008652.stex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://images/Controls/PressLeft.png" +dest_files=[ "res://.import/PressLeft.png-1c3be7a4ee3f4d68565bc7d29c008652.stex" ] + +[params] + +compress/mode=0 +compress/lossy_quality=0.7 +compress/hdr_mode=0 +compress/bptc_ldr=0 +compress/normal_map=0 +flags/repeat=0 +flags/filter=false +flags/mipmaps=false +flags/anisotropic=false +flags/srgb=2 +process/fix_alpha_border=true +process/premult_alpha=false +process/HDR_as_SRGB=false +process/invert_color=false +stream=false +size_limit=0 +detect_3d=true +svg/scale=1.0 diff --git a/images/Controls/PressLeft.tres b/images/Controls/PressLeft.tres new file mode 100644 index 0000000..6343ae5 --- /dev/null +++ b/images/Controls/PressLeft.tres @@ -0,0 +1,19 @@ +[gd_resource type="SpriteFrames" load_steps=4 format=2] + +[ext_resource path="res://images/Controls/PressLeft.png" type="Texture" id=1] + +[sub_resource type="AtlasTexture" id=1] +atlas = ExtResource( 1 ) +region = Rect2( 0, 0, 8, 9 ) + +[sub_resource type="AtlasTexture" id=2] +atlas = ExtResource( 1 ) +region = Rect2( 8, 0, 8, 9 ) + +[resource] +animations = [ { +"frames": [ SubResource( 1 ), SubResource( 2 ) ], +"loop": true, +"name": "default", +"speed": 2.0 +} ] diff --git a/images/Controls/PressRight.png b/images/Controls/PressRight.png new file mode 100644 index 0000000..29b766f Binary files /dev/null and b/images/Controls/PressRight.png differ diff --git a/images/Controls/PressRight.png.import b/images/Controls/PressRight.png.import new file mode 100644 index 0000000..6c38db1 --- /dev/null +++ b/images/Controls/PressRight.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="StreamTexture" +path="res://.import/PressRight.png-a70738db6c03faf099a382ca479b5ebe.stex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://images/Controls/PressRight.png" +dest_files=[ "res://.import/PressRight.png-a70738db6c03faf099a382ca479b5ebe.stex" ] + +[params] + +compress/mode=0 +compress/lossy_quality=0.7 +compress/hdr_mode=0 +compress/bptc_ldr=0 +compress/normal_map=0 +flags/repeat=0 +flags/filter=false +flags/mipmaps=false +flags/anisotropic=false +flags/srgb=2 +process/fix_alpha_border=true +process/premult_alpha=false +process/HDR_as_SRGB=false +process/invert_color=false +stream=false +size_limit=0 +detect_3d=true +svg/scale=1.0 diff --git a/images/Controls/PressRight.tres b/images/Controls/PressRight.tres new file mode 100644 index 0000000..42abd21 --- /dev/null +++ b/images/Controls/PressRight.tres @@ -0,0 +1,19 @@ +[gd_resource type="SpriteFrames" load_steps=4 format=2] + +[ext_resource path="res://images/Controls/PressRight.png" type="Texture" id=1] + +[sub_resource type="AtlasTexture" id=1] +atlas = ExtResource( 1 ) +region = Rect2( 0, 0, 8, 9 ) + +[sub_resource type="AtlasTexture" id=2] +atlas = ExtResource( 1 ) +region = Rect2( 8, 0, 8, 9 ) + +[resource] +animations = [ { +"frames": [ SubResource( 1 ), SubResource( 2 ) ], +"loop": true, +"name": "default", +"speed": 2.0 +} ] diff --git a/images/Controls/PressSpace.png b/images/Controls/PressSpace.png new file mode 100644 index 0000000..b21da9e Binary files /dev/null and b/images/Controls/PressSpace.png differ diff --git a/images/Controls/PressSpace.png.import b/images/Controls/PressSpace.png.import new file mode 100644 index 0000000..4f5e1c3 --- /dev/null +++ b/images/Controls/PressSpace.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="StreamTexture" +path="res://.import/PressSpace.png-55d06e3dfa858bd419c0781f227612aa.stex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://images/Controls/PressSpace.png" +dest_files=[ "res://.import/PressSpace.png-55d06e3dfa858bd419c0781f227612aa.stex" ] + +[params] + +compress/mode=0 +compress/lossy_quality=0.7 +compress/hdr_mode=0 +compress/bptc_ldr=0 +compress/normal_map=0 +flags/repeat=0 +flags/filter=false +flags/mipmaps=false +flags/anisotropic=false +flags/srgb=2 +process/fix_alpha_border=true +process/premult_alpha=false +process/HDR_as_SRGB=false +process/invert_color=false +stream=false +size_limit=0 +detect_3d=true +svg/scale=1.0 diff --git a/images/Controls/PressSpace.tres b/images/Controls/PressSpace.tres new file mode 100644 index 0000000..2f6ce85 --- /dev/null +++ b/images/Controls/PressSpace.tres @@ -0,0 +1,19 @@ +[gd_resource type="SpriteFrames" load_steps=4 format=2] + +[ext_resource path="res://images/Controls/PressSpace.png" type="Texture" id=1] + +[sub_resource type="AtlasTexture" id=1] +atlas = ExtResource( 1 ) +region = Rect2( 0, 0, 48, 9 ) + +[sub_resource type="AtlasTexture" id=2] +atlas = ExtResource( 1 ) +region = Rect2( 48, 0, 48, 9 ) + +[resource] +animations = [ { +"frames": [ SubResource( 1 ), SubResource( 2 ) ], +"loop": true, +"name": "default", +"speed": 2.0 +} ] diff --git a/images/Controls/PressUp.png b/images/Controls/PressUp.png new file mode 100644 index 0000000..ea26632 Binary files /dev/null and b/images/Controls/PressUp.png differ diff --git a/images/Controls/PressUp.png.import b/images/Controls/PressUp.png.import new file mode 100644 index 0000000..61ba8b2 --- /dev/null +++ b/images/Controls/PressUp.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="StreamTexture" +path="res://.import/PressUp.png-8404c2624313d735f5b476b4b5d722ad.stex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://images/Controls/PressUp.png" +dest_files=[ "res://.import/PressUp.png-8404c2624313d735f5b476b4b5d722ad.stex" ] + +[params] + +compress/mode=0 +compress/lossy_quality=0.7 +compress/hdr_mode=0 +compress/bptc_ldr=0 +compress/normal_map=0 +flags/repeat=0 +flags/filter=false +flags/mipmaps=false +flags/anisotropic=false +flags/srgb=2 +process/fix_alpha_border=true +process/premult_alpha=false +process/HDR_as_SRGB=false +process/invert_color=false +stream=false +size_limit=0 +detect_3d=true +svg/scale=1.0 diff --git a/images/Controls/PressUp.tres b/images/Controls/PressUp.tres new file mode 100644 index 0000000..aecf92c --- /dev/null +++ b/images/Controls/PressUp.tres @@ -0,0 +1,19 @@ +[gd_resource type="SpriteFrames" load_steps=4 format=2] + +[ext_resource path="res://images/Controls/PressUp.png" type="Texture" id=1] + +[sub_resource type="AtlasTexture" id=1] +atlas = ExtResource( 1 ) +region = Rect2( 0, 0, 8, 9 ) + +[sub_resource type="AtlasTexture" id=2] +atlas = ExtResource( 1 ) +region = Rect2( 8, 0, 8, 9 ) + +[resource] +animations = [ { +"frames": [ SubResource( 1 ), SubResource( 2 ) ], +"loop": true, +"name": "default", +"speed": 2.0 +} ] diff --git a/project.godot b/project.godot index 46dabab..93f969e 100644 --- a/project.godot +++ b/project.godot @@ -65,6 +65,7 @@ config/icon="res://images/icon.png" [autoload] MusicPlayer="*res://scripts/MusicPlayer.gd" +Globals="*res://scripts/Globals.gd" [display] diff --git a/scenes/dialogue.tscn b/scenes/dialogue.tscn index 4849774..4185645 100644 --- a/scenes/dialogue.tscn +++ b/scenes/dialogue.tscn @@ -1,4 +1,4 @@ -[gd_scene load_steps=13 format=2] +[gd_scene load_steps=14 format=2] [ext_resource path="res://images/ui/dialogue_bg.png" type="Texture" id=1] [ext_resource path="res://fonts/dialog_default_font.tres" type="DynamicFont" id=2] @@ -7,6 +7,7 @@ [ext_resource path="res://fonts/dialogue_default_font_mono_aka_small.tres" type="DynamicFont" id=5] [ext_resource path="res://BlackScreen.tscn" type="PackedScene" id=6] [ext_resource path="res://scripts/BlackScreen.gd" type="Script" id=7] +[ext_resource path="res://scripts/ControlIndicator.gd" type="Script" id=8] [sub_resource type="VisualShaderNodeColorConstant" id=1] constant = Color( 0, 0, 0, 0.803922 ) @@ -106,6 +107,10 @@ __meta__ = { "_edit_use_anchors_": false } +[node name="ControlIndicator" type="AnimatedSprite" parent="MarginContainer/VBoxContainer"] +position = Vector2( 91, 75 ) +script = ExtResource( 8 ) + [node name="NameContainer" type="MarginContainer" parent="MarginContainer/VBoxContainer"] margin_top = 47.0 margin_right = 22.0 diff --git a/scenes/game1.tscn b/scenes/game1.tscn index d470348..70fdc6a 100644 --- a/scenes/game1.tscn +++ b/scenes/game1.tscn @@ -1,4 +1,4 @@ -[gd_scene load_steps=21 format=2] +[gd_scene load_steps=23 format=2] [ext_resource path="res://images/game1/opening.tres" type="SpriteFrames" id=1] [ext_resource path="res://images/game1/opening2bg.tres" type="SpriteFrames" id=2] @@ -7,6 +7,8 @@ [ext_resource path="res://scripts/game1/opening2_next_step_trigger.gd" type="Script" id=5] [ext_resource path="res://images/goo/goo5.tres" type="Resource" id=6] [ext_resource path="res://images/goo/goo8.tres" type="Resource" id=7] +[ext_resource path="res://scripts/ControlIndicator.gd" type="Script" id=8] +[ext_resource path="res://scripts/game1/ControlIndicators1.gd" type="Script" id=9] [ext_resource path="res://images/goo/goo4.tres" type="Resource" id=29] [ext_resource path="res://images/goo/BigGoo2.tres" type="Resource" id=30] [ext_resource path="res://images/goo/goo2.tres" type="Resource" id=31] @@ -93,6 +95,18 @@ goo_particles = [ ExtResource( 34 ), ExtResource( 30 ), ExtResource( 36 ), ExtRe direction = Vector2( -1, 0 ) spawn_rate = 2 +[node name="ControlIndicators" type="Node2D" parent="Opening2"] +position = Vector2( 37.7092, 95.9416 ) +script = ExtResource( 9 ) + +[node name="ControlIndicatorLeft" type="AnimatedSprite" parent="Opening2/ControlIndicators"] +position = Vector2( -7.50846, 0 ) +script = ExtResource( 8 ) + +[node name="ControlIndicatorRight" type="AnimatedSprite" parent="Opening2/ControlIndicators"] +position = Vector2( 7.84219, 0 ) +script = ExtResource( 8 ) + [node name="Opening1" type="AnimatedSprite" parent="."] frames = ExtResource( 1 ) centered = false diff --git a/scripts/ControlIndicator.gd b/scripts/ControlIndicator.gd new file mode 100644 index 0000000..6b230f6 --- /dev/null +++ b/scripts/ControlIndicator.gd @@ -0,0 +1,41 @@ +extends AnimatedSprite + +const press_a = preload("res://images/Controls/PressA.tres") +const press_space = preload("res://images/Controls/PressSpace.tres") + +const press_down = preload("res://images/Controls/PressDown.tres") +const press_left = preload("res://images/Controls/PressLeft.tres") +const press_up = preload("res://images/Controls/PressUp.tres") +const press_right = preload("res://images/Controls/PressRight.tres") + +var last_is_joy = false + +func show_press(action : String): + if action == 'ui_accept': + frames = press_a if last_is_joy else press_space + if action == 'right': + frames = press_right + if action == 'left': + frames = press_left + if action == 'down': + frames = press_down + if action == 'up': + frames = press_up + play('default') + show() + +func _input(event): + last_is_joy = false + for b in [ + JOY_XBOX_A, + JOY_XBOX_B, + JOY_XBOX_X, + JOY_XBOX_Y, + JOY_DPAD_UP, + JOY_DPAD_LEFT, + JOY_DPAD_RIGHT, + JOY_DPAD_DOWN, + ]: + if Input.is_joy_button_pressed(-1, b): + last_is_joy = true + break diff --git a/scripts/DialogueBox.gd b/scripts/DialogueBox.gd index 7096da2..12ea1ce 100644 --- a/scripts/DialogueBox.gd +++ b/scripts/DialogueBox.gd @@ -16,6 +16,7 @@ onready var expression_node = get_node(expression_node_path) as RichTextLabel onready var music_player = get_node('/root/MusicPlayer') as MusicPlayer onready var black_screen = $BlackScreen +onready var control_indicator = $MarginContainer/VBoxContainer/ControlIndicator var dialogue : Array var index : int @@ -31,6 +32,8 @@ func _ready(): assert(text_label != null) assert(music_player != null) assert(black_screen != null) + + $MarginContainer.hide() func start_dialogue(dialog_path : String) -> DialogueAction: var dialogue = DialogueAction.new() @@ -122,11 +125,15 @@ func update() -> void: func animate_text(): var animated = index text_label.visible_characters = 0 + control_indicator.hide() while animated == index && text_label.visible_characters < text_label.text.length(): if text_label.text[text_label.visible_characters] == ' ': text_label.visible_characters += 1 text_label.visible_characters += 1 yield(get_tree().create_timer(0.4 if text_label.text[text_label.visible_characters - 1] == '.' else 0.05), 'timeout') + if !Globals.ui_accept_tip: + control_indicator.show_press('ui_accept') + Globals.ui_accept_tip = true func stop_waiting(): waiting = false diff --git a/scripts/Globals.gd b/scripts/Globals.gd new file mode 100644 index 0000000..2c05a00 --- /dev/null +++ b/scripts/Globals.gd @@ -0,0 +1,3 @@ +extends Node + +var ui_accept_tip = false diff --git a/scripts/game1/ControlIndicators1.gd b/scripts/game1/ControlIndicators1.gd new file mode 100644 index 0000000..13eb8b2 --- /dev/null +++ b/scripts/game1/ControlIndicators1.gd @@ -0,0 +1,13 @@ +extends Node2D + + +func _ready(): + $ControlIndicatorLeft.show_press('left') + $ControlIndicatorRight.show_press('right') + +func _input(event): + if !get_parent().get_node("Player").sleep: + if event.is_action_pressed('left'): + $ControlIndicatorLeft.hide() + if event.is_action_pressed('right'): + $ControlIndicatorRight.hide()