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
Game ProgrammingJavaScript

Avatar of undefined
Last Comment
James Hancock
ASKER CERTIFIED SOLUTION
Avatar of leakim971
leakim971
Flag of Guadeloupe image

Blurred text
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
SOLUTION
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
Avatar of James Hancock
James Hancock
Flag of United States of America image

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
Avatar of leakim971
leakim971
Flag of Guadeloupe image

Blurred text
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
Avatar of James Hancock
James Hancock
Flag of United States of America image

ASKER

Thanks
Building up nicely...Do u use brackets for your javascript dev?
Avatar of leakim971
leakim971
Flag of Guadeloupe image

I don't understand your last question
Avatar of James Hancock
James Hancock
Flag of United States of America image

ASKER

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?
Avatar of James Hancock

ASKER

Thanks
JavaScript
JavaScript

JavaScript is a dynamic, object-based language commonly used for client-side scripting in web browsers. Recently, server side JavaScript frameworks have also emerged. JavaScript runs on nearly every operating system and in almost every mainstream web browser.

127K
Questions
--
Followers
--
Top Experts
Get a personalized solution from industry experts
Ask the experts
Read over 600 more reviews

TRUSTED BY

IBM logoIntel logoMicrosoft logoUbisoft logoSAP logo
Qualcomm logoCitrix Systems logoWorkday logoErnst & Young logo
High performer badgeUsers love us badge
LinkedIn logoFacebook logoX logoInstagram logoTikTok logoYouTube logo