onclick not triggering

Game development with Board Game Arena Studio
Post Reply
User avatar
garcia1968
Posts: 24
Joined: 03 April 2013, 16:03

onclick not triggering

Post by garcia1968 »

I'm modifying the reversi tutorial with my own play pieces, but it seems that once my piece(token) is temporarily placed on the board, I can no longer click on the squares underneath which it covers to register the below type event.

Code: Select all

dojo.query( '.square' ).connect( 'onclick', this, 'onPlayDisc' ); 
 
Should I client-side auto-refresh my click 'detection' squares whenever a game token is temporarily placed on top so they are back on top? Or something else easier I'm missing with how the squares are defined/click-detected?

Thanks
User avatar
Een
Posts: 3861
Joined: 16 June 2010, 19:52

Re: onclick not triggering

Post by Een »

Hi,

Your tokens are set after the squares, so they come above them, intercept the onclick event, and transmit it to their parent (the board div).

If your token was attached to some square instead of the board, when you click on the token it would transmit the onclick event to its parent square. But in your case that's not what you want since your tokens cover multiple squares.

So I think you need to put the tokens before the squares in your .tpl (so they will be _below_ the squares when the page is built), and make your squares transparent. Then your layer for the onclick event will always be on top.

Een
Post Reply

Return to “Developers”