Sawyer Posted October 15, 2015 Share Posted October 15, 2015 I've managed to import a 2D side-scrolling tilemap into Phaser. My question is, whats the most efficient way to go about triggering events at certain points of the level? For example, say I wanted to show a particle near the end of the level. The idea I had in mind, was to put in a transparent object layer into my tilemap and use the overlap detection to trigger this. Would this be the recommended way to go about things? If so, could someone give me a quick walkthrough of doing this? I've created the object layer in Tiled and inserted the tiles into my map. Link to comment Share on other sites More sharing options...
drhayes Posted October 15, 2015 Share Posted October 15, 2015 That's the approach I took. I have a sprite named "InvisibleSwitch" that has a property called "target". When the player collides with the switch it calls the "invoke" method on the "target". All of the switches are in a switchesGroup which runs overlap checks in my state's update method. ansien123 1 Link to comment Share on other sites More sharing options...
DonFrag Posted October 15, 2015 Share Posted October 15, 2015 I'm thinking this:using tiled you can put objects at certain positions with the propertie trigger and bomb by example.then in phaser you load all objects from tilemap. now you have a list with triggers, their position and what kind of sprite or elment you should put. like 'Bomb'. Link to comment Share on other sites More sharing options...
Sawyer Posted October 16, 2015 Author Share Posted October 16, 2015 Thanks for the answers guys, I've went with this method of doing it. Just trying to figure out how to get an overlap detection working with p2 physics Link to comment Share on other sites More sharing options...
DonFrag Posted October 16, 2015 Share Posted October 16, 2015 Try overlap using overlap functión of sprite class.or rectangle Link to comment Share on other sites More sharing options...
Sawyer Posted October 17, 2015 Author Share Posted October 17, 2015 Thanks DonFrag, didn't think it was quite that simple. Still have a few issues to workaround but I've just bought InterPhase so I'll stop with all the newbie questions Link to comment Share on other sites More sharing options...
drhayes Posted October 17, 2015 Share Posted October 17, 2015 Don't worry about the newbie questions; everyone was a newbie once. Link to comment Share on other sites More sharing options...
Recommended Posts