Jump to content

Tile Callback - Not Triggering


Epixors
 Share

Recommended Posts

Hi there,

 

I've been messing around with Phaser for a few days now and everything has been coming along nicely. I have a problem where I want various things to happen when the player touches specific tiles, so I came to the conclusion that I had to use setTileIndexCallback. All seemed fine and I went along and wrote the code, however nothing is triggering. I tried to structure it like the example on the Phaser site but alas, no luck. Can any of you help me out here?

 

This is the file generating the current game stage:

 

http://pastebin.com/52kZ3Etg

 

This is the "Hunter" file for the player:

 

http://pastebin.com/MJmDtBjF

 

and this is the tilemap JSON file (made with Tiled):

 

http://pastebin.com/ZhbCcxGJ

 

Note that the array of tiles I'm trying to call for are split over both layers. I've made sure to touch all of them but nothing occured.

 

Can anyone help me?  :unsure:

 

Also here is an image of my map: http://i.imgur.com/jq4JflE.png

Link to comment
Share on other sites

 

for me when i used them i did this:

var tileFunc1 = {    theTileFunctionName: function () {        // Do cool stuff here    }}// thenmap.setTileIndexCallback([TILE ID HERE], tileFunc1.theTileFunctionName, this);

 

Sorry for the late reply, didn't manage to get on a lot, however I tried this and it did not solve it. The function scope should be correct it's just never being fired, maybe I am referring to the wrong layer or in a wrong context?

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...