Pause Problem

iWiniWin Member Posts: 334
edited November -1 in Working with GS (Mac)
im trying to make a pause button and i have enemies that come in waves. when i hit the pause buttons the enemies stops on the screen but when i hit the resume button the enemies do not start off where they paused on the screen, it was actually still moving but u just arent able to see it on the screen. does anyone have any suggestions on how to fix this problem.

thanks

Comments

  • synthesissynthesis Member Posts: 1,693
    The pause behavior isn't that smart.

    You would have to program a pause feature on your own and track all of the assets in your game and their individual velocity, direction, etc....which is very cumbersome and difficult and resource intensive.

    I recommend that you do not have a pause button. The pause feature only makes sense on games that do not have ongoing action...such as puzzle games.

    Good luck!
  • jonmulcahyjonmulcahy Member, Sous Chef Posts: 10,408
    pausing can be pretty easy. create an attribute called Pause.

    In every actor create one master rule and put everything in it. Make the rule say:
    When game.Pause = 0

    then on your pause button, make it switch game.Pause back and forth between 0 and 1 by changeing the attribute

    change attribute game.Pause to (game.Pause+1)%2
  • synthesissynthesis Member Posts: 1,693
    I don't think that will work with moving actors. It will not freeze their physics/motion traits to my knowledge.
  • jonmulcahyjonmulcahy Member, Sous Chef Posts: 10,408
    it does for basic movements, I use it in my games. it works better with 'move' attributes, if you use accelerate, sometimes it's a little wonky.

    Check out F is for Falling or Z is for Zombie in the webgames to see how it works,
  • iWiniWin Member Posts: 334
    Yeah, i dont have a simple move attribute. It moves in a wavy motion so you cant just use move, i have to use change attributes..
  • CodeMonkeyCodeMonkey Head Chef, Member, PRO Posts: 1,803
    Just created this pause example this morning.

    http://gamesalad.com/game/play/46641
  • SingleSparqSingleSparq Member Posts: 1,339
    I found for pausing a moving actor using the "otherwise" of the pause rule and place the same move attribute but set to 0 works.

    Pausing an actor on a timer is where I'm having issues. The actor will pause but the timer keeps going so is out of sync when I un-pause. Anyone know an angle for that?
  • quantumsheepquantumsheep Member Posts: 8,188
    @Macview

    There is a way round that, but it's convoluted and involves lovely equations and new variables and stuff.

    A far cry from the 'preserve scene' of old...

    But I digest...

    I'll try and have a look at it over the weekend when I get a mo', and try and work out what CodeMonkey did on my game.

    It'll help, but as Synthesis has said, it's a cumbersome, and in my opinion, horrible work-around. It kinda stifles your creativity when you're having to worry about how your actors are gonna work if you pause the game, as opposed to 'what crazy stuff can I do with them'.

    Hold tight fella.

    QS

    Dr. Sam Beckett never returned home...
    Twitter: https://twitter.com/Quantum_Sheep
    Web: https://quantumsheep.itch.io

  • quantumsheepquantumsheep Member Posts: 8,188
    I'm sorry to say, I just had a look at it again as promised and I went a little cross-eyed. On just one actor too :(

    Sorry mate.

    What I'll try and do on the weekend is strip everything else out (very protective of this game!) and maybe upload the important bits to GS as an example.

    Seriously though, it will absolutely crush you :(

    QS

    Dr. Sam Beckett never returned home...
    Twitter: https://twitter.com/Quantum_Sheep
    Web: https://quantumsheep.itch.io

  • SingleSparqSingleSparq Member Posts: 1,339
    Thanks quantum, I tried using the code monkey example - crashed my iphone GS viewer, Crashed my game - opened up to a lovely blank project. Lost about an hours worth of work (thank goodness for back ups though). How exactly such a crash deletes all your scenes is a bit of a mystery (I opened the project file and the scene folder was empty).

    As were expecting an update (Cough iPad Cough) soon, maybe a nice improvement with a pause function will be there too.

    Which method of pausing do you use generally? Going to a new scene or Actor Pause screen above the scene? (I was doing the latter)
  • quantumsheepquantumsheep Member Posts: 8,188
    Oh boy, that doesn't sound good! Glad you had back-ups!

    I was using the following method:

    Make a pause scene
    Make a 'return' button that returns you to whichever scene you came from

    In-game:

    If pause button is pressed
    Go to Pause scene - preserve scene checkbox checked.

    And that was it - took five minutes and worked like a charm till .8 came out.

    Now everything's a complicated mess :(

    I highly doubt that there'll be an improvement on this issue in the next update, which is why I asked for one to be implemented ASAP after the next update hits.

    It's such a standard feature for a game (we were asking for it loads last year before the method I mentioned was implemented) that I can't really do anything without it being present I feel.

    And yes, there's a workaround which I'll try and upload on the weekend. It made me cry. You might have better luck with it!

    Cheers,

    QS :(

    Dr. Sam Beckett never returned home...
    Twitter: https://twitter.com/Quantum_Sheep
    Web: https://quantumsheep.itch.io

  • quantumsheepquantumsheep Member Posts: 8,188
    Mate, I'm glad you *didn't* use this feature. If my business relied on it, I'd be a bit more than just passionate!

    Imagine not daring to update your old games, that desperately need updating, because the pause function would no longer work!

    Imagine if the wonderfully simple save system was changed overnight and required you to create new variables for every single actor, every spawn point, everything, then ask you to work out some equations and then compare them all against eachother to come up with one variable to be saved. That's what it feels like!

    On top of that, I can only imagine that adding more rules and checks on every actor can only reduce performance...

    I love the GS guys so much for this software, I really do, and I do appreciate the help that's been sent my way. But sometimes they go against the grain, and it bloody hurts!

    For example - GS had a built in d-pad. People liked it and requested that you could customise this feature and add more buttons, different graphics etc etc.

    Instead, they removed it completely.

    Not a huge deal with a d-pad as the logic was simple to understand and implement.

    This though... this really smarts.

    I use timers so much, for better or worse, with some random stuff thrown in on most of my games. If I want to make sub-standard simple games then fine. But I don't.

    I'm a bit gutted too as the game should have been finished and I've already seen similar themed stuff on the app store. So I'm losing out here. People will think I've jumped on the bandwagon, when really I was putting one of the wheels on the damn thing! ;)

    Anyway, they know about it, and how I feel about it. You can all see it on the weekend when I upload it, and make your own minds up.

    I won't accept that this is how it has to be though, and if the GS guys are honest with themselves, neither will they. It's really just not good enough!

    Don't create another Synthesis! ;)

    Anyway, rant over!

    QS :)

    Dr. Sam Beckett never returned home...
    Twitter: https://twitter.com/Quantum_Sheep
    Web: https://quantumsheep.itch.io

  • beefy_clyrobeefy_clyro Member Posts: 5,394
    I second the motion of the sheep. I've completely avoided the pause option on the game im creating because it simply was just too confusing. i looked at the pause demo above and it confused the hell out of me, surely they can build in a predefined rule which just stops everything! The workarounds are not too bad if you dont use timers and stuff, its just too much of a workaround and coding on every moving actor etc. GS please address this feature, it'd make our lives so much easier.
  • quantumsheepquantumsheep Member Posts: 8,188
    I figured this would get buried under the deluge of iPad related posts...

    Anyway, the workaround for pause with timers can be found here:

    http://gamesalad.com/game/play/48909

    bear in mind that this just involves two actors being spawned from one spawner.

    Look at how many variables you need to keep track of! It's bloody horrible :(

    Anyway, if anyone can explain how it works, I'd appreciate it.

    Still... now we've had the iPad build out, please bring back preserve scene, eh guys?

    Cheers,

    QS

    Dr. Sam Beckett never returned home...
    Twitter: https://twitter.com/Quantum_Sheep
    Web: https://quantumsheep.itch.io

  • quantumsheepquantumsheep Member Posts: 8,188
    Ok, it's been 18 hours and this is now on Page 3 - bumping it as I have no idea if Macview got to see it when I first uploaded it, and I did *promise*.

    Cheers,

    QS.

    Dr. Sam Beckett never returned home...
    Twitter: https://twitter.com/Quantum_Sheep
    Web: https://quantumsheep.itch.io

  • SingleSparqSingleSparq Member Posts: 1,339
    I see it and will check it out - It may not be worth effort but It's always good knowledge to know. - thanks for keeping your promise!
  • quantumsheepquantumsheep Member Posts: 8,188
    Please do let me know what you think.

    I was describing the situation to a colleague and he was just aghast. I mean, it's not like we're asking for xbox/PS3 visuals on an iPhone.. it's a simple pause function ffs...

    Like I said, your thoughts would be welcome.

    QS:)

    Dr. Sam Beckett never returned home...
    Twitter: https://twitter.com/Quantum_Sheep
    Web: https://quantumsheep.itch.io

  • SingleSparqSingleSparq Member Posts: 1,339
    Yes - as I see it, it isn't worth putting in this far into development in my game, as it's way too much work for something that should be part of the system. I will keep what I've implemented so far and if a pause feature does come along update my game appropriately.

    Now that the iPad feature is out of the way, I'm sure GS will start concentrating on some of the more requested, if not expected features (please!). Here's looking at 8.5.
  • quantumsheepquantumsheep Member Posts: 8,188
    Cool!

    That's two of us against the world!

    (they don't stand a chance!)

    QS :)

    Dr. Sam Beckett never returned home...
    Twitter: https://twitter.com/Quantum_Sheep
    Web: https://quantumsheep.itch.io

  • quantumsheepquantumsheep Member Posts: 8,188
    May I humbly request that someone at GS writes up a simple set of instruction for the wiki with regard to pausing with timers.

    I just don't understand the workaround. It's way too complex, sorry!

    Currently all we have is Jgary's solution from months ago, here, which for simple games is fine:

    http://gamesalad.com/wiki/how_tos:gsc_game_pause_tutorial?s[]=pause

    I think people have lost sight of the fact that these are games designed to be played on a mobile device - an absence of a pause feature, and a solution provided with no information, does not help us integrate such a feature in lieu of it being in GS as standard (As it once was).

    I'm starting to get frustrated again as I want to move forward with confidence. I've heard nothing back from GS at all on this.

    Could someone:
    Please tell us when 'Preserve Scene', or another simple 'Pause' system will be implemented.

    If you insist on not implementing it, can we hear your justifications? Pausing is a standard feature - it should not be a major headache for people to put into their games.

    If the new system without pausing is to give us extra fps, how does adding dozens and dozens of checks into our actors affect the fps? Do we essentially get little or no benefit if we put 'pause' in?

    I honestly and truly believe this is a priority feature. Come on - where's the love, eh?

    QS :)

    Dr. Sam Beckett never returned home...
    Twitter: https://twitter.com/Quantum_Sheep
    Web: https://quantumsheep.itch.io

  • JGary321JGary321 Member Posts: 1,246
    I pause with timers actually so here it goes:

    You need an ACTOR INTEGER attribute

    self.time left

    When game.paused = false
    every 1 sec change attribute self.time left to self.time left - 1

    When self.time left = 0
    (perform whatever action)
    change self.time left to (whatever time it's supposed to be)

    Little more work, but makes it play nice with pause.
  • quantumsheepquantumsheep Member Posts: 8,188
    A 'little' more work???

    Mate, you'll be glad to know I'm making progress on a game.

    I'm leaving out pause for now as I still don't get it.

    Maybe you wouldn't mind taking a look and putting in pause for all my actors/spawners when I'm done.

    It's only a little more work, after all ;)

    QS

    Dr. Sam Beckett never returned home...
    Twitter: https://twitter.com/Quantum_Sheep
    Web: https://quantumsheep.itch.io

  • quantumsheepquantumsheep Member Posts: 8,188
    I think Apple has come to the rescue with this one with multi-tasking in os4.

    I've just watched the conference video and, essentially, double tapping the home button will pause whatever you're playing, I believe, to bring up the multi-task screen...

    If this is indeed the case, then we're all saved (if our games run only on a 3GS and up I guess).

    Seriously though. Let's get this into GS for all those 3G iphones and 1st/2nd gen ipod touches, eh?

    Cheers,

    QS

    Dr. Sam Beckett never returned home...
    Twitter: https://twitter.com/Quantum_Sheep
    Web: https://quantumsheep.itch.io

  • beefy_clyrobeefy_clyro Member Posts: 5,394
    It would be great if we could have a simple behaviour which controls everything for pause. If touch is pressed - pause game. Seems like it would be a simple behaviour for GS, that work around is faaaaar toooo much!
  • EastboundEastbound Member, BASIC Posts: 1,074
    Sadly, QS, from what I've heard of people using the Beta on their phones (I think T-Shirt said this, but I could be wrong) the GS games they tested do not work with the multi-tasking.

    It may be easy for Gendai to implement a pause now, but as of now it doesn't.
  • quantumsheepquantumsheep Member Posts: 8,188
    eastbound - I wonder why it doesn't work?

    Why does pause work *in* gamesalad when you preview stuff? AND when you view a game in a browser?

    I'm about as far from technically minded as you can get, but as a layman, it baffles me that you can pause games so easily using the methods described above, yet putting it into a game (where, actually, it USED to work) is so hard?

    Sadly I've just been ignored on this issue, and I seem to be a mainly lone voice in airing my concern here.

    Still, stay positive, sheepy! At least I still have something to moan about! :D

    QS

    Dr. Sam Beckett never returned home...
    Twitter: https://twitter.com/Quantum_Sheep
    Web: https://quantumsheep.itch.io

  • EastboundEastbound Member, BASIC Posts: 1,074
    Haha well I think most people would love a pause feature, it just falls lower on the priority list than most items. I'd love to see it implemented, it's been a complaint in some reviews of mine.

    And I believe it doesn't work because the 4.0 OS doesn't simply pause the apps by itself, it requires some lines of code in the app, albeit I've heard it's minimal. So that could mean in a somewhat near future update it could be used with little pain on GS's part, or it could mean nothing at all.

    I should pay more attention in my classes so I can actually understand this stuff better :p
Sign In or Register to comment.