1 decade ago by tunglxx226
I know that both of the questions are asked before but I still can't figure out how to do it, so I've got to post here. Sorry guys :-s
1. Clicked overlapping entities:
So, we know that by default the mouse click will take effect on every entity locates at the place. I found a code snippet here:
http://www.pointofimpactjs.com/snippets/view/25/determine-which-entity-activate-after-a-click-when-several-entities-are-overlapping
However, the code is incomplete, and I fail to fix it. Anyone has any idea how to fix it? Or you have another way to achieve the same task?
2. zIndex:
So I want to use zIndex to sort the entities in my game. I set them to zIndex 1,2,3,4, but nothing change. I tried calling ig.game.sortEntities() in the draw function() of main but still no hope.
Looking forward to your answer soon.
1. Clicked overlapping entities:
So, we know that by default the mouse click will take effect on every entity locates at the place. I found a code snippet here:
http://www.pointofimpactjs.com/snippets/view/25/determine-which-entity-activate-after-a-click-when-several-entities-are-overlapping
However, the code is incomplete, and I fail to fix it. Anyone has any idea how to fix it? Or you have another way to achieve the same task?
2. zIndex:
So I want to use zIndex to sort the entities in my game. I set them to zIndex 1,2,3,4, but nothing change. I tried calling ig.game.sortEntities() in the draw function() of main but still no hope.
Looking forward to your answer soon.