Custom room transition (fade-in/out)

Started by eri0o, Sat 02/11/2024 14:17:48

Previous topic - Next topic

eri0o

Hey, since the 3.6.2 version in beta there's some nice way to screenshot the screen without including GUIs or the mouse cursor. I started to sketch some module for custom screen transitions. The idea in general is to set the in-engine fade type to instant and then use the custom module to manage things.

It would then have a very simple API.

Code: ags
 enum TFXStyle {
  eTFX_FadeBlack,
  eTFX_FadeWhite,
  eTFX_ScrollLeft,
  eTFX_ScrollRight,
  eTFX_ScrollBottom,
  eTFX_ScrollTop
};

managed builtin struct TransitionFX {
  
  import static attribute TFXStyle Style;
  
  import static attribute bool Auto;
  
  import static void FadeOut();
  
  import static void FadeIn();
  
}

Still need to figure how to actually run the transition, because the Overlays get killed on room change, I think I will need to take a GUI to be able to have where to draw things, possibly with a few buttons to be able to make the drawing faster.

The main motivation for me is because I really like the first Zelda room transition that slide to the side you go to the screen. The other thing is I want to be able to set the time (haven't figured the API) for the transition to run to be able to give different feelings depending on the game scene.

Anyway, just wanted to talk a bit about screen transitions and see if people have other ideas about it.

Crimson Wizard

Quote from: eri0o on Sat 02/11/2024 14:17:48Still need to figure how to actually run the transition, because the Overlays get killed on room change, I think I will need to take a GUI to be able to have where to draw things, possibly with a few buttons to be able to make the drawing faster.

I doubt that matters, because engine does not draw while the room is unloaded. Would that be GUI or overlay, or anything else, it may be shown on screen only while there's some active room.

I suppose that if you had an overlay with outro animation in room A, and then create another overlay with saved image in "before fade-in" of room B, then there won't be any "cut" in the animation.

eri0o

right. Need to test that, haven't yet. That would make it work fine and avoid manual stuff on the hands of the module user, which is always a plus.

My idea is some fades would be delayed, so for the scroll it would screenshot (room layer only), and hold it on the screen, and then when the next room loads, it screenshots it again, and then it can do the scroll one out and the other in, using blocking to avoid things moving in between - still need to figure some little details to have all of this working fine using the room events.

Code: ags
eEventEnterRoomBeforeFadein
        called just before the room's 'Enter Before Fade-in' event occurs
        DATA = new room number
eEventEnterRoomAfterFadein
        called just before the room's 'Enter After Fade-in' event occurs
        DATA = room number
eEventLeaveRoom
        called just after the room's 'Player Leaves Room' event occurs, before the fade-out
        DATA = room number they are leaving
eEventLeaveRoomAfterFadeout
        called when leaving a room, right after fade-out, but while room is still in memory
        DATA = room number they are leaving

for now did a few experiments using the event handlers in room and using only the manual TransitionFX.FadeOut() and TransitionFX.FadeIn() APIs, and haven't yet figured how the Auto transition would work - and I guess for the scrolling stuff the manual way would be the proper approach, but I wanted to have the Auto option for possible other screen transition effects that would require less manual operation.

SMF spam blocked by CleanTalk