gamify Posted March 22, 2017 Share Posted March 22, 2017 hello how to retrieve the layer object me.game.currentLevel.getLayerByName("background"); throwing error : Uncaught TypeError: Cannot read property 'getLayerByName' of undefined at <anonymous>:1:21 So can anyone help me to get the layer me.game.getEntityByName("mainPlayer")[0]; also throwing error : Uncaught TypeError: me.game.getEntityByName is not a function at <anonymous>:1:9 for melonJS Game Engine v4.1.0 Quote Link to comment Share on other sites More sharing options...
gamify Posted March 22, 2017 Author Share Posted March 22, 2017 me.game.world.getChildByName("background")[0] is working but how to get the but how to get tile.row and tile.col of the above layer i want particular layer tile row and col but not full game layer???? please can anyone help Quote Link to comment Share on other sites More sharing options...
obiot Posted March 23, 2017 Share Posted March 23, 2017 once you get a reference to the layer you want, you can get the tile information by using the getTile function : http://melonjs.github.io/melonJS/docs/me.TMXLayer.html#getTile here is an example here, where we use this to highlight the tile under the mouse pointer : https://github.com/melonjs/melonJS/blob/master/examples/isometric_rpg/js/screens/play.js#L46 Quote Link to comment Share on other sites More sharing options...
gamify Posted March 24, 2017 Author Share Posted March 24, 2017 okay thank you i will try Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.