Adventure Game Studio

AGS Support => Advanced Technical Forum => Topic started by: left on Fri 07/01/2005 14:53:32

Title: screen fade using raw function
Post by: left on Fri 07/01/2005 14:53:32
Hi, in my game i am trying to create a night to morning fade. I found the raw function which does sets the frame transparency in the maual, but im un sure how to use this.
What exactly is the script for doing this. i have tried making a list with declining transparency values but this doers not work. The manual alse states that you have to keep on calling the restore screen function but i just cant understand how you make it fade slowly?
i'm sure im just being stupid.
thanks in advance
Title: Re: screen fade using raw function
Post by: strazer on Fri 07/01/2005 15:15:55
Normal background: Night (Frame 0)
Animated frame 1: Day (Frame 1)


  // script for room: Player enters screen (before fadein)
  //...

  SetBackgroundFrame(0); // disable background frame animation
  RawSaveScreen(); // save night background for restoring

  //...



  // script for interaction where you want the transition to happen
  //...
 
  int trans=99;
  while (trans >= 0) {
    RawRestoreScreen(); // restore night background
    RawDrawFrameTransparent(1, trans); // draw day background on night background at trans transparency
    Wait(1); // wait 1 gameloop (increase this to slow down transition speed)
    trans -= 1; // decrease transparency by 1
  }

  //..


Note: As the manual states, this only works with hi-color backgrounds.