Game Development Community

Score and time last script file

by hamed · in Torque Game Builder · 02/21/2012 (10:13 am) · 1 replies

would anybody tell me where shoud i write the last script file of score and time tut ? and how should i execute it ?
this file
// scenegraph onLevelLoaded callback
function t2dSceneGraph::onLevelLoaded(%this)
{
   // schedule the timer update function for 1 second
   %this.timerSchedule = %this.schedule(1000, updateScoreboardTimer);
}

// scenegraph onLevelEnded callback
function t2dSceneGraph::onLevelEnded(%this)
{
   // cancel the timer update event if it's currently pending
   if(isEventPending(%this.timerSchedule))
      cancel(%this.timerSchedule);
}

// updateScoreboardTimer function
function t2dSceneGraph::updateScoreboardTimer(%this)
{
   // increment scoreboard time field
   ScoreboardGuiTime.setValue(ScoreboardGuiTime.getValue() + 1);
   
   // reschedule ththis function for 1 second
   %this.timerSchedule = %this.schedule(1000, updateScoreboardTimer);
}

// scene window onMouseDown callback
function t2dSceneWindow::onMouseDown(%this, %modifier, %pos, %clicks)
{
   // increment scoreboard score field
   ScoreboardGuiScore.setValue(ScoreboardGuiScore.getValue() + 1);
}
thanx

About the author

the great costly games, but the only purpose is killing, and the only amuse but why we just should kill to be satisfied,why the games should not change ? great drama in the games ? maybe today , is the time to change from bullets to flowers


#1
02/21/2012 (9:31 pm)
such as my last posted threads its me taht answer my own question,!!
i found the soulotion after a heavy headehe , i wrote it in a seperated script cs file in my gamescript folder and then add a exec line into my game.cs
thanx again