Halting the game until user taps - Character Dialog.

Hi folks,
           I’m usually quite competent with Corona but I’m not sure how to achieve this idea.

Basically, imagine 2 characters are talking.
I would like it so after Person A speaks, the text remains there until the player taps; which causes the conversation to continue until he taps again.

I can imagine this is basic but I’m not sure if there’s a command I don’t know. 

So something like:
(Just a rough idea)

local textSpeech = newText("", 0, 100, "Narkisim", 24); --Person A Speaks textSpeech.text = "Hi, I'm Person A" --\<\<\< Wait for user input. textSpeech.text = "I'm person B!" Timers... Sound Effects... --\<\<\< Wait for user input.

You could do something like this:

[lua]

local chat = {}

local people = {“Person A”, “Person B”, “Person C”}

local chatPos = 1

chat[1] = {txt = “Hi, I’m person A.”, pid = 1}

chat[2] = {txt = “Nice to meet you, A. I’m B.”, pid = 2}

chat[3] = {txt = “Have you met my friend, C?”, pid = 1}

chat[4] = {txt = “No, nice to see you.”, pid = 2}

chat[5] = {txt = “Nice to see you, too”, pid = 3}

local textSpeaker = newText("", 0, 50, “Narkisim”, 24)

local textSpeech = newText("", 0, 100, “Narkisim”, 24);

local updateText = function ()

  local speech = chat[chatPos]

  textSpeaker.text = people[speech.pid]

  textSpeech.text = speech.txt

end

updateText()

local touchScreen = function(event)

    if event.phase == “ended” then

        if chatPos < #chat then

            chatPos = chatPos + 1

            updateText()

        else

            – conversation ended

        end

    end

end

Runtime:addEventListener(“touch”,touchScreen)

[/lua]

That was genuinely a big help.

I was able to build on that nicely, adding in some character fades depending on who’s talking and stuff.
I thankyou for the assistance :slight_smile:

You could do something like this:

[lua]

local chat = {}

local people = {“Person A”, “Person B”, “Person C”}

local chatPos = 1

chat[1] = {txt = “Hi, I’m person A.”, pid = 1}

chat[2] = {txt = “Nice to meet you, A. I’m B.”, pid = 2}

chat[3] = {txt = “Have you met my friend, C?”, pid = 1}

chat[4] = {txt = “No, nice to see you.”, pid = 2}

chat[5] = {txt = “Nice to see you, too”, pid = 3}

local textSpeaker = newText("", 0, 50, “Narkisim”, 24)

local textSpeech = newText("", 0, 100, “Narkisim”, 24);

local updateText = function ()

  local speech = chat[chatPos]

  textSpeaker.text = people[speech.pid]

  textSpeech.text = speech.txt

end

updateText()

local touchScreen = function(event)

    if event.phase == “ended” then

        if chatPos < #chat then

            chatPos = chatPos + 1

            updateText()

        else

            – conversation ended

        end

    end

end

Runtime:addEventListener(“touch”,touchScreen)

[/lua]

That was genuinely a big help.

I was able to build on that nicely, adding in some character fades depending on who’s talking and stuff.
I thankyou for the assistance :slight_smile: