I would do it like that:
Code:
type TMessage = record
NeededPoints : integer;
Text : string;
StartTime : cardinal;
Duration : cardinal;
end;
var BonusMsg : TMessage;
.
.
.
// init the Record
with BonusMsg do
Text := 'Bonus life!';
NeededPoints := 25000;
StartTime := 0;
Duration := 5000;
end;
.
.
.
// Show the message
if (score >= BonusMsg.NeededPoints) then
begin
with BonusMsg do
begin
StartTime := GetTickCount;
inc(NeededPoints, 25000);
end;
end;
.
.
.
// rendering in your render routine
if GetTickCount - BonusMsg.StartTime < BonusMsg.Duration then
dxFontBonus.TextOut(dxDrawGame.Surface,300,330,BonusMsg.Text);
Code written straight outta my head. No guarantee for compilable code, but it should show the idea...
Away from that, personally I would use a simple particle to show the text!
EDIT: I edited the code so that it should spawn the text each 25000 points!
Bookmarks