Menu

Show posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Show posts Menu

Messages - 3DNative

#1
Quote from: Khris on Wed 09/05/2012 17:35:16
For a small background animation you can use an object instead. Look up Object.Animate in the manual.

If you still want to do it using background frames:

Code: ags
// inside room_RepExec()

  if (IsTimerExpired(1)) {
    nbf = (GetBackgroundFrame() + 1) % 4;
    SetTimer(1, 400*(nbf==0) + 5*(nbf>0));
    SetBackgroundFrame(nbf);
  }


Final step: if it doesn't exist, add the after fadein event and in there, call SetTimer(1, 1); to start things off.

Thanks for your help i got it to work using a timer with my original code :D

Code: ags
function room_RepExec()
{  
  if (IsTimerExpired(1)) {
    SetBackgroundFrame(1);
    Wait (5);
    SetBackgroundFrame(2);
    Wait (5);
    SetBackgroundFrame(3);
    Wait(5);
    SetBackgroundFrame(0);
    SetTimer(1, 200);
  }
}

function room_AfterFadeIn()
{
  SetBackgroundFrame(0);
  SetTimer(1, 200);
}
#2
Ok so i'm using SetBackgroundFrame to animate a background as i want to add a waiting period after the animation, the animation is a fish jumping in a pond but i don't want the fish to repeatedly jump in the animation.

This is the code i was trying but it stops the character from moving etc as its using Wait();

SetBackgroundFrame(0);
Wait(400);
SetBackgroundFrame(1);
Wait(5);
SetBackgroundFrame(2);
Wait(5);
SetBackgroundFrame(3);
Wait(5);

this code is being looped.
SMF spam blocked by CleanTalk