Composer API

Hello,

why should I use the composer API?

Right now Im just calling the funtions from different lua files to change the scene, now Im not sure if I should change everything and use the composer

Thanks!

You should use it if:

  • You want an easy way to implement scene to scene transitions.
  • You want to take advantage of easy memory management (assuming you remember to let the scene manage your objects; many don’t do this when they first use composer :blink: )
  • You want a nice way to organize code and sequences of scene interactions.  i.e. Scene ‘phases’:
    • Create
    • Destroy
    • Show
      • Will
      • Did
    • Hide
      • Will
      • Did
  • More… but can’t remember all of them right now.

You should not use it if:

  • If you don’t need or want the above.
  • You’ve already got your  own scene management system and it works.
  • You’re new and still learning Lua and Corona. (Especially if you’re a new programmer).

 Some will disagree with my last point, but I firmly believe this makes it harder for new and inexperienced users to get started.  

The reason being, using composer is one more thing you have to understand and do correctly to make it all come together.  i.e. More moving parts to keep track of equals more things to go wrong.

I think it is better to keep the first few games/apps simple, then experiment w/ composer and other more advanced features till you’re a coding ninja:  :ph34r:

If you are happy with your existing scene management, then there is little reason to use Composer. If you are starting a new project and you don’t want to do the heavy lifting needed to bring different scenes on and off the screen, then Composer is a great way.

The first Corona app I built, I didn’t know about scene managers and they seemed hard to learn. But that app is nearly impossible to work on.

@Ed, not arguing here about your new developer point. Even though I started my first Corona project with over 25 years of experience (and a good portion in the game making world), learning Lua and the API’s was enough of a task without adding a scene manager. My second app had a scene manager, but I had built up enough experience to understand what’s going on with it.

Rob

You should use it if:

  • You want an easy way to implement scene to scene transitions.
  • You want to take advantage of easy memory management (assuming you remember to let the scene manage your objects; many don’t do this when they first use composer :blink: )
  • You want a nice way to organize code and sequences of scene interactions.  i.e. Scene ‘phases’:
    • Create
    • Destroy
    • Show
      • Will
      • Did
    • Hide
      • Will
      • Did
  • More… but can’t remember all of them right now.

You should not use it if:

  • If you don’t need or want the above.
  • You’ve already got your  own scene management system and it works.
  • You’re new and still learning Lua and Corona. (Especially if you’re a new programmer).

 Some will disagree with my last point, but I firmly believe this makes it harder for new and inexperienced users to get started.  

The reason being, using composer is one more thing you have to understand and do correctly to make it all come together.  i.e. More moving parts to keep track of equals more things to go wrong.

I think it is better to keep the first few games/apps simple, then experiment w/ composer and other more advanced features till you’re a coding ninja:  :ph34r:

If you are happy with your existing scene management, then there is little reason to use Composer. If you are starting a new project and you don’t want to do the heavy lifting needed to bring different scenes on and off the screen, then Composer is a great way.

The first Corona app I built, I didn’t know about scene managers and they seemed hard to learn. But that app is nearly impossible to work on.

@Ed, not arguing here about your new developer point. Even though I started my first Corona project with over 25 years of experience (and a good portion in the game making world), learning Lua and the API’s was enough of a task without adding a scene manager. My second app had a scene manager, but I had built up enough experience to understand what’s going on with it.

Rob