The 'Real World Examples' Thread

This forum is currently in read-only mode.
0 favourites
From the Asset Store
Unlock platyers earning coins, and save it with Localstorage
  • Hey guys,

    Thought a thread like this would make sense to showcase solutions for problems that most likely all Construct users will go through at one point or another.

    1.) Pause Function:

    Let's start with something simple, a 'Pause' function for the game, which - if the 'Pause' variable is at 1 will freeze the game, show a 'Pause' image and pause the music. If it's at 0, it'll unfreeze the game, hide the 'Pause' image and resume the music. Pretty simple:

    <img src="http://thomasmahler.com/files/construct/images/PE%20-%20Pause_01.jpg">

    Then, in your controls event sheet, you'd simply set up an event that'd drive the 'Pause' global variable like this:

    <img src="http://thomasmahler.com/files/construct/images/PE%20-%20Pause_02.jpg">

    Et voila.

  • Pause menu

    Groups can be useful with this kind of problem. If you group all code in groups, you can disable one set of groups and enable the other set when pause button is pressed.

    The only problem with this is when you have to stop behaviors. Like objects which use platform, sine, physics behaviors. You can't access objects via behavior (at least I am not aware how). The solution would be to create one family per behavior, add family to each object using corresponding behavior and just disable these "behavior" families.

    Unfortunately, families seem to be broken in current version. To be accurate, the game results with bug when I use more than one family per object.

  • Just set timescale to 0 to pause every behavior.

    Also for the second screenshot at the top, you could set the global variable to '1 - global('Pause')' instead of the else event.

  • In order to make the thread a bit more useful, let's change the rules a bit:

    You can post:

    1) Requests

    2) Examples

    Using these templates:

    For Requests:

    Objective: What are you trying to achieve? Explain in simple steps that are easy to understand.

    Info: You could give examples like 'Look at this Youtube video, it should work like this!' - Just so people know exactly what you want to achieve.

    Resource: Post the .cap files of what you've already tried that didn't work.

    ///

    For Examples:

    Objective: What were you trying to achieve? What does the shown setup do?

    Info: "I used Containers in this case, because..." , "I thought there'd be a simpler way to do this, but I had to..." , "My idea was that I could just reuse...", etc. - Tell us how you got to your solution and what the whole deal is all about.

    Resource: Post a .cap file or a screenshot of your setup.

    -------------------------

    Okay, my turn:

    I'll start with a Request:

    Objective: I'm trying to set-up a smart dialogue system that'd work like in most other adventures or RPGs. If you overlap a sprite that you can talk to and you hit the action key, a dialogue box will be made visible and the platformer behavior will be frozen temporarily.

    The dialogueBox is just a textobject that's linked to a timeline object, just so I can create multi-page dialogues. Then, I hit the action key again to advance through the dialogue. Once I'm through the whole timeline period, the dialogueBox will be hidden, the platformer behavior will be set to active again and I can keep going.

    Info: Pretty standard dialogue behavior, should be understandable without extra info.

    Resource: I cobbled together a .cap file before and sent it to David. David corrected it, but we're still not quite there:

    http://www.thomasmahler.com/files/const ... _david.cap

  • Just set timescale to 0 to pause every behavior.

    Also for the second screenshot at the top, you could set the global variable to '1 - global('Pause')' instead of the else event.

    With timescale to 0 objects still check collisions and other stuff, so you can't really make a pause in certain games.

    Just create a variable : "Paused".

    Before every game condition check if "Paused" is 0.

  • Before every game condition check if "Paused" is 0.

    If you really need to do that, you could just enable/disable a group of events, or put them all in a subevent to a 'paused is 0' event. You definitely don't need to repeat the condition over and over.

  • You can also pause by using a modal layout object.

  • You can also pause by using a modal layout object.

    What is this? I've seen the term used before, but I have absolutely no clue what it means

    I'm probably really stupid for not knowing, huh?

  • Makine a layout object modal means it pauses everything in the layout below it.

    Well, almost everything - there's a bug at the moment that still runs some mouseclick events, but it's not supposed to.

  • > You can also pause by using a modal layout object.

    >

    What is this? I've seen the term used before, but I have absolutely no clue what it means

    I'm probably really stupid for not knowing, huh?

    No. Just something you probably never found a use for. The layout object (which allows layouts to be show in other layouts (

    yo dawg we put a layout in your layout so you can view layouts while you view layouts!

    )).

    The layout object has a few modes. One of them is modal.

    Edit:

    ARRGGH beaten to the punch.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Pausing in Flash works the same way. I don't use Construct, because I'm waiting for the 1.0 release, but I do use Flash CS3, and I must say that I know no better way to pause a game than use a Boolean variable called "gamePaused" and a bunch of if statements. If someone knows a different approach, please, share your knowledge. As of right now, I just remove/disable event listeners when the game is paused and add/enable them again when the game is unpaused, but there are still some problems to overcome.

  • Pausing in Flash works the same way. I don't use Construct, because I'm waiting for the 1.0 release, but I do use Flash CS3, and I must say that I know no better way to pause a game than use a Boolean variable called "gamePaused" and a bunch of if statements. If someone knows a different approach, please, share your knowledge.

    In Construct, just set the time scale to 0. Everything stops, events keep running. No need for loads of 'is paused' tests or enabling/disabling anything. Setting the time scale to 0 basically means 'stop time from passing'.

  • Timescale works for "going to eat dinner"-pauses. If you want to pause the game to view your inventory for example you would need to do it the hard way.

    A sub-application plugin would come in handy in the future, i know it's used a lot in mmf. But it's not really nescessary since there are not to hard workarounds.

  • There's a layout plugin to run layouts in others.

  • WOW! awsome! Can you timescale one layout without affecting the others?

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)