Code Monkey home page Code Monkey logo

Comments (5)

alamboley avatar alamboley commented on May 23, 2024

Normally when the game is set up in pause, all animated game objects are stopped via a Signal dispatched and then resume when the game continue.

Deactivate event should never be used for a in game action. It's only used for when you leave the application/ or change the tab in your browser.

Also Starling isn't rendered in the update loop, I mean Starling doesn't need to have an action made/call in the enter frame (from the Citrus Engine side).

If you make a menu with Starling, you will use mostly Starling objects, not Citrus Sprite. It will be quicker to add event listener, create sprites with images inside, buttons etc. So actually I don't see a real problem if the State loop isn't made anymore.

from citrus-engine.

gsynuh avatar gsynuh commented on May 23, 2024

"Normally when the game is set up in pause, all animated game objects are stopped via a Signal dispatched and then resume when the game continue."

I understand, but CitrusEngine actually stops Starling altogether. so everything running with the starling juggler stops.
if your ui is using jugglers to animate etc, then the ui is stopped as well when you use _ce.playing = false.
the updates are stopped as well... so if you want your ui to move in that case, you have to add a new enter frame event listener , and that's too bad.

"Deactivate event should never be used for a in game action. It's only used for when you leave the application/ or change the tab in your browser."

I'm sorry here I didn't meant to use those event for in game things, I was just talking about how CE listens to activate/deactivate to play/pause a game by default.

"If you make a menu with Starling, you will use mostly Starling objects, not Citrus Sprite. It will be quicker to add event listener, create sprites with images inside, buttons etc. So actually I don't see a real problem if the State loop isn't made anymore."

You are correct here. but by default, doing _ce.playing = false; stops the starling instance as well, therefore if you are going to use IAnimatable sprites in your starling menu, these won't play at all because the starling instance is stopped.

What I suggested here was to run a custom juggler with CE, a juggler that we can pause/play, instead of stopping all of starling ... maybe there's a good reason to stop all starling which I'd understand.

So _ce.playing = false;
would stop the "CE main juggler" (not starling)... all AnimationSequences would stop... but if you had another custom juggler running for your menus for example, then it would still be running as starling would not be stopped.

Here's maybe the only important point I was trying to make:

deactivating/activating should stop/start starling, you are right about that, as most often this means we are not looking at the game anyway and it would run for no good reason.

but _ce.playing = false; should only "pause the game" and not stop starling.
that way we can have an easy way of pausing a game.
and also if we want to keep animating stuff when a game is paused, then we can use a custom juggler (so starling needs to keep running) or start a new enter frame event listener if we need to update other stuff I guess

from citrus-engine.

gsynuh avatar gsynuh commented on May 23, 2024

Don't worry about this issue though, to me its far less important than any other
I just wanted to write this down somewhere and share it, I didn't expect a reply that soon but thanks for it anyway.

there are more important issues. important doesn't mean urgent either

from citrus-engine.

alamboley avatar alamboley commented on May 23, 2024

Where Starling is stopped when playing = false; ? I can't find it.

from citrus-engine.

gsynuh avatar gsynuh commented on May 23, 2024

I think we've got that covered now.

from citrus-engine.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.