Skip to content

Instantly share code, notes, and snippets.

@andrew-wilkes
Last active December 1, 2019 11:39
Show Gist options
  • Save andrew-wilkes/348e871498ca4be11ab29188899f89de to your computer and use it in GitHub Desktop.
Save andrew-wilkes/348e871498ca4be11ab29188899f89de to your computer and use it in GitHub Desktop.
Phonetic Alphabet Memorizer
extends CenterContainer
const words = "ALFA, BRAVO, CHARLIE, DELTA, ECHO, FOXTROT, GOLF, HOTEL, INDIA, JULIETT, KILO, LIMA, MIKE, NOVEMBER, OSCAR, PAPA, QUEBEC, ROMEO, SIERRA, TANGO, UNIFORM, VICTOR, WHISKEY, X-RAY, YANKEE, ZULU"
const words2 = "Amsterdam, Baltimore, Casablanca, Denmark, Edison, Florida, Gallipoli, Havana, Italia, Jerusalem, Kilogramme, Liverpool, Madagascar, New York, Oslo, Paris, Quebec, Roma, Santiago, Tripoli, Uppsala, Valencia, Washington, Xanthippe, Yokohama, Zurich"
const words3 = "Able, Baker, Charlie, Dog, Easy, Fox, George, How, Item, Jig, King, Love, Mike, Nan, Oboe, Peter, Queen, Roger, Sugar, Tare, Uncle, Victor, William, X-ray, Yoke, Zebra"
const words4 = "Alfa, Bravo, Coca, Delta, Echo, Foxtrot, Gold, Hotel, India, Juliett, Kilo, Lima, Metro, Nectar, Oscar, Papa, Quebec, Romeo, Sierra, Tango, Union, Victor, Whiskey, eXtra, Yankee, Zulu"
var list
var show_letter = true
var i = 0
func _ready():
list = words.split(", ") as Array # Don't need to cast to Array in 3.2
i = list.size()
func _on_Timer_timeout():
if i == list.size():
list.shuffle()
i = 0
if show_letter:
$Label.set_text(list[i][0])
else:
$Label.set_text(list[i])
i += 1
show_letter = !show_letter
@andrew-wilkes
Copy link
Author

The scene has a root node of CenterContainer and child nodes of Label (text property = "Get Ready!") and Timer (2 second loop). Connect the timer to the main script.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment