Pause menu, layout object, InputSystem object, etc

This forum is currently in read-only mode.
From the Asset Store
This is a single chapter from the "Construct Starter Kit Collection". It is the Student Workbook for its Workshop.
  • I'm using a pause menu, which I've created thanks to a layout object. Press "Pause", and a layout object is created, displaying a different layout on which I've made the pause menu. And it helps that if it's set to "modal", it freezes everything else behind it, but everything happening in itself still carries on like normal.

    I've started to try and use the InputSystem object, since I've always wanted customizable controls, and the ability to use a PC controller.

    However, InputSystem has quite a few glitchy things, and since it's been a year since its last update, I doubt it's being worked on anymore.

    Problem 1: InputSystem doesn't work with modal layout objects.

    Let's say I have InputSystem on level 1.

    Player presses "Pause".

    Modal layout object pops up.

    Layout object doesn't detect InputSystem object.

    This happens even when "InputSystem" is a global object.

    A global Mouse and Keyboard object could be detected by a modal layout object. So it must be some problem with InputSystem.

    Solutions?

    Copy and paste a non-global InputSystem object to modal layout object.

    This actually does seem to work, and an InputSystem object in the layout object itself can be used.

    This solution, however, leads to...

    Problem 2:

    InputSystem is the only object I've found that lags up an app while loading.

    Player presses "Pause".

    Game freezes up for half-a-second.

    Player object and enemies seemed to have moved within that half-second of lag, and the modal layout object is displayed.

    I don't really want any lag while pausing, and certainly not lag where the player object is still moving, pauses, and is going to appear somewhere else in the middle of moving.

    Solutions?

    Uncheck "modal" on the layout object.

    With this, I don't need any global InputSystem object or anything. The pause menu in the layout object DOES respond. With no need for an InputSystem in the pause layout (since a modal layout object needs one), there's no InputSystem to load upon creating the layout object.

    This however, leads to another predictable problem:

    everything behind the layout object is still going on. Player object animation and movement, enemies, everything. Not much of a pause menu if it doesn't pause.

    And I can't just set time scale to 0, because that affects the modal layout object, as well.

    What I want to know:

    1) Would it be possible to fix InputSystem so that it loads seamlessly, like everything else? Even when I was using Mouse and Keyboard, it loaded instantly. No lag. I doubt this is possible since the creator seems to have kinda forgotten about this.

    2) Is it possible to have timescale affect different things? Is it possible to have timescale freeze a single layer, or certain type of object? Is it possible to have timescale freeze the level layout and still have the timescale for the pause menu layout object remain normal somehow? If not, I suspect I'll have to try and create my own unique pause. (If player presses "Pause", stop enemy movement, enemy animation, stop bullet movement, stop player movement, etc...)

  • Unless the layout object has been fixed since 1.2 (and I'm not aware that it has) it's still broken, and it will break your game when you make an .exe. It always works fine in the .cap, but it breaks when you export your game.

    I love the layout object and I wish something could've been done about it because it has so many great uses, but those are the breaks.

  • Unless the layout object has been fixed since 1.2 (and I'm not aware that it has) it's still broken, and it will break your game when you make an .exe. It always works fine in the .cap, but it breaks when you export your game.

    I love the layout object and I wish something could've been done about it because it has so many great uses, but those are the breaks.

    Um... I've made tons of .exe files, and never had that happen when the layout object was created. o_O

    http://www.scirra.com/forum/timescaling-and-timedelta-for-individual-objects_topic37905_page2.html

    ::tries this out::

    ::notices player object freezes in mid-air::

    ::goes back, sets events to enable and disable the platform behavior::

    ::disables behavior, player object freezes again... enables behavior, player object resumes without any problem::

    ::goes back combines with "pause animation" and "resume animation"::

    ::now the player object looks like its being frozen in mid-air and mid-run while the enemies keep moving around... and then resumes sliding from deceleration upon being unfrozen::

    Oh my god... o_o That's awesome. I wonder if I could implement this. I had no idea about this. And seeing the other enemies moving around the player while it looks like it's "frozen in time" gives me a great idea for a boss or something that can stop time, maybe. Or freeze the player in a chunk of ice.

    But if I apply this to EVERYTHING, this MIGHT work... This might allow me to use a non-modal layout object.

    It helps that I'm already using a true/false global variable for "Pause". I COULD incorporate that into a custom-made "pausing" or "freezing" or "time scale = 0"-like event.

    For example, "If 'Pause' = 1, disable enemy platform behavior, bullet behavior (maybe? If that works?), player behavior, pause enemy animation, pause player animation, etc.... else, enable enemy platform behavior, enemy animation, etc."

    Unfortunately, it means I'd have to manually set EVERYTHING to stop or freeze if the game is in a state of "pause". If I have a time bomb for example, I'll have to do something like, "If 'Pause' = 0 + every tick, subtract 1 from 'Timer'."

  • Um... I've made tons of .exe files, and never had that happen when the layout object was created. o_O

    But let me ask you this: how many layouts did your projects have? And, were they full games? I've noticed that if you make a small .cap and export it (like two layouts with little or no graphics and few or zero events), the layout object works fine, but if you start adding a lot of stuff the layout object tends to break.

    I ask because all of mine had at least 6 layouts and a few were full games. I even had one where I asked for help on how to fix it and our best and brightest told me the object is broken and was going to require a fix that wasn't in the plans for further development.

    Any chance you have a file showing how you're using the object? If you're doing something to avoid the break it would be really beneficial for everybody who's had a problem to see it.

  • > Um... I've made tons of .exe files, and never had that happen when the layout object was created. o_O

    But let me ask you this: how many layouts did your projects have? And, were they full games?

    Um, 12.

    Game Start-Up - This is just where I store global objects so that there's no chance of accidentally creating more than one. Stuff that'll never have a need to be destroyed, like AudioX objects, or the MouseKeyboard object.

    Title Screen

    File Select

    Pause Menu

    Message Box

    World Map

    Test Level 1

    Test Level 2

    Experiment Lab - This used to be the old "test level".

    Storage Room - This is where I keep things that won't have to appear until they're called or created, like player objects, the modal layout object, etc. I noticed that if THIS layout is EVER played, the project crashes. So I just avoid it and keep it to hold all the objects that only need to appear when they need to. An "origin" room, if you will. It's also where the HUD originates as well, with all other HUD layers inheriting this original one.

    Paused - This used to be the old pause thingy. Just an experiment, really.

    Lose Life - And this is so I can reload a level if a player dies. Having "Restart Layout" from the system event doesn't really reload a level from scratch. It's a bit glitchy. So when a player's health = 0, subtract 1 from 'Lives', and go to layout 'Lose Life'." On start of layout, it's set to take you to a layout depending on what the global variable 'Stage' is.

    ask because all of mine had at least 6 layouts and a few were full games. I even had one where I asked for help on how to fix it and our best and brightest told me the object is broken and was going to require a fix that wasn't in the plans for further development.

    I... Really? That worries me now... ;_;

    ny chance you have a file showing how you're using the object? If you're doing something to avoid the break it would be really beneficial for everybody who's had a problem to see it.

    I... don't think I'm doing anything special, really... And I can post a .cap, but it'd probably be a hugely disorganized mess to anyone else but me. But if you want, I could. ^^;

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I played around with as much plugins as possible, and most of them have issues - some severe and some just annoying. With the layout object I encountered severe ones. I wouldn't recommend using it. But that's just one opinion from just one of the many users around here.

    I never needed the layout object for my projects. Pause menus, as an example are just an additional layer, sometimes using the "inheritance layer" option (which has issues too, but just annoying ones)

    The problem with time... I used a simple but effective solution in a classic vertical shooter. The shooter is totally time-based, but doesn't use any behaviors. Moving something is just a matter of setting or adding the equivalent of "n * TimeDelta". With this it moves n times per second, if timescale = 1.0

    For a bullet-time-like effect to slow down the whole game except for the player's ship strafing and the cannon shooting, I just added a timescale division for those both.

    "(n / timescale) * TimeDelta" This will let something move (or rotate, or animate, or whatever) at the same amount for the real time.

    Let's say, something moves at 20 pixel per second, when timescale is 1.0. Now timescale is set to 0.1, and what you see is an object moving with 2 pixel per second. But you want to see it still moving 20 px/s. To do that you must move it at 200 px/s, because the time is only progressing at a tenth of the original time. Easy, just increase the amount relative to the loss of time.

    20 / timescale = 20 / 0.1 = 200

    Of course, with such a calculation timescale may never be set to zero, division by 0 will not work out^^ For my pause menu I just did set timescale to a very small value instead of 0, e.g. 0.00001, which appears as pausing, unless the player keeps the pause menu open for a few hours.

    I don't know if it helps you, but I thought I'd share it nevertheless <img src="smileys/smiley4.gif" border="0" align="middle" />

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