Transparency in background frames

Started by SGK, Mon 02/08/2004 00:07:57

Previous topic - Next topic

SGK

Ok i need rather urgent for someone to solve this. Im trying to make a background to fade from white to black slowly, thats why i just didnt make another room and put crossfade..

My game is hi-color, so no problems about that. The problem is that when executing this script in the room:

// room script file

function room_a() {
Ã,  // script for room: Player enters screen (before fadein)
SetBackgroundFrame(1);
RawDrawFrameTransparent(1, 99);Ã, 
}

function room_b() {
Ã,  // script for room: Player enters screen (after fadein)
SetCharacterView(EGO, 7);
Wait(20);
RawDrawFrameTransparent(1, 95);
RawDrawFrameTransparent(1, 90);
RawDrawFrameTransparent(1, 85);
RawDrawFrameTransparent(1, 80);
RawDrawFrameTransparent(1, 75);
RawDrawFrameTransparent(1, 70);
RawDrawFrameTransparent(1, 65);
RawDrawFrameTransparent(1, 60);
RawDrawFrameTransparent(1, 55);
RawDrawFrameTransparent(1, 50);
RawDrawFrameTransparent(1, 45);
RawDrawFrameTransparent(1, 40);
RawDrawFrameTransparent(1, 35);
RawDrawFrameTransparent(1, 30);
RawDrawFrameTransparent(1, 25);
RawDrawFrameTransparent(1, 20);
RawDrawFrameTransparent(1, 15);
RawDrawFrameTransparent(1, 10);
RawDrawFrameTransparent(1, 05);
RawDrawFrameTransparent(1, 00);Ã,  Ã, 
}


it gives this error message:

---------------------------
Adventure Game Studio
---------------------------
An error has occured. Please contact the game author for support, as this
problem is caused by the game rather than the interpreter.
(ACI version 2.56.627)

(Room 13 script line 6)
Error: RawDrawFrameTransparent: cannot draw current background onto itself

---------------------------
OKÃ,  Ã, 
---------------------------


I dunno how to not draw it on itself.... didnt get it.. someone can help me?

EDIT: by the way, the background is a white image and the frame is black. Ive put one frame only.
Perils of Poom rules! Therefore i want a sequel!

for the ones that finished 7days,check this;D

Gilbert

That's because you're already on frame 1, you cant raw draw frame 1 itself directly on itself.
So you probably need to raw draw frame 1 on frame 0, if you just want it to fade to black, import a bg of pure darkness of the same size into frame 1 (though I think you can also use TintScreen() for it, and it's probably even better).
Moreover, you have to Wait() after each rawdrawing, for simplicity and readibility, I'll change it to a while loop (also read the note in the manual, about restoring the screen):

// room script file

function room_a() {
  // script for room: Player enters screen (before fadein)
  SetBackgroundFrame(0);
  RawDrawFrameTransparent(1, 99); 
}

function room_b() {
  // script for room: Player enters screen (after fadein)
  SetCharacterView(EGO, 7);
  Wait(20);
  RawSaveScreen();
  int ii=100;
  while (ii>0) {
      RawRestoreScreen();
      RawDrawFrameTransparent(1, ii);
      Wait(1);
      ii-=5;
  }
}

SGK

how/where do i put the tintscreen thing?
Perils of Poom rules! Therefore i want a sequel!

for the ones that finished 7days,check this;D

Gilbert

Just where you want the effect to happen, and you don't need another frame for it. Like in your case:

function room_a() {
  // script for room: Player enters screen (before fadein)
  //SetBackgroundFrame(0); //Not needed
  //RawDrawFrameTransparent(1, 99); 
}

function room_b() {
  // script for room: Player enters screen (after fadein)
  SetCharacterView(EGO, 7);
  Wait(20);
  int ii=100;
  while (ii>0) {
      TintScreen(ii,ii,ii);
      Wait(1);
      ii-=5;
  }
}

Unfortunately, I'd checked, and seems that TintScreen() won't make the the screen as dark as expect even when using (1,1,1), if you want it to become REAL dark, TintScreen() may not be a good solution.

strazer

Is there a reason why you don't want to use the
FadeOut (int speed)
function?

Gilbert

Yeah FadeOut() works too, but in case he wants more control over the process. (For example, I'll never use FadeOut() myself).

SMF spam blocked by CleanTalk