initial commit
This commit is contained in:
78
Input.gd
Normal file
78
Input.gd
Normal file
@@ -0,0 +1,78 @@
|
||||
extends Control
|
||||
|
||||
# Called when the node enters the scene tree for the first time.
|
||||
func _ready():
|
||||
$char1.editable = true
|
||||
$char2.editable = false
|
||||
$char3.editable = false
|
||||
$char4.editable = false
|
||||
$char5.editable = false
|
||||
$char1.grab_focus()
|
||||
|
||||
|
||||
# These make sure the text entered is a letter, and locks the field if it is.
|
||||
func _on_char1_text_changed(new_text):
|
||||
var regex = RegEx.new()
|
||||
regex.compile("[a-zA-Z]")
|
||||
if regex.search(new_text):
|
||||
$char1.editable = false
|
||||
$char2.grab_focus()
|
||||
$char2.editable = true
|
||||
elif new_text == "":
|
||||
pass
|
||||
else:
|
||||
print("bad")
|
||||
|
||||
func _on_char2_text_changed(new_text):
|
||||
var regex = RegEx.new()
|
||||
regex.compile("[a-zA-Z]")
|
||||
if regex.search(new_text):
|
||||
$char2.editable = false
|
||||
$char3.grab_focus()
|
||||
$char3.editable = true
|
||||
elif new_text == "":
|
||||
pass
|
||||
else:
|
||||
print("bad")
|
||||
|
||||
|
||||
func _on_char3_text_changed(new_text):
|
||||
var regex = RegEx.new()
|
||||
regex.compile("[a-zA-Z]")
|
||||
if regex.search(new_text):
|
||||
$char3.editable = false
|
||||
$char4.grab_focus()
|
||||
$char4.editable = true
|
||||
elif new_text == "":
|
||||
pass
|
||||
else:
|
||||
print("bad")
|
||||
|
||||
func _on_char4_text_changed(new_text):
|
||||
var regex = RegEx.new()
|
||||
regex.compile("[a-zA-Z]")
|
||||
if regex.search(new_text):
|
||||
$char4.editable = false
|
||||
$char5.grab_focus()
|
||||
$char5.editable = true
|
||||
elif new_text == "":
|
||||
pass
|
||||
else:
|
||||
print("bad")
|
||||
|
||||
func _on_char5_text_changed(new_text):
|
||||
var regex = RegEx.new()
|
||||
regex.compile("[a-zA-Z]")
|
||||
if regex.search(new_text):
|
||||
$char5.editable = false
|
||||
elif new_text == "":
|
||||
pass
|
||||
else:
|
||||
print("bad")
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user