Jump to content

Discuss about Phaser.Plugin development


Rafarel
 Share

Recommended Posts

Hello there!

I'm totally new to your forum and it's my first post, here's a quick introduction about me:

I'm a French developer who makes games in his free time like Claytus Tower Defense and who works on 360° video web technologies at my job (Kolor).

 

I want to take part on Phaser development and Phaser Plugins development and I want to know how to do it well!

I spent the last few days to watch every demo and read the documentation that Phaser provides, it looks to me to be a very good project and a strong knowledgeable team.

 

I haven't found any "How to" or "Good practices guide" about Phaser.Plugin development and submitting.

 

I wanted to start by providing a path finder plugin that works with a Phaser.Tilemap and a JSON file made with the Tiled Software.

I ran through some "How the hell can I achieve this the proper way?" kinda questions :)

Maybe you can confirm that I'm right or wrong doing on some points:

 

Need more data from the JSON parser:

 

In the process I needed to adapt the Phaser.TilemapParser.parseTiledJSON because I wanted to have the tileproperties on the layer object from the TiledJSON file. (made in Tiled software)

These properties are omitted by the original function so I added this line to my override one:

tileProperties: json.tilesets[0].tileproperties

Maybe there's a better way to achieve this, but I didn't find it.

I'd love to pass an additional data {'stringIndex', ... } arguments to game.load.tilemap for example:

game.load.tilemap('desert', 'assets/maps/tilemap.json', null, Phaser.Tilemap.TILED_JSON, {'tileproperties'});

Adding a debug method:

 

I wanted to output the calculated path by drawing a line on the screen, so on my plugin file, I added a function to the Debug prototype:

Phaser.Utils.Debug.prototype.AStar = function(astar, color){    ... Drawing the last calculated path by astar plugin object ...}

Here is a screenshot of my work in progress. (debug draw is the red line)

 

screenshot_0.jpg

 

 

I'll upload a live demo a soon as possible with a fun sandbox to test it :)

 

Many thanks for sharing your work!

 

 

 

Link to comment
Share on other sites

Hello Richard,

 

Thanks for your reply.

 

I checked out the dev branch and I have some rework to do to be compatible with the new way you handles maps.

This looks like very cool. Good job !

 

Do you think the right place to store path finding values (like walk-able tile or not) is in the properties object of the tile ?

For now, I use the properties of the tileset that I copy to each tiles (depending of the tile index) of the layer I use for my path finding.

Link to comment
Share on other sites

  • 2 weeks later...

Hello there !

 

I worked with the Phaser dev branch on my AStar path finding plugin this evening and I have something to share :)

 

I've embedded my demo on the phaser's example page in : plugins > astar

I don't know what are the best practices to load a plugin JavaScript file so I edited the example "view_full" template to add my script.

I didn't find if there's a correct way to submit a plugin so I share in this topic.

 

You can click on the map to find the shortest path between your click and the turtle.

You can also move the turtle with arrow keys.

 

It's pretty cool to work with Phaser, keep up the good work !

Link to comment
Share on other sites

  • 2 weeks later...

Glad to hear it :)

Your dev branch is 1.1.6, my plugin works with the old dev branch Phaser.VERSION at 1.1.4 

There is a 1.2 branch on the github website but the readme is marked as 2.0.0

It doesn't appeared on the git branch command line, do I have to test it with this one?

Link to comment
Share on other sites

  • 3 weeks later...
  • 2 months later...
 Share

  • Recently Browsing   0 members

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