View Single Post
  #1  
Old 05-17-2012, 06:33 PM
greggiles greggiles is offline
Registered User
greggiles's Avatar
Join Date: Sep 2007
Posts: 149
greggiles has a spectacular aura about
Sleep/Timer help

I am trying to have an image I have made, rotate slightly, then rotate back.
This is the only way I know how to do it. I am hoping someone can teach me the proper use of the 'sleep' function or perhaps advice me another way to write it. This does work, but I don't like how It's so long. and too many OnThis functions.

btw, the 'OnRot' stands for 'on rotation.'

Quote:
function onRot1()
{
findImg(3).rotation -= 0.05;
scheduleEvent(0.3, "onRot2");
}
function onRot2()
{
findImg(3).rotation -= 0.05;
scheduleEvent(0.3, "onRot3");
}
function onRot3()
{
findImg(3).rotation -= 0.05;
scheduleEvent(0.3, "onRot4");
}
function onRot4()
{
findImg(3).rotation -= 0.05;
scheduleEvent(0.3, "onRot5");
}
function onRot5()
{
findImg(3).rotation += 0.05;
scheduleEvent(0.03, "onRot6");
}
function onRot6()
{
findImg(3).rotation += 0.05;
scheduleEvent(0.03, "onRot7");
}
function onRot7()
{
findImg(3).rotation += 0.05;
scheduleEvent(0.03, "onRot8");
}
function onRot8()
{
findImg(3).rotation += 0.05;
scheduleEvent(0.03, "onRot1");
}
Reply With Quote