I'm making a 2D isometric map with HTML5 canvas and the library canvasengine.
So, i have a tile :
This image is a square.
I draw this image on my canva with several options :
_tile.drawImage(tileset.name, x, y, this.tile_w, this.tile_h, posx, posy, this.tile_w, this.tile_h);
After that, i need to add an event onclick
on this _tile
but ONLY on the part in green :
_tile.on("click", function(e) {
this.opacity = this.opacity < 1 ? 1 : 0.5 ;
});
With this function, i can click on all my picture, white part or not. I had to stack the tiles to generate the map, so when I click on the edge of an image, it selects the next tiles...
I need to do something like, after _tile.drawImage()
:
_tile_diamond.onclick
Any ideas ? Thanks !