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

Numbers with circle or rectangle background


studymark26
 Share

Recommended Posts

Hi There,

 

I'm new to Phaser,  i want to develop game related to numbers. For this i want to generate random numbers dynamically with coloured circle or rectangle back ground.

 

how to do this in phaser. please help, I have attached sample image. I don't want to create images, then add sprite. 

Is there a way to do it using graphics and text ?

 

thanks in advance.

 

Regards,

StudyMark

number-with-circle-background.png

Link to comment
Share on other sites

Hello Taggrin,

 

Thanks for the reply,  The idea is the circle and number should be one object, so to apply animations to it.

With  graphics.drawCircle(300, 300, 100); circle is added to the graphics object.

How can I make both number and circle as 1 object. is it possibl ?. 

if  circle is an image, we can use addChild(text) method.

is it possible to addChild() to circle drawn with graphics ?

sorry it may be trivial, since I'm new, please bear with me..

 

 

 

Thanks & Regards,

 

StudyMark.

 

 

 

 

Link to comment
Share on other sites

Just done putting up a quick example, here you go: http://phaser.io/sandbox/edit/jQTPcIqr

Didn't comment it, but I think it's pretty self-explanatory. If something is not clear, just ask.

This is a way to draw text directly into the bitmapData. The drawback is that it can't be aligned properly.

Another way would be to make the circle sprite and the text separately (the text would be an instance of Phaser.Text) then add the two to a group, then act on the group (be it tweens, position, scale or whatever).

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

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