Game pausing for letting the player enter text into a GUI text box? SOLVED :)

Started by marbar, Mon 14/12/2009 12:41:57

Previous topic - Next topic

marbar

Hello,

Again, I've got a probably basic question that I couldn't solve on my own. At the beginning of my game, in the start room, I've created some text overlay and parallel speech anmiations for my main character. Now, I wanted to create a GUI, where the player can enter his name because I want to refer to this name in my text overlays.
The GUI is shown immediately after loading the room, and that is what I wanted. But the problem is now that at the same time, the text overlay and animations begins, and I have to wait till the end before I can enter the player's name into the text box.
So what I actually want is the game paused till the player enters his name. I've tried it with the Game.paused-command, but when I do so, I can't interact with my text box any more and - again - can't enter the name. I've tried it also with an if-Function [if (gName.Visible == true) { text overlays, animations}] but it doesn't work that way either.

How can I solve this little problem?

Marina

monkey0506

I'm guessing you have these overlays an animations as part of one of the room's loading functions? If so, I'd recommend moving it into the room's rep_ex based on a condition such as:

Code: ags
bool done = false; // whether we've triggered the overlays and animations yet

function room_FirstLoad() {
  // turn on GUI, get player's name, etc.
}

function room_RepExec() {
  if ((!gTheGUIYouAreUsing.Visible) && (!done)) { // this is a shortcut for checking Visible == false and done == false
    // text overlays and animations
    done = true;
  }
}


You would presumably then just turn the GUI off after the player has entered their name. The done variable lets us track whether or not we've already initiated the animations and such. So we just wait until the GUI gets turned off, and if the animations haven't been done yet we start them, and voila! :D And BTW, I see you only have 6 posts so far, welcome to AGS! :)

marbar

Hello Monkey!

Thank you very much, now it's working properly and I'm reaaaaalllly glad! Jippiiie! :-))

And, yes, I'm new on AGS and this forum...I've been starting to create a game only a few days ago and I can't stop it any more, it's so much FUN! And I must say this forum here is really very helpful....that's why I am really thankful! ;)

Bye and a hug

monkey0506

Yay a hug! :D Glad to hear you got it sorted out then. Have fun with AGS!

SMF spam blocked by CleanTalk