How do I pause time on specific objects?

Get help using Construct 2

Post » Fri Jan 06, 2017 6:18 am

Hi there,

So while I know that the overall game has a time speed which can be frozen effectively making the game totally lock up, I have a situation where i'm working on a pause mode for a game, but I have things that must still continue to animate..

Overall I have a pretty good grasp on some workaround solutions for some things, but one thing i have is a fade in / out effect which isn't (as far as I can tell) something I can pause. I can easily stop the rotate speed of an object, but that rotating object while freezing the spin in the pause mode, continues to play through the fade in/out parameters as defined in the behavior..

I've been working on a "roll your own" fade effect but this is getting hairy / unmanageable / unsuccessful with the fact that there are multiple of these objects on screen.. which i'm now experimenting with making a family but still struggling and is starting to feel like I'm over engineering a fix and becoming a bit of a time sink.. which takes me back to my question:

can one object or family of objects be frozen in time while other things are not? If I didn't have to pause the game my fade in / out effect would be perfect.. but the fade behavior doesn't have any parameters that i could see that specifically dealt with "pause"

Any advise / tips would be welcome. It's probably a simple "no you can't do that" but I'd love to be told something different! :)

Thanks,
Caleb
B
59
S
9
G
1
Posts: 939
Reputation: 6,545

Post » Sat Jan 07, 2017 1:03 pm

One thing I tend to do with a larger project is the majority of game logic ends up in one sub-group, which can be switched on and off at a whim. I usually have to write a Function to switch it on and off which also handles things like timescale management and enabling/disabling certain animations or behaviours. Maybe this solution might work for you?

It's worth bearing in mind that "every X seconds" events will still work when the timescale is 0 - so you can always add a 'fake tick' that only runs when paused by using a very low number there. Not sure how advisable this is with regards to frame-rate consistency or independence.

[tld;dr: Don't know about subjective time but have workarounds for the same problem.
The LEVEL GENERATOR TOOLKIT



24 functions dedicated to producing randomly generated terrain for all kinds of games.
B
25
S
7
Posts: 242
Reputation: 2,306

Post » Sat Jan 07, 2017 1:11 pm

Yea actually that does sounds like a good approach. I'm a fan of workarounds.. lol because they tend to get me moving forward faster than the answer I think I want. :)

Also I didn't know about the every x seconds still working with time zero.. that definitely could be manipulated to be helpful. I might rethink that because the biggest bitch has been objects freezing with physics. you have an item falling and then freeze it (using immovable parameter) and then unpausing kills it's velocity so it starts from zero again which is "ok" but we all know that wouldn't be how it should behave.

Functions sound cool but I can't seem to comprehend them. Any time I try to make one I seem to not do it right and it doesn't work. I'll have to find a good function tutorial out there to once and for all teach me how to use them correctly. I've never made a game that uses them.

Thanks!
Caleb
B
59
S
9
G
1
Posts: 939
Reputation: 6,545

Post » Sat Jan 07, 2017 1:18 pm

Functions are incredibly powerful. Not using them is like cooking with blunt knives - you'll probably get the job done, but you'll make a mess and frustrate yourself in the process. Take an afternoon one day to get your head around them.

I have a capx I keep that's just full of Functions that replace common expressions that C2 is lacking - they're easy to move from one project to another (each project only needs the 'Function' object in it), and they usually serve to dramatically tidy up your event sheets.

Essentially, any event you find you're having to write again and again in a slightly different format - or any odd calculation you find yourself frequently having to do that there's no shorthand for - thats where Functions come in. Anyway, good luck :)
The LEVEL GENERATOR TOOLKIT



24 functions dedicated to producing randomly generated terrain for all kinds of games.
B
25
S
7
Posts: 242
Reputation: 2,306

Post » Sat Jan 07, 2017 1:37 pm

Awesome thanks for the function plug. i'll explore it for sure. i do think it's time and i do tend to get games that get unwieldy after awhile.. this pause stuff is a great example.. getting it to work wasn't terrible but it's the 10% that becomes a pain in the ass to manage..

overall the pause isn't that big of a deal.. http://part12studios.com/temp/Games/Fin ... gerKing06/

but yea i think for now i'm going to strip pause out of the game for the sake of time / gameplay and just make it a game where you don't get to pause (btw to pause you touch the green button then move back to the green button).
B
59
S
9
G
1
Posts: 939
Reputation: 6,545


Return to How do I....?

Who is online

Users browsing this forum: zenox98 and 9 guests