How to increase textobject value at run time
by Deepak Sahu · in Torque Game Builder · 08/12/2009 (5:23 am) · 7 replies
Hi,
How to increase textobject value at run time ??
I mean to say how to show score board in screen. i try to echo but it is not display any message to output screen. and how to use this function in onCollision event
function is:
function SetScores(%p)
{
$count += %p;
Score.setText($count);
}
where Score is text object.
How to increase textobject value at run time ??
I mean to say how to show score board in screen. i try to echo but it is not display any message to output screen. and how to use this function in onCollision event
function is:
function SetScores(%p)
{
$count += %p;
Score.setText($count);
}
where Score is text object.
#2
i call this function in onLevelLoaded, so it work properly but when i call into onCollision then it is not work.
08/13/2009 (12:28 am)
hi Nate Gertsch,i call this function in onLevelLoaded, so it work properly but when i call into onCollision then it is not work.
#3
08/13/2009 (9:17 am)
Can you post the code for the onCollision section? I suspect that it's fine and that you're not actually triggering collisions. Are you sure that collision callback is set to true and the objects recieve/send collisions?
#4
08/13/2009 (1:12 pm)
Have you looked in the console? I'm almost certain that the t2dTextObject does not have a setText function. You have to use the fields to set the text likeScore.Text = $count;It's worth a shot, at least.
#5
{
%file = new FileObject();
if(%file.openForWrite("~/data/files/HighScore.txt"))
{
%file.writeLine($d);
echo("File Written");
currentScore.setText($d);
}
else
{
error("File is not open for writing");
}
%file.close();
}
this function is not work correctly, i means "%file.writeLine($d);" line not work. Any solution ?
08/18/2009 (6:40 am)
function ScoreFile(){
%file = new FileObject();
if(%file.openForWrite("~/data/files/HighScore.txt"))
{
%file.writeLine($d);
echo("File Written");
currentScore.setText($d);
}
else
{
error("File is not open for writing");
}
%file.close();
}
this function is not work correctly, i means "%file.writeLine($d);" line not work. Any solution ?
#6
08/21/2009 (1:47 am)
Help Me??
#7
Does it display "file written" in the console?
Does $d have a value?
Is highscore.txt being created?
I get that English isn't your first language but more information makes it easy for us to help you and shows that you've taken a crack at solving the problem yourself.
08/21/2009 (1:33 pm)
A little more information beyond "I means %file.writeline($d) line not work" would be helpful.Does it display "file written" in the console?
Does $d have a value?
Is highscore.txt being created?
I get that English isn't your first language but more information makes it easy for us to help you and shows that you've taken a crack at solving the problem yourself.
Nate Gertsch