Rafus Posted October 15, 2013 Share Posted October 15, 2013 Hi, I'm new in pahser and in js I'm making an easy game - something like "memory game" it will be easy to place just images that you have to find,but i need to place text on image and animate both.in flash i create mc and animate him,Have can i do this in phaser? Link to comment Share on other sites More sharing options...
rich Posted October 15, 2013 Share Posted October 15, 2013 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 More sharing options...
Rafus Posted October 15, 2013 Author Share Posted October 15, 2013 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 topturret = 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 More sharing options...
Rafus Posted October 16, 2013 Author Share Posted October 16, 2013 Ok.I know how you did it x=x is there a way to make text click able? Link to comment Share on other sites More sharing options...
sergil Posted October 18, 2013 Share Posted October 18, 2013 At last how did you solve your problem? using two sprites and moving around using the same x and y? if so, how did you solve tweeting? do you know how to create a group of a sprite and a bitmaptext? Link to comment Share on other sites More sharing options...
Alvin Posted October 18, 2013 Share Posted October 18, 2013 Hi, If you have a Sprite and a BitmapText already created, you can add them to a group usinggroup.add(sprite);group.add(BitmapText); Link to comment Share on other sites More sharing options...
Recommended Posts