cheshirepuss42 Posted February 18, 2014 Share Posted February 18, 2014 I'm trying to make a game which is basically a grid where the player moves across. When the player moves on certain squares the first panel of a dialog tree will be presented: Some text, an image and some choices. The dialog trees I want to be able to make in JSON.For the choices there is a text and an action to be taken on that choice. I made the choices using Phaser.button, which has callback:Function as a parameter. Things I want to be able to do are fx. modify player health, spawn enemy, modify energy, so all kinds of stuff.I don't really have a clue how to do this in phaser. I understand that i need some reference to the gamedata, but how to run a method like game.player.modifyhealth(-10) from something like this {callback:"game.player.modifyhealth",mod:-10} when i press a certain button? So what do i pass to Phaser.button as callback? Link to comment Share on other sites More sharing options...
cheshirepuss42 Posted February 19, 2014 Author Share Posted February 19, 2014 Does anybody have any idea? I know it might not be Phaser-specific, but it does seem something that a lot of games use. Maybe I'm just barking up the wrong tree, and the way to do this is completely different from how I'm approaching it. But I would love to know this. Link to comment Share on other sites More sharing options...
Recommended Posts