sped up name entry, added delete, and max char limit
This commit is contained in:
parent
62e6e23d94
commit
098ab161de
17 changed files with 134 additions and 25 deletions
|
@ -2,20 +2,21 @@ tool
|
|||
extends "res://objects/enemy/enemy.gd"
|
||||
|
||||
signal letter_chosen(letter)
|
||||
signal backspace()
|
||||
|
||||
enum Glyph {
|
||||
A, B, C, D, E, F, G, H,
|
||||
I, J, K, L, M, N, O, P,
|
||||
Q, R, S, T, U, V, W, X,
|
||||
Y, Z, _0, _1, _2, _3, _4, _5,
|
||||
_6, _7, _8, _9,
|
||||
_6, _7, _8, _9, Backspace
|
||||
}
|
||||
const GLYPH_STRINGS = [
|
||||
"A", "B", "C", "D", "E", "F", "G", "H",
|
||||
"I", "J", "K", "L", "M", "N", "O", "P",
|
||||
"Q", "R", "S", "T", "U", "V", "W", "X",
|
||||
"Y", "Z", "0", "1", "2", "3", "4", "5",
|
||||
"6", "7", "8", "9",
|
||||
"6", "7", "8", "9", ""
|
||||
]
|
||||
|
||||
export (Glyph) var glyph: int = 0 setget _set_glyph
|
||||
|
@ -34,6 +35,8 @@ func _ready() -> void:
|
|||
for node in get_tree().get_nodes_in_group("gets_letters"):
|
||||
if node.has_method("_on_letter_chosen"):
|
||||
connect("letter_chosen", node, "_on_letter_chosen")
|
||||
if node.has_method("_on_backspace"):
|
||||
connect("backspace", node, "_on_backspace")
|
||||
|
||||
func _process(delta: float) -> void:
|
||||
if Engine.editor_hint:
|
||||
|
@ -43,7 +46,11 @@ func _process(delta: float) -> void:
|
|||
|
||||
func die() -> void:
|
||||
emit_signal("letter_chosen", GLYPH_STRINGS[glyph])
|
||||
if glyph == Glyph.Backspace:
|
||||
emit_signal("backspace")
|
||||
|
||||
func _on_Hitbox_area_entered(area):
|
||||
emit_signal("letter_chosen", GLYPH_STRINGS[glyph])
|
||||
if glyph == Glyph.Backspace:
|
||||
emit_signal("backspace")
|
||||
._on_Hitbox_area_entered(area)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue