Titus, разбирал func WaitTime( seconds ) из util.gs. При применении в коде WaitTime( 10 ), например:
SamplePlay(13); // проигрываем 13 эффект (длительность 10 сек.)
MusicVolume( 30 ); // делаем тише основную музыку по громкости 30%
WaitTime( 10 ) // ждем 10 сек
MusicVolume( 100 ); // делаем основную музыку по громкости 100%
Обратил внимание, что во время паузы 10 сек, Диззи кроме ходьбы и прыжков, остальные команды/функции не работают. Почему? Просто хотелось чтобы по истечению 10 сек, основная музыка вернулась на 100%.
------------
Нашел еще счетчик:
/////////////////////////////////////////////////////////////////////////////////
// Gameplay time counter
/////////////////////////////////////////////////////////////////////////////////
int g_timer_lasttick;
// call on begin game callback (BeginNewGame) to reset timer
func TimerReset()
{
g_timer_lasttick = 0;
GameSet(G_TIMER,0);
}
// call on load callback (LoadUserData)
func TimerOnLoad()
{
g_timer_lasttick = 0;
}
// update, call on the game update handler
func TimerUpdate()
{
if(g_timer_lasttick==0) g_timer_lasttick = gs_time();
timer_currenttick = gs_time();
delta = timer_currenttick - g_timer_lasttick;
timer = GameGet(G_TIMER);
if(delta>0) timer += delta;
GameSet(G_TIMER,timer);
g_timer_lasttick = timer_currenttick;
}
// call with reference paramters to get the play time
func TimerGetTime( hours, minutes, seconds )
{
timer = GameGet(G_TIMER)/1000; // seconds
*hours = timer / 3600;
*minutes = (timer / 60) % 60;
*seconds = timer % 60;
}
// debug display of the elapsed time
func TimerPrint()
{
h=0; m=0; s=0;
TimerGetTime(&h,&m,&s);
println(h,":",m,":",s);
}
Может лучше это использовать? Но тогда хотелось бы твоих комментариев, для лучшего понимая сути (с примером хотелось бы).




Ответить с цитированием