Simple font questions

CanadianHobo

  • Posts: 24
Hellos,

  • Is a way to get font by name (text attribute)
  • Does the "set color to [color]" block work?

Thanks

Donni11

  • *
  • Posts: 2181
1. yes , open/attach a code block

(events > flow > advanced)



and type this in :
Code: [Select]
for (res in Data.get().resources)
{
   if (Std.is(res, Font) && res.name == "Font Name Here")
   {
       return cast (res, Font);       
   }
}

return null;



2. most likely

« Last Edit: December 19, 2015, 06:04:01 pm by Donni11 »
Peace

yoplalala

  • *
  • Posts: 1632
Thanks Donni11, I didn't know this trick.

For the second question, I would say never no. It never worked for me, but you can use some tricks to colour them.

CanadianHobo

  • Posts: 24
For question 1, the code will work well in a custom block.  Is there a way to call the block fields in the code? (ex. %0 in the block details)

For question 2, does the block changes the font colour or does the block work like tint?  Because if it works like tint and the default is black, the block will never change colours. 

@yoplalala: do you know a forum page for these tricks?

Thanks

« Last Edit: December 20, 2015, 11:01:53 am by CanadianHobo »

CmdrWhitey13

  • Posts: 505
Set Color

set-color-block

Sets the color used for filling shapes (does not apply to fonts). You can select the color using the color picker, drag in a color attribute or drag in any block that returns a color.
g.fillColor = [COLOR];

http://www.stencyl.com/blocks/

yoplalala

  • *
  • Posts: 1632
Oh sorry forgot to answer you.
you can use the image api, draw the text on a image and then use this http://community.stencyl.com/index.php?topic=43283.0 (last post)  to change colour. If you don't want to do a global custom block you can also download the bitmap drawing extension, it will have this block

CanadianHobo

  • Posts: 24
I was thinking of using labels and since labels are actors, I was going to tint them with a colour.  Unfortunately, my engine extension is empty except for AdMob that I installed; I thought there was a problem so I reinstalled Stencyl but it is still empty.  Bug maybe (Build 8734)? 

I will use your way; thanks. 

« Last Edit: December 22, 2015, 03:56:20 pm by CanadianHobo »

CanadianHobo

  • Posts: 24
In case anyone needs the blocks to change font colours. 

The Bitmap Utilities extension was used for:
Colour with [[COLOUR]] image [[IMAGE]]

A global custom block was used for:
Colour by [[A_LIST]] (takes in RGB as a list and returns a colour)

« Last Edit: December 24, 2015, 01:30:08 am by CanadianHobo »

cloa513

  • Posts: 245
Which extension- Bitmap Drawing or something else?