Created ESCGame class to force game.tscn scene to have empty functions by inheritance.

Also continued some tests about tooltip following mouse.
Fixed project settings wrongly set.
This commit is contained in:
Julian Murgia
2021-02-11 07:15:55 +01:00
parent 6aa466d6d2
commit 52d19c34bd
19 changed files with 204 additions and 67 deletions

View File

@@ -1,16 +0,0 @@
[gd_scene load_steps=3 format=2]
[ext_resource path="res://addons/escoria-core/game/core-scripts/esccharacter.gd" type="Script" id=1]
[sub_resource type="CapsuleShape2D" id=1]
[node name="character" type="KinematicBody2D"]
script = ExtResource( 1 )
[node name="AnimatedSprite" type="AnimatedSprite" parent="."]
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
shape = SubResource( 1 )
[node name="AnimationPlayer" type="AnimationPlayer" parent="."]

View File

@@ -1,3 +0,0 @@
[gd_scene format=2]
[node name="game" type="CanvasLayer"]

View File

@@ -1,55 +0,0 @@
extends RichTextLabel
# Infinitive verb
var current_action : String
# Target item/hotspot
var current_target : String
# Preposition: on, with...
var current_prep : String = "with"
# Target 2 item/hotspot
var current_target2 : String
var waiting_for_target2 = false
func _ready():
escoria.esc_runner.connect("action_changed", self, "on_action_selected")
func on_action_selected() -> void:
current_action = escoria.esc_runner.current_action
update_tooltip_text()
func set_target(target : String, needs_second_target : bool = false) -> void:
current_target = target
if needs_second_target:
waiting_for_target2 = true
update_tooltip_text()
func set_target2(target2 : String) -> void:
current_target2 = target2
update_tooltip_text()
func update_tooltip_text():
bbcode_text = "[center]"
if !current_action.empty():
bbcode_text += current_action
bbcode_text += "\t"
bbcode_text += current_target
if waiting_for_target2 and current_target2.empty():
bbcode_text += "\t"
bbcode_text += current_prep
if !current_target2.empty():
bbcode_text += "\t"
bbcode_text += current_prep
bbcode_text += "\t"
bbcode_text += current_target2
bbcode_text += "[/center]"

View File

@@ -1,26 +0,0 @@
[gd_scene load_steps=5 format=2]
[ext_resource path="res://addons/escoria-core/game/assets/fonts/onesize/ONESIZE_.TTF" type="DynamicFontData" id=1]
[ext_resource path="res://addons/escoria-core/template_scenes/label/action_target_tooltip.gd" type="Script" id=2]
[sub_resource type="DynamicFont" id=1]
size = 30
font_data = ExtResource( 1 )
[sub_resource type="DynamicFont" id=2]
size = 30
font_data = ExtResource( 1 )
[node name="tooltip" type="RichTextLabel"]
anchor_right = 0.526
anchor_bottom = 0.06
margin_right = -0.280029
margin_bottom = -10.0
custom_fonts/mono_font = SubResource( 1 )
custom_fonts/normal_font = SubResource( 2 )
bbcode_enabled = true
scroll_active = false
script = ExtResource( 2 )
__meta__ = {
"_edit_use_anchors_": false
}

View File

@@ -1,11 +0,0 @@
extends RichTextLabel
var current_target : String
func set_target(target : String) -> void:
current_target = target
update_tooltip_text()
func update_tooltip_text():
bbcode_text = current_target

View File

@@ -1,28 +0,0 @@
[gd_scene load_steps=5 format=2]
[ext_resource path="res://addons/escoria-core/game/assets/fonts/onesize/ONESIZE_.TTF" type="DynamicFontData" id=1]
[ext_resource path="res://addons/escoria-core/template_scenes/label/target_tooltip.gd" type="Script" id=2]
[sub_resource type="DynamicFont" id=1]
size = 30
font_data = ExtResource( 1 )
[sub_resource type="DynamicFont" id=2]
size = 30
font_data = ExtResource( 1 )
[node name="tooltip" type="RichTextLabel"]
anchor_right = 0.7
anchor_bottom = 0.06
margin_left = 1.49829
margin_right = 1.21826
margin_bottom = -10.0
custom_fonts/mono_font = SubResource( 1 )
custom_fonts/normal_font = SubResource( 2 )
bbcode_enabled = true
bbcode_text = "[center][/center]"
scroll_active = false
script = ExtResource( 2 )
__meta__ = {
"_edit_use_anchors_": false
}