Link to home
Start Free TrialLog in
Avatar of James Hancock
James HancockFlag for United States of America

asked on

How should I register clicks/touches for multiple images in the same location?

Hi
I'd like my Javascript phone game to be able to click or touch rectangular objects. The objects will display various different images.

I think it might not be best to register each separate image for interaction, but maybe location coordinates?
Could I make a carrier object where I just change the image displayed in the carrier object? and just register that carrier object for clicks or touch.


I'd display n images / carriers even spaced across the phone/tablet/comp screen for interactions.
I think I saw I a way to enableInteractions on an Object

Id add( up to 100 images) for the gameplay's needs.


Suggestions welcome

Thanks
ASKER CERTIFIED SOLUTION
Avatar of leakim971
leakim971
Flag of Guadeloupe image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of James Hancock

ASKER

It might be least complicated if I bundle up the images in TexturePacker into a JSON spriteSheet.
When I extract the sprites from the JSON file that contains them, are those image sprites the objects as are needed, or are they incorrect?
A JSON file should store them and extract them as they were.

Then I can add events to them as you outlined?

Thanks
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Thanks
Building up nicely...Do u use brackets for your javascript dev?
I don't understand your last question
I don’t like brackets for JavaScript as much as I do Eclipse for java or visual studio for C.
Which IDE do U prefer for JavaScript?

Thanks
Should I reassess the situation?
Thanks