ShaunJS

GameMaker Transitions with Sequences

Oct 14th, 2020 (edited)
1,616
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. global.roomTarget = -1;
  2. global.midTransition = false;
  3.  
  4. //Called whenever you want to go from one room to another, using any combination of in/out sequences
  5. function TransitionStart(_roomTarget, _typeIn, _typeOut)
  6. {
  7.     if (!global.midTransition)
  8.     {
  9.         global.midTransition = true;
  10.         global.roomTarget = _roomTarget;
  11.         TransitionPlaceSequence(_typeOut);
  12.         layer_set_target_room(_roomTarget)
  13.         TransitionPlaceSequence(_typeIn);
  14.         layer_reset_target_room();
  15.         return true;
  16.     }
  17.     else return false
  18. }
  19.  
  20. //Places the sequences in the room
  21. function TransitionPlaceSequence(_type)
  22. {
  23.     if (layer_exists("transition")) layer_destroy("transition")
  24.     var _lay = layer_create(-9999,"transition")
  25.     layer_sequence_create(_lay,0,0,_type); 
  26. }
  27.  
  28. //Called as a moment at the end of an "Out" transition sequence
  29. function TransitionChangeRoom()
  30. {
  31.     room_goto(global.roomTarget);
  32. }
  33.  
  34. //Called as a moment at the end of an "In" transition sequence
  35. function TransitionFinished()
  36. {
  37.     layer_sequence_destroy(self.elementID);
  38.     global.midTransition = false;
  39. }
  40.  
RAW Paste Data

Adblocker detected! Please consider disabling it...

We've detected AdBlock Plus or some other adblocking software preventing Pastebin.com from fully loading.

We don't have any obnoxious sound, or popup ads, we actively block these annoying types of ads!

Please add Pastebin.com to your ad blocker whitelist or disable your adblocking software.

×