SetTextColor
From MaratisWiki
(Difference between revisions)
(Created page with "Change the text color. setTextColor({r, g, b, a}) : r = Red / g = Green / b = Blue / a = Alpha Example, change text color to red and semi-transparent : Text0 = getObje...") |
Dahnielson (Talk | contribs) m |
||
(5 intermediate revisions by one user not shown) | |||
Line 1: | Line 1: | ||
− | + | {{lua-function|setTextColor|object, color}} | |
− | + | Change the text color. Use a table with the color of the text with this format <code>{red, green, blue, alpha}</code>. | |
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | {{lua-function-param|object|object to operate on}} | |
+ | {{lua-function-param|color|color to change to}} | ||
+ | |||
+ | '''Example 1:''' Change text color to red and semi-transparent. | ||
Text0 = getObject("Text0") | Text0 = getObject("Text0") | ||
Line 13: | Line 12: | ||
if isKeyPressed("SPACE") then setTextColor(Text0, {1, 0, 0, 0.50}) end | if isKeyPressed("SPACE") then setTextColor(Text0, {1, 0, 0, 0.50}) end | ||
end | end | ||
+ | |||
+ | [[Category:Lua scripting]] | ||
+ | [[Category:Lua function]] | ||
+ | [[Category:Text]] |
Latest revision as of 00:04, 9 February 2014
setTextColor(object, color)
Change the text color. Use a table with the color of the text with this format {red, green, blue, alpha}
.
-
object
: object to operate on -
color
: color to change to
Example 1: Change text color to red and semi-transparent.
Text0 = getObject("Text0") function onSceneUpdate() if isKeyPressed("SPACE") then setTextColor(Text0, {1, 0, 0, 0.50}) end end