Web/Mobile Development (Image Manipulation)

coolcrook

Adept
I am learning to develop mobile applications, quite in the initial phase.

This query is not related to mobile but more to html/css/js.

I intend to make a simple game, where a picture is seen, a few options are available and the user can drag and drop these options onto the image.

eg. There is an image of a plant > options are #leaf #stem #flower #bud

The user must drag and drop the correct option to the correct place on the image to get points. i.e Drag the #leaf option onto the leaf of the plant.

Now my problem is the image, the separation of these points, I can't figure out how to do it.

Query in short: How do I access separate points/sections on a single image in html/js for above purpose?

Query (longer version)

I did a little search and realised I can slice the image and recreate it using multiple images, I tried this, it sort of works but it has a a lot of drawbacks:

1)More images mean more space, combined size of the split images was about 1.5x the original image(this is just splitting it into 4 images)

2)For a complex picture, the number of images to slice into is large and hard to manage in css(n00b==me) as they don't just need to be split into a simple X*Y grid but a much more complex split depending on the object in the image.(realised when I was trying to do a simple cell structure img)

3)More images also means more http requests(in case the app is WebView based) which will increase loading time.

It just seemed liked too much of a hassle, there must be a better way.

>>Then I saw css sprites , I dont need to combine my images like sprites are intended for, rather the reverse. Just access parts of my pre-existing image, as separate objects.I haven't tried this(working on it) and and I haven't seen this being done either, or maybe its being done and I'm not seeing.

Please help guys, my problem is quite simple(I think) , I think I'm just not getting the correct google search terms.

If anybody has any ideas,links, resources and also any clarifications as I may not have put up my problem as clearly as I'd like to, please do reply.

regards

~~CoolCRooK~~

Update: I just read about something called hotspots, seems like my solution
<
 
Image Maps is an option If you can work with it. Other thing is Jquery UI has a draggable and droppable extension which you can use very easily.

Yes Image maps(using hotspots) seems likely to be my solution.

Do you have some links for the jQuery draggable and droppable extension that you speak of,

if it does only drag and drop then I think the drag and drop feature of HTML5 does it pretty efficiently without additional javascript code.
 
Back
Top