Pausing and Unpausing and also Menu System

0 favourites
From the Asset Store
A well commented template with list menus and shops to use in your top-down RPGs or metroidvania games!
  • Hi,

    I'm having trouble making somewhat sophisticated pausing and menu systems.

    I made the post below, so you can know what the project is that I'm working on...

    http://www.scirra.com/forum/interactive-comic-book-how-many-people-would-buy_topic49895.html?KW=

    (first of all you can access the hud at the top by clicking the top black bar or you can hover over the top corners to bring up either the pause or menu buttons)

    As you can see from my project capx (below), when you click the pause button (top right), everything pauses as it should. However, if you leave it paused you notice that it still goes to the next layout anyway. I know this is because the system is still running and only the object timescales are paused, but I don't know how to fix it. If I use the system timescale = 0 then I will run into problems with animations of the play, pause, and menu (top left) buttons, probably some other problems way down the road as I add more features.

    As you can see I have timescale instance variables for each item in layout 1 (I haven't added them to the other layouts yet because what's the point if it doesn't work). When layout 1 starts, only the zooming in part has a timescale instance variable of 1, everything else starts at 0. When it is time for things to fade in and out, those instance variables then become 1. This (and the lovely family behaviors system) helps everything from popping up at once right at the start. Any ideas how to also pause the transition to the next layout without actually pausing the whole system??

    Next problem...

    As you can see I've begun the process developing a pretty good menu system (yes, the layout is empty but that's the easy part; there will be some stats and whatnot). You click on the button in the top left, which brings up the menu layout. However, I can't find any function anywhere in the program that returns you to the previous layout. Let's say you're on layout 2...you go to the menu, then exit the menu. Where do you go? If I program the menu event sheet to go to layout 2, then it goes to layout 2 everytime, regardless of which layout you were on. When I did a search for this problem on scirra, I found a post where it mentions that you actually CAN go to a previous layout, but it's only on contruct classic. Why isn't this feature on construct 2? Any ideas on how to fix this one, or am I going to have to put all the menu items on every single layout of the comic (there will probably be something like 75-100 layouts when the whole thing is finished).

    thanks.

    http://philipcomposer.com/comic/unnamed.capx

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • First problem: I would try using "System -> Set object timescale" on the objects you don't want to pause.

    Second problem: When you go to the menu layout, save the current layout's name to a global text variable. Then, when you resume game, you can use "System -> Go to layout (by name)" and input the variable name.

    I kind of skimmed through your post, so tell me if it's not what you're looking for. <img src="smileys/smiley17.gif" border="0" align="middle" />

  • The thing is, I want to pause everything, including the automatic tendency for the system to switch layouts. See, the program is still ticking even though all the objects are paused, thus time still runs. Is there a way to maybe turn the "go to layout" function as a global variable that I can switch on and off (this is inspired by your solution to the menu problem)?

    I will try the menu fix and let you know.

  • I can't open your .capx since it uses 3rd party plugins.

    So this layout change happens when a certain amount of time has gone by?

  • My bad. Here is the capx without the 3rd party plugins. I use Rex's Touchmouse plugin. Very useful for easy testing on my android devices.

    This has mouse only...

    http://philipcomposer.com/comic/unnamed.capx

  • Hmm, still says it uses TouchMouse.

  • oops, forgot to delete the touchmouse instance. should work now...

    http://philipcomposer.com/comic/unnamed.capx

    I'm such a noob...

  • I'm still not getting the whole menu global text variable thing. It's a little too complicated for me to even explain. Here's the updated capx. You can go to the menu event sheet to see what I changed.

    http://philipcomposer.com/comic/unnamed.capx.

    Thanks.

  • I was already working on the .capx so didn't get a chance to see your updated file. I think I solved most of your problems, but tell me if I broke something in the process.

    WayoftheSax_Edited.capx (r97)

    I went with a different approach for both the problems, I used a number variable "currentLevel" to keep track of levels, adding to the variable every time the level is changed.

    I also added another variable to trigger a level change. With the "changeLevel" variable, you can do a check if the game is paused every time your layout is about to change.

    The layout will restart when you enter/exit the menu, I don't know how to fix that other than not using a different layout for the menu. But at least it should return to the "currentLevel" layout now.

    Btw, it's a bit difficult to navigate through your project, you should get used to adding comments (Press Q or RClick) and maybe use some groups.

  • Thanks, you fixed the problems, but you did indeed break a couple of things. When pressing pause, the current caption now continues its timescale and thus fades out. Also, when returning to the current layout, the black bar at the top is no longer at the top of the layer.

    I'll try to fix these, then let you know. Otherwise, thanks a bunch!

  • fyi, I think the fade out problem might be because you got rid of my family behaviors. I'll try putting those back in.

  • Hmm, I didn't touch any of the family behaviours, only removed the object timescale events. I'm not quite sure what's supposed to happen in your game, so it's a bit difficult to know if I broke something. <img src="smileys/smiley17.gif" border="0" align="middle" />

    Anyway, if you encounter any problems after you've cleaned up my mess, I'll be happy to have another look.

  • ok first of all please you really need to learn basic 0.0 also if this is starter of a game ill not play it because its too long and ill get bored and close it really...

    ok now lets talk about some stuffs you have really mess it!

    if you are using the text as a picture why you need a text object just use an image like and put the text inside of it and use sprite object...

    also if you are using sprite object there is something called animation!

    this animation can hold alot of frames (of course he can hold all you text+sprites) so put all your stuffs on 1 object and put the speed of animation to 0 and after than you can use frame in the sprite properties change frame 1,2,3....etc.

    ok now to the pause problem i would say you MUST put a gruops for pause and unpause:

    so you have a button if i clicked it will active that pause gruop and if you clicked resume it will inactive pause gruop and active the unpause gruop and so on..

    PAUSE GRUOP MUST HAVE TIME SCALE = 0 OR SLOWER THAN GAME!!!

    some people put some buttons on the screen while the game on pause like mute,options,exit...

    LAST THING AND THE MOST IMPORTANT YOU MUST NAME ALL OF YOUR WORK WITH GOOD NAMES THAT "WE" CAN EASILY USE IT LATER.

  • can anyone translate that?

    seriously, you obviously didn't read my first post where it links to the post saying what my project actually is...it's an interactive graphic novel. If that doesn't appeal to you, then you don't have to read it.

  • alright, I tried making the events in layout a group, then set it to deactivate when menu is set to 1. that didn't work, so i tried to deactivate it when the pause button is clicked...that didn't work. everytime, the captions still fade out. also, in layout two, there is a part where a new panel fades in over the layout. if you hit pause, the panel still fades out. it is supposed to pause too, dammit! oh, this is so frustrating.

    here's the capx again, the only thing I added are aesthetic things that control the buttons continuing to move after timescale is set to 0.

    I've added comments to help explain what is supposed to happen, and what happens instead

    http://philipcomposer.com/comic/unnamed.capx

    thanks

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