Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: Is there an easier way to do cutscenes?  (Read 2877 times)

0 Members and 1 Guest are viewing this topic.

edumoette

  • Newbie
  • *
  • Posts: 23
    • View Profile
Is there an easier way to do cutscenes?
« 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

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11030
    • View Profile
    • development blog
    • Email
Re: Is there an easier way to do cutscenes?
« Reply #1 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.
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

edumoette

  • Newbie
  • *
  • Posts: 23
    • View Profile
Re: Is there an easier way to do cutscenes?
« Reply #2 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.

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11030
    • View Profile
    • development blog
    • Email
Re: Is there an easier way to do cutscenes?
« Reply #3 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.
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

 

anything