Game Development Community

Problem with using schedule()

by Ryan Jones · in Torque Game Builder · 01/14/2009 (1:06 pm) · 1 replies

Hello all,

Okay, what I would like to do is pretty simply animate of something, but I can't figure out what I'm doing wrong.

The object in my game is called SecurityAlarm. I purposely have a fuction call because I plan to add some more code later, I just want this portion to work, but I can't seem to get the schedule() to work.

function onLevelLoaded(%this, %scenegraph)
{
%this.soundalarm();
}

function soundalarm(%this)
{
%this.owner.playAnimation(alarmsiren);
schedule(2000, 0, "pausealarm");
//The problem is that the schedule function never works
}

function pausealarm(%this)
{
%this.owner.playAnimation(alarmsilent);
}

#1
01/15/2009 (11:58 am)
I've figured it out.

function Alarm::onLevelLoaded(%this, %scenegraph)
{
%this.soundalarm();
}

function Alarm::soundalarm(%this)
{
%this.owner.playAnimation(alarmsiren);
%this.schedule(2000, "pausealarm", 0);
}

function Alarm::pausealarm(%this)
{
%this.owner.playAnimation(alarmsilent);
}