Jump to content
This forum will be closing down. Please move to the respective dedicated project forums.

image + test in "container"


Rafus
 Share

Recommended Posts

There are a couple of ways, but probably best would be to use the approach I use in the Tanks demo game. It's in the dev branch on github, but basically creates a "Tank" object which consists of a few different sprites - which in your case would be a card image and the text. But anyway if you checkout the dev branch and look in examples/games/tank.js you'll see how I do it.

Link to comment
Share on other sites

Thanks for the info.

This is the way you did it:

Creating tank:

var tank;	tank = game.add.sprite(0, 0, 'tank', 'tank1');tank.anchor.setTo(0.5, 0.5);tank.animations.add('move', ['tank1', 'tank2', 'tank3', 'tank4', 'tank5', 'tank6'], 20, true);

now adding turret on top

turret = game.add.sprite(0, 0, 'tank', 'turret');

My code is something like;

this.bunny =  this.game.add.sprite(0,0,"bunny");this.bunny.inputEnabled = true;this.bunny.pixelPerfect = true;this.bunny.input.enableDrag(false,false,true,false,this);this.bunny.input.useHandCursor = true;var t = "Test";var style = { font: "65px Arial", fill: "#000000", align: "center" };this.text = this.game.add.text(0, 0, t, style,'bunny');and now i was trying to move baunny and.. nothing. 

Is it correct?

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

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