Andrewgosu
The Silent Pandaren Helper
- Reaction score
- 716
It is come to my attention, that a lot of people are stuck creating a default looking texttag (floating text for GUI users).
So, here it is, a function, which creates a default (like the bounty text, it moves up and gradually fades) floating text (duh)!
I hate working with percentages, so I replaced them with a "colour code" parameter, which makes this easier to use.
Comply with GUI users, one can access the created texttag via "Last created text tag".
A location (point) version for GUI users.
Have fun!
So, here it is, a function, which creates a default (like the bounty text, it moves up and gradually fades) floating text (duh)!
I hate working with percentages, so I replaced them with a "colour code" parameter, which makes this easier to use.
Comply with GUI users, one can access the created texttag via "Last created text tag".
JASS:
function CreateTextTagDefault takes string msg, string colourCode, real x, real y returns texttag
local real vel = 64. * 0.071 / 128
local real angle = 90. * bj_DEGTORAD
set bj_lastCreatedTextTag = CreateTextTag()
call SetTextTagText(bj_lastCreatedTextTag, colourCode + msg, 11 * .023 / 10)
call SetTextTagPos(bj_lastCreatedTextTag, x, y, 0)
call SetTextTagColor(bj_lastCreatedTextTag, 0, 0, 0, 255)
call SetTextTagPermanent(bj_lastCreatedTextTag, false)
call SetTextTagVelocity(bj_lastCreatedTextTag, vel * Cos(angle), vel * Sin(angle))
call SetTextTagLifespan(bj_lastCreatedTextTag, 3.)
call SetTextTagFadepoint(bj_lastCreatedTextTag, 2.)
call SetTextTagVisibility(bj_lastCreatedTextTag, true)
return bj_lastCreatedTextTag
endfunction
A location (point) version for GUI users.
JASS:
function CreateTextTagDefaultLoc takes string msg, string colourCode, location where returns texttag
return CreateTextTagDefault(msg, colourCode, GetLocationX(where), GetLocationY(where))
endfunction
Have fun!