lakitu42
4th July 2002, 04:02
I had a thread before about running animations backwords. You just declare a timer. Set it's delay to the same as the animation and make it so ontimer sets the animation to the frame previous to it. Like this:
//always remember std.mi
#include <Lib\std.mi>
Global button rwbutton;
Global button playbutton;
Global timer animtimer;
Global animatedlayer anim;
system.onScriptLoaded()
{
Layout mainnormal = system.getContainer("Main").getLayout("normal");
rwbutton = mainnormal.getObject("rwind");
playbutton = mainnormal.getObject("playanim");
anim = mainonrmal.getObject("anim");
animtimer = new Timer;
animtimer.setDelay(100);
anim.setSpeed(100);
}
animtimer.onTimer()
{
anim.goToFrame(anim.getCurFrame() - 1);
}
rwbutton.onLeftClick()
{
if(anim.isPlaying())
anim.stop();
animtimer.start();
}
playbutton.onLeftClick()
{
animtimer.stop();
anim.play();
}
anim.onFrame(1)
{
animtimer.stop();
}
//always remember std.mi
#include <Lib\std.mi>
Global button rwbutton;
Global button playbutton;
Global timer animtimer;
Global animatedlayer anim;
system.onScriptLoaded()
{
Layout mainnormal = system.getContainer("Main").getLayout("normal");
rwbutton = mainnormal.getObject("rwind");
playbutton = mainnormal.getObject("playanim");
anim = mainonrmal.getObject("anim");
animtimer = new Timer;
animtimer.setDelay(100);
anim.setSpeed(100);
}
animtimer.onTimer()
{
anim.goToFrame(anim.getCurFrame() - 1);
}
rwbutton.onLeftClick()
{
if(anim.isPlaying())
anim.stop();
animtimer.start();
}
playbutton.onLeftClick()
{
animtimer.stop();
anim.play();
}
anim.onFrame(1)
{
animtimer.stop();
}