Add control indicators (tips)

This commit is contained in:
Alice Gaudon 2020-08-20 14:45:54 +02:00
parent ae4fe3a7bc
commit f612d17301
25 changed files with 404 additions and 2 deletions

BIN
images/Controls/PressA.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 167 B

View File

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

View File

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

Binary file not shown.

After

Width:  |  Height:  |  Size: 151 B

View File

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

View File

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

Binary file not shown.

After

Width:  |  Height:  |  Size: 154 B

View File

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

View File

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

Binary file not shown.

After

Width:  |  Height:  |  Size: 150 B

View File

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

View File

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

Binary file not shown.

After

Width:  |  Height:  |  Size: 250 B

View File

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

View File

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

BIN
images/Controls/PressUp.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 150 B

View File

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

View File

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

View File

@ -65,6 +65,7 @@ config/icon="res://images/icon.png"
[autoload]
MusicPlayer="*res://scripts/MusicPlayer.gd"
Globals="*res://scripts/Globals.gd"
[display]

View File

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

View File

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

View File

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

View File

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

3
scripts/Globals.gd Normal file
View File

@ -0,0 +1,3 @@
extends Node
var ui_accept_tip = false

View File

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