Jump to content

Sprite Maps


ecv
 Share

Recommended Posts

So, I've been developing a Sprite Map implementation for Phaser for the last two weeks or so...

TL;DR

Can you help me improve the design of the whole concept? I feel there should be easier ways than making a new spriteDef class as I'm doing. Or if there's something similar already in Phaser, point me to it so that I can stop wasting time in this. Thanks

I thought I'd release this under MIT after my first game was released but, man, it's taking forever, and I also doubt the validity of my current approach. So I thought I'd just post it and get some feedback.

Currently you can add a sprite map to your game, add sprite definitions, add sprite layers and populate them with the aforementioned definitions. You can only use textures from the cache, and only Images, RenderTextures and Bitmaps. You can add some animations and have them play, and save (to JSON string) and load (from JSON string) your sprite maps, and have your animations play upon loading. At the very least I'd like to add physics support too. But as I said, I'm unsure my approach is the best one.

Given my limited experience with JS, you'll probably find a number of syntax wrongs. And anyways there's a lot of room for improvement both syntactically and programmatically-wise. For example: sometimes indices are doubled both as array indices and as members of the indexed objects; I feel quite lost without block-scope variables; documentation isn't clean... Sprite Definitions aren't probably the best approach, but I honestly have no idea how to parse complex Phaser objects such as Sprites, cause I get circular references, I don't know how to strip off methods... etc.

Anyways, I hope you can make some sense from it and use it, if only for decorative purposes, and well, @rich, I'd be more than glad if you considered adding and building upon this in upcoming Phaser/Lazer releases. I have nonetheless not tested its performance, as I still don't know how to do this.

Oh, BTW I'd like to thank @drhayes for helping me get started: http://www.html5gamedevs.com/topic/23060-extending-phaser-and-tile-map-question/

Cheers,

Eneko

 

P.S.: Will I ever finish something? At this rate my first html5 game is going to take a year before release. :(:( SMH

 

SpriteMap.js

Edited by ecv
TL;DR
Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

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