wade.iso: Isometric global event documentation?
schen7913

Hi,

So I noticed that in the isometric games video tutorial, wade.app.onIsoTerrainMouseDown is used. It's useful, since I don't have to set any of those event listeners myself for each isometric tile.

But is there documentation anywhere on those convenience callbacks? For example, as far as I can tell, there isn't an analagous wade.app.onIsoTerrainClick function, although I did find a wade.app.onIsoTerrainMouseMove function.

Also, how are these app-wide iso events implemented? I'm asking because I have a HUD in my game. When you click on the HUD and the isometric map is underneath it, the wade.app.onIsoTerrainMouseDown event fires as well. I want to block this from happening, so I was wondering if I could take my HUD background and set it to listen for onClick, onMouseMove, etc. and in response, do nothing but "return true" to prevent event propagation to the map. I'll try it later today or tomorrow, but that will only work if wade.app.onIsoTerrainMouseDown really relies on onMouseDown internally.

All 2 Comments
Gio

Hi

Yes that's how it works, the iso terrain events are actual mouse events that the iso terrain object catches and, for convenience, adds a couple of extra parameters to the event data (namely worldCoords and gridCoords) before calling those functions on the wade.app object.

The same rules that apply for normal mouse events apply here too, so what you said is correct - if there is something in front of the terrain that catches the mouse event (for example onMouseDown) and returns true, then the corresponding terrain event (onIsoTerrainMouseDown) doesn't fire.

I've made a note about adding some information about these functions to the docs (though I'm not sure where to put it yet).

There is also wade.app.onIsoTerrainMouseUp and wade.app.onIsoTerrainClick should be working too (though you may want to change the click tolerance depending on how you want to use it).

schen7913

So, wade.app.onIsoTerrainClick isn't working as expected for me.

wade.app.onIsoTerrainMouseDown = (event) => { console.log(event); };

will log when I mouse-down on iso terrain, but

wade.app.onIsoTerrainClick = (event) => { console.log(event); };

will not.

Post a reply
Add Attachment
Submit Reply
Login to Reply