multiple objects on one screen

Hi All,

 

I’m developing something like piano where there are several different objects in one screen and it should play it relative sound when some one touches the object.

 

My Question is:

 

Can I put Single screen with  all object embedded init (No layers only image) and have different touch events according to the co ordinates ?

or

Do I need to add all objects with touch events on a background screen?

 

This architecture should work for any screen size(different devices)

 

Sudheer

Hi Sudheer,

Either approach would be possible, but the first one is probably easier and more appropriate.  When you touch a display object that has a touch listener, one of the things that gets reported to the listener is the coordinates of the touch.  That’s what you’d use to determine which note to play.

  • Andrew

Andrew,

Thanks for the inpupt, but how to determine the co ordinates for different screen sizes, and what should be the generic image size which fits for tablets and phones?

Sudheer

I’d suggest you read about dynamic content scaling and configuring your project for different screen sizes: http://docs.coronalabs.com/guide/basics/configSettings/index.html and http://www.coronalabs.com/blog/2012/12/04/the-ultimate-config-lua-file/ are good starting points.

  • Andrew

Thanks Andrew

Hi Sudheer,

Either approach would be possible, but the first one is probably easier and more appropriate.  When you touch a display object that has a touch listener, one of the things that gets reported to the listener is the coordinates of the touch.  That’s what you’d use to determine which note to play.

  • Andrew

Andrew,

Thanks for the inpupt, but how to determine the co ordinates for different screen sizes, and what should be the generic image size which fits for tablets and phones?

Sudheer

I’d suggest you read about dynamic content scaling and configuring your project for different screen sizes: http://docs.coronalabs.com/guide/basics/configSettings/index.html and http://www.coronalabs.com/blog/2012/12/04/the-ultimate-config-lua-file/ are good starting points.

  • Andrew

Thanks Andrew