Is it possible to set the z-index of a drawn object in HTML5 canvas?
I am trying to get it so one object can be infront of a the \"player\" and another object is beh
Just draw the things behind it first, then the thing, then the other objects.
To do hit testing you may need to iterate backwards over your display list, testing each object. This will work if you know the object boundaries really well.
Or you may want to try some standard graphics tricks like drawing the same objects to another in-memory canvas with unique colours for every object drawn: to hit test this just check the pixel colour on the in-memory canvas. Neat ;-)