Currently, I do it like this:
I create a separate .lua file for each level
inside each level file I have this(this is from the first level):
Code: Select all
Level.textObjects={
{["Text"]="Welcome to Hex!",["t"]=4},
{["Text"]="The main premise of this game is to capture all of the AI's hexagons",["t"]=3},
{["Text"]="To do this, hover over one of your(shown by the '1') fire element hexagons (the red ones)",["t"]=5},
{["Text"]="Hopefully, you see that two earth element hexagons (brown) were highlighted below your fire hexagon(all capturable neighbors are highlighted on-hover). Click now to take over them.",["t"]=7},
{["Text"]="You'll see you took over the hexagon and then the AI had a turn. Now, using what I told you, finish the level!",["t"]=4}
}
But it's very basic (it just displays text for ["t"] amount of time before displaying the next text). What I want to do is make it so the tutorial is paused until the player does something (for example, on the third text object it tells you to hover over your hexagons. I want it so it doesn't continue to the next part UNTIL you hover over one of your hexagons). Another action I want to be able to do is not continue until the player clicks on one of their hexagons (as told to the player on the 4th text object)
This is how I use the textObjects table in main.lua(I'm using hump.timer I believe):
Code: Select all
TutorialTimer:script(function(w)
if Level.textObjects then
for index, textObject in pairs(Level.textObjects) do
local text=textObject["Text"]
local timeUp=textObject["t"]
table.insert(Level.textObjectsOnScreen,{["text"]=text,x=20,y=50}) -- Level.textObjectsOnScreen just keeps ahold of the text dialogue information for love.draw
w(timeUp)
table.remove(Level.textObjectsOnScreen,1)
end
end
end)