Game Development Community

Simple float question

by GilForumGuy · in Torque Game Builder · 01/21/2010 (7:42 pm) · 1 replies

Hello,

For some reason when I used floating point values in a function my code doesn't compile.

For instance, I am changing the alpha component of the background. Alpha value exists between [0,1].

bkgNewGame.setBlendAlpha(.5); //Code does not compile

BUT

bkgNewGame.setBlendAlpha(".5"); //Does compile (notice the quotes)

I would like to have a variable change the alpha...but I am not able to...anyone familiar with this?

Thanks!



#1
01/21/2010 (7:45 pm)
Figured the problem out.

I have to use 0.5 so:

bkgNewGame.setBlendAlpha(0.5); //Works!

so if you have a variable use:

%variableFloat = 0.5;
bkgNewGame.setBlendAlpha(%variableFloat);