SFML community forums

Help => General => Topic started by: edumoette on July 23, 2012, 06:42:52 pm

Title: Is there an easier way to do cutscenes?
Post by: edumoette on July 23, 2012, 06:42:52 pm
Its kinda like a pokemon chat type thing....where its not exactly a cutscene but the character shouldnt be able to move or execute any actions while a conversation is going on.

Heres what im doing:
Code: [Select]
if(//cutscene is playing)
 {if (sf::Keyboard:: isKeyPressed(sf::Keyboard::Up, Down, Right, Left))
{character.move(0,0);} // Obviously thats wrong syntax but i do that 4 times for each direction.
if(//Whatever actions the character can do)
{//Set everything to 0 manually. }
is there a quicker way or command to cut everything out? while two characters are talking? Like a pause during text display some how?
Thanks
Title: Re: Is there an easier way to do cutscenes?
Post by: eXpl0it3r on July 23, 2012, 07:20:14 pm
Please use the code tags correctly (e.g. code=cpp or code=none).

This all completly depends on your code design and class structures, but the trivial solution is a simple if statement and a boolean variable that determin wether you're having a cutscene or not.
Title: Re: Is there an easier way to do cutscenes?
Post by: edumoette on July 23, 2012, 10:15:26 pm
I understand that, im wondering if there is something that i can set the bool to, to make it just pause everything but the text.
Title: Re: Is there an easier way to do cutscenes?
Post by: eXpl0it3r on July 23, 2012, 11:53:24 pm
Your question doesn't make any sense to me. :o

You can do something like:
bool pause = false;

while(window.isOpne())
{
   // Handle events
   if(!pause)
   {
      // Update everything
   }
   // Only update stuff that will happen in the cutscene/pause

   window.clear();
   if(!pause)
   {
      // Draw all the sprites/texts
   }
   // Only draw the texts that will be needed during the cutscene.
   window.display();
}

Of course this can get messy quite fast, thus having diffrent functions/classes/'states' dealing with such a thing could be an advantage, that depends on your game & code design.