Jump to content

Layered Sprite


Recommended Posts



Sorry for the n00b question. Perhaps my terminology isn't right too.

I want to create a layered sprite of a tank. Layers are

- Hull (image)

- Turret (image)

- Aiming Guide (Vector Graphic)

- Health Bar (Vector Graphic)


How do I do it with Phaser properly?

(If possible just link me to an example or docs on how to do it).


I cannot use separate sprites because when the tank turns the turret needs to turn accordingly.

I am actually porting it from CreateJS so there is an example of what I am doing here:






Link to comment
Share on other sites

Sorry about the long thread.


Why does this:

    create: function () {
      var result = new Phaser.Group(game, null, 'T72', false);
      result.create(0, 0, 'T72_hull');
Draws the tank hull on screen? I didn't even add the group to anywhere?
If I try to add it anyway using this.add.existing(result); there is an error.
Link to comment
Share on other sites

You can use a Sprite, but just add the other components as children of that Sprite, so they can all turn together. Phaser uses Pixi, which basically gives you a Flash style display list. You could also use a Group, but I'd probably go for the nested Sprite approach.

not 100% sure but I don't think sprite children are rendered. Unless it has changed recently, might be better to have a Doc with multiple sprites. I would check on that

Link to comment
Share on other sites

  • 4 months later...

  • Recently Browsing   0 members

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