GameMaker Studio 2 - Room Transitions using Sequences

  Рет қаралды 36,370

Sara Spalding

Sara Spalding

Күн бұрын

Пікірлер: 108
@RyderGaming
@RyderGaming 4 жыл бұрын
Things like this makes me wanna rework my game I've been working on for 1.5 years from scratch
@muddrox887
@muddrox887 4 жыл бұрын
Shaun, you deserve more views.
@digitalswordplay
@digitalswordplay 4 жыл бұрын
Wow! This changes everything! Looking forward to implementing this! Incredibly simple!
@mewtirae
@mewtirae 4 жыл бұрын
Extremely helpful as always... My original system for transitions is soooo much more needlessly complicated than this, and I'll be glad to be rid of that now!
@gt6808a
@gt6808a 3 жыл бұрын
This is incredible! You are helping me so much in my development work! Much thanks.
@itaisinger1360
@itaisinger1360 4 жыл бұрын
Thanks for the cool 2.3 tutorial man
@LuckNeves
@LuckNeves 3 жыл бұрын
To those people wanting to draw on the GUI layer, simply create a object with that sprite and create a sequence using that object instead of the sPixel. Then, change the object Draw event to a Draw GUI event where it draws itself :D
@joezuru3753
@joezuru3753 2 жыл бұрын
how? in my case it's with a menu
@joezuru3753
@joezuru3753 2 жыл бұрын
nevermind I found out, but now it creates TWO transitions in the room
@DarrelOdin
@DarrelOdin 4 жыл бұрын
Excellent video; I'll definitely be utilizing this going forward with my projects!
@KrangAnimations
@KrangAnimations 3 жыл бұрын
thanks so much you are a legend! also this was posted on my last birthday..........LOL
@e.maleki9927
@e.maleki9927 4 жыл бұрын
Thank you so much! Really needed this
@littlesaigon1042
@littlesaigon1042 4 жыл бұрын
Ooooooooo! Great use of sequences!
@gt6808a
@gt6808a Жыл бұрын
Thank you this was so helpful!
@RigidAudio
@RigidAudio 4 жыл бұрын
Fantastic work!
@mikitaslabysh8271
@mikitaslabysh8271 2 жыл бұрын
Amazing tutorial
@boomgoesthedynamite69
@boomgoesthedynamite69 2 жыл бұрын
I dunno if it's a new thing or a problem with Gamemaker, but this method doesn't permanently delete the "fade in" sequence layer. If you have to reset the room you transitioned to or go back into it, the fade out animation plays again. The code deletes the sequence once, but it just gets put back into the room once the room is reloaded.
@MoltiSanti
@MoltiSanti 2 жыл бұрын
I'm having this same issue and I've gone through hours of debugging. I've proven that the same self.elementID is being created/destroyed and then, somehow, the same exact self.elementID is re-created/destroyed without the Transition functions being called. None of my rooms are persistent, and the instance initially calling TransitionStart() is not persistent either. I've even tried destroying the "Transition" layer at the end of TransitionFinished(), to no avail. I wonder if this is a bug within the engine.
@sinistar
@sinistar 2 жыл бұрын
@@MoltiSanti are you two drawing oPixel on a GUI layer? because that was the problem for me, and as soon as i made it draw itself normally it fixed itself
@MoltiSanti
@MoltiSanti 2 жыл бұрын
@@sinistar I don't believe I was. Anyway, I scrapped sequences for now and I'm using my own system with an object that just draws a fading rectangle in the Draw GUI End event when transitioning. I appreciate the info, though.
@sinistar
@sinistar 2 жыл бұрын
@@MoltiSanti ah alright, good luck with your project!
@MoltiSanti
@MoltiSanti 2 жыл бұрын
@@sinistar Thank you. Same to you!
@netowgtz
@netowgtz 4 жыл бұрын
This is so interesting! In terms of performance, do you think it's better using sequences rather than having and object that handles everything?
@SaraSpalding
@SaraSpalding 4 жыл бұрын
The difference either way would be likely trivial
@abramthefighters
@abramthefighters 4 жыл бұрын
YES THIS IS SO USEFUL
@ArcadeTVx
@ArcadeTVx 4 жыл бұрын
I would love to see how to implement this in the drawui layer
@LuckNeves
@LuckNeves 3 жыл бұрын
I think a solution may be create a sequence of an object instead of a sprite! You can then do the object draw itself on the drawGUI layer :)
@PheonixMetal60
@PheonixMetal60 4 жыл бұрын
Hey, I'm having a weird issue where I can't see the transition when I have viewports enabled. If I disable it I see the Sequence for fading out fine, but when I enable it and my camera get's involved, no matter what position I put the layer in I just cant seem to see the transition sequence.
@joezuru3753
@joezuru3753 2 жыл бұрын
@ManChickenTurtle how do you do this?
@dopamine7344
@dopamine7344 2 жыл бұрын
@ManChickenTurtle this is the exact problem im having right now, did you happen to fix it?
@gargoyled_drake
@gargoyled_drake 3 жыл бұрын
my seqence is not filling out the screen, instead it happens in the corner of my screen, my rooms and sequences are all set to 1280x720, not really sure why it does this ? Edit: 1:10 this part is what i skipped, didnt think it would be that important, but it was, so gonna leave this here in case some one else makes the same mistake i did.
@dopamine7344
@dopamine7344 2 жыл бұрын
im having a small problem where everytime i die in a level i play the out transition, reset the room and then play an in transition which works fine but the origin of the in transition is where the camera was whenever i died instead of where the camera is when the room resets so the black bars are just not where they’re supposed to be. anyone know of a fix? i cant find many ways to effect transitions once theyve started playing
@lloyd011721
@lloyd011721 9 ай бұрын
is there a way to have it automaticly select the duplication? its pretty tedious that it doesnt
@diamondcat705
@diamondcat705 2 ай бұрын
Is there any way to draw the transition above the gui layer?
@dameroncook138
@dameroncook138 4 жыл бұрын
I'm having a lot of trouble getting this to work with a moving camera. Code: layer_sequence_create(_lay,camera_get_view_x(CAM),camera_get_view_y(CAM),_type); (CAM is just view[0]) If I use this code, the fade out works great, but the fade in doesn't show up at all. I think that the fade in is still appearing in the same position as the fade out, so if I fade out in a spot other than (0,0) the fade in doesn't show up at all. Any help would be appreciated! Thanks!
@SaraSpalding
@SaraSpalding 4 жыл бұрын
have your camera object (or some other object) update the position of the "transitions" layer whenever it exists.
@dameroncook138
@dameroncook138 4 жыл бұрын
@@SaraSpalding Thanks for your help! I'm assuming I should use similar code to parallax scrolling. If so, and if I use the function layer_sequence_exists(), how would I get the sequence_element_id in the camera object?
@dameroncook138
@dameroncook138 4 жыл бұрын
If anybody from the future is reading this, here is my solution: Code: //Last line of the TransitionPlaceSequence function global.sequenceLayer = layer_sequence_create(_lay,camera_get_view_x(CAM),camera_get_view_y(CAM),_type); and //In the camera object after it gets the camera's position if (layer_sequence_exists("transition",global.sequenceLayer)) { layer_sequence_x(global.sequenceLayer,_curX); layer_sequence_y(global.sequenceLayer,_curY); } (_curX and _curY is just the current x and y position of my camera)
@dameroncook138
@dameroncook138 4 жыл бұрын
@GamePerson Hey, I don't have a lot of information to go off of based on your video. As far as I can tell it seems like your fade in is spawning at the wrong (x,y) coordinate. So first, make sure you declared your global.seqeunceLayer variable with the rest of the global variables in the Transition script. Second, change that your fade out will spawn in the top left of the screen instead of the middle. Try messing around with the origin point of your fade in sequence for instance. Your game looks awesome by the way!
@zheckman89
@zheckman89 4 жыл бұрын
@GamePerson Hey, I'm experiencing the same issue as you and I think there's actually two problems going on. The first is that you're setting the transition to the camera's x and y, but you actually want to offset it. // In camera's step after calling camera_set_view_pos ... layer_sequence_x(global.sequenceLayer,x-view_w_half); layer_sequence_y(global.sequenceLayer,y-view_h_half); I define those halves as follows... view_w_half = camera_get_view_width(cam) * 0.5; view_h_half = camera_get_view_height(cam) * 0.5; There's also a second issue you should be experiencing, which is that the camera update code isn't actually running during the first transition. I'm not sure why it's correctly placed, but if you add some show_debug_message code to the camera update you'll see that it is only ever executed during the second sequence. I believe this is due to... TransitionPlaceSequence(_typeOut); // sets global.sequenceLayer layer_set_target_room(_roomTarget) TransitionPlaceSequence(_typeIn); // overwrites global.sequenceLayer layer_reset_target_room(); // Camera step should now be referencing that second global.sequenceLayer, which doesn't exist in the current room so the if check fails So what I did that seems to have ended up working, and this may take some unhackery for a production, was I put this code at the end of my camera step instead of the first snippet of code I mentioned in this comment ... if(layer_exists(layer_get_id("transition"))) { var _a = layer_get_all_elements(layer_get_id("transition")) if( array_length(_a) > 0 ) { // This code very clearly assumes that there will only be one sequence in this layer, it's the "hack" but works for 1 single sequence layer_sequence_x(_a[0],x-view_w_half); layer_sequence_y(_a[0],y-view_h_half); } } Hopefully this works for you, too! I'd love a more well thought out answer / solution but this seems to be doing the trick at the moment...
@martinmaxking
@martinmaxking 3 жыл бұрын
Anyone knows how to permanently remove this sequence from playing. I do code to place this sequence in the room only once. Then I leave the room and go back in (without doing code to place sequence in that room again) but sequence is playing again every time I enter the room. Looks like when I place this sequence in the specific room it is there permanently and even if sequence is destroying itself it's not helping :( you enter the room again and it's still there.
@melepe2547
@melepe2547 3 жыл бұрын
Im having the same problem rn
@leo8748
@leo8748 2 жыл бұрын
If you move layer_reset_target_room() in the TransitionStart function to run after global.roomTarget = _roomTarget it fixes the problem
@martinmaxking
@martinmaxking 2 жыл бұрын
@@leo8748 thx :)
@boomgoesthedynamite69
@boomgoesthedynamite69 2 жыл бұрын
@@leo8748 I know this reply is 3 months old, but for anyone just passing through: Do not do this. It will just break this system
@MoltiSanti
@MoltiSanti 2 жыл бұрын
I'm having this same issue and I've gone through hours of debugging. I've proven that the same self.elementID is being created/destroyed and then, somehow, the same exact self.elementID is re-created/destroyed without the Transition functions being called. None of my rooms are persistent, and the instance initially calling TransitionStart() is not persistent either. I've even tried destroying the "Transition" layer at the end of TransitionFinished(), to no avail. I wonder if this is a bug within the engine.
@kishi2403
@kishi2403 2 жыл бұрын
if someone having problem with room transition try this code var target = noone; if (room == rm_room1) { target = rm_room2; TransitionStart(target,seq_FadeOut,seq_FadeIn); }
@Stefan-bn4wh
@Stefan-bn4wh 3 жыл бұрын
Hi Shaun :) Quick Question.. I have a 3 rooms. Between Room 2 and 3 I setup the transition. When I do a game_restart() during the the fade in transition in room 3 the transition not longer works and the game gets stuck at the end of room2 during the next time. Do you know why this happens? Probably sth. with memory right?
@Stefan-bn4wh
@Stefan-bn4wh 3 жыл бұрын
ahh.. reading the manual.. GAME_ RESTART: "However it should be noted that global variables will not be re-initialised unless explicitly coded as such" ... I think thats it :)
@Stefan-bn4wh
@Stefan-bn4wh 3 жыл бұрын
but since the transition script should run again on room_restart i guess it could be a sequence bug
@Stefan-bn4wh
@Stefan-bn4wh 3 жыл бұрын
ok now i got it.. since the script that initializes the transition sequences is global, its not be reinitialized on game_start. Therefore I had to set the mid.transition variable to false at the create event of the first room.. now it works.. sorry for spamming :)
@chrisancliffe8799
@chrisancliffe8799 2 жыл бұрын
You sir are an amazing human, spent the last 3 hours trying to bug fix why this was happening on restart, as you said just had to put Room Start Event - midTransition = false, solved everything
@Stefan-bn4wh
@Stefan-bn4wh 3 жыл бұрын
If I draw a surface in the room the transition sequence is always behind the surface. Do you know how to fix that? Thx !! :)
@NetGhost03
@NetGhost03 4 жыл бұрын
Can you also play the sequence in the gui layer? Because the currenty implementation will be overlayed by the UI.
@kwj5679
@kwj5679 4 жыл бұрын
In my project, the layer sequence is invisible or is not created, I'm not sure, the transition works, but the sequence itself does not appear, visually I mean, how can I solve this? * I hope I spelled correctly, English is not my language.
@monkeyboy9233
@monkeyboy9233 Жыл бұрын
If you're having trouble with the sequence not rendering over your camera I figured a solution. Create a global variable for your camera X and Y. In Obj_game, Global.cameraX = 0; Global.cameraY = 0; Then I had my transition object convert it before running the line to update the global room target. In Obj_roomEnd, If (instance_exists(obj_player)) && etc... Global.cameraX = obj_camera.camWidth * 1; Global.cameraY = obj_camera.camHeight * 1; Global.targetRoom = etc... Then in (function TransitionPlaceSequence) in place of the 0,0 one the create line I used my global X and Y. function TransitionPlaceSequence(_type) { If (etc...) Var (etc...) Layer_sequence_create(_lay,global.cameraX,global.cameraY,_type); } It was simple, only updates the globals when you need them, and it fills the screen.
@AdamPippin
@AdamPippin 3 жыл бұрын
Very helpful! I had to change a few minor things but was able to figure out most of it. The one thing I have an issue with is how I do my room swaps, the character gets placed in a particular coordinate in the new room. Do you know a way to grab the player coordinates in the next room ahead of time?
@nathanbidolfo
@nathanbidolfo 2 ай бұрын
how do i implement this when i have more than 2 rooms?
@S_Tadz
@S_Tadz 4 жыл бұрын
How do we get this working with YYC? other.element_id won't pass a valid value
@myPlaceholderName
@myPlaceholderName 3 жыл бұрын
Sorry to reply to an old post, I just wanted to help anyone who might run into this problem in the future. If you're referring to the first line in the TransitionFinished script: layer_sequence_destroy(self.elementID); it doesn't work because "self" is broken in YYC. "Self" internally is -1, and in is easily taken out of context and can cause errors. You can simply replace it with layer_sequence_destroy(global.sequenceLayer); and it will work in YYC, but it becomes a little less modular, since it can only delete the one sequence stored in that variable. This shouldn't be a problem with the code used in the tutorial. Note: "other" = -2, "all" = -3, and "noone" = -4, but those seem to work properly in YYC as far as I've seen. Only "self" is broken, and functionally nearly identical to "id", but not in this specific case. I've heard it is best practice avoid "self" and use "id" instead.
@S_Tadz
@S_Tadz 3 жыл бұрын
@@myPlaceholderName Wow, first time hearing "self" is broken on YYC! Will look into it for sure. It must affect object instances only, because I use "self" all the time in my struct's methods, since 2.3. Thanks man!
@myPlaceholderName
@myPlaceholderName 3 жыл бұрын
@@S_Tadz I'm mostly citing information I've read elsewhere that has helped me, but it might be dated by now. At one point "self" was an abandoned function because it was too similar to "id" but there is a chance Yoyo games have tried to fix up "self" since then. If it works for you, then that's great, but it still seems a little buggy.
@Kazak29
@Kazak29 3 жыл бұрын
@@myPlaceholderName Thanks a lot! Did not know "self" is broken in yyc.
@samthesoupman6385
@samthesoupman6385 Жыл бұрын
hey all, im having an issue with an odd flisker effect at the end of my fade in sequence? i'm doing the transition with an object on the gui layer
@BiohazardEXTREME
@BiohazardEXTREME 4 жыл бұрын
This seems to only work if you have a single-screen game, or if you start the room at the top-left corner. Otherwise, the fade out sequence isn't glued to the camera position, and it may only show up partially on the screen, or not at all. Or am I doing something wrong?
@SaraSpalding
@SaraSpalding 4 жыл бұрын
see 5:55
@BiohazardEXTREME
@BiohazardEXTREME 4 жыл бұрын
@@SaraSpalding Ah okay, I did miss that part. Unfortunately, for my game, that still doesn't work, because I have a camera object that automatically snaps the view to my player at the beginning of the room, wherever that player object happens to be, so the view that's set in the room properties changes immediately when the room starts, and the sequence, obviously, doesn't follow. Ah well. Thanks anyway! Maybe I'll try these snazzier sequence transitions in my next project!
@SaraSpalding
@SaraSpalding 4 жыл бұрын
@@BiohazardEXTREME You can just move the "transitions" layer if it exists so it's always at the camera position.
@BiohazardEXTREME
@BiohazardEXTREME 4 жыл бұрын
@@SaraSpalding Huh. Okay, I'll give that a try. If I understand correctly, you mean to have my camera object always check if the transition layer exists and if it does, move it to the view position? Thanks, I really appreciate the help!
@PheonixMetal60
@PheonixMetal60 4 жыл бұрын
I'm having this issue too but I still cant see the transition even when I move it's position if I have my camera enabled...
@MrTHEHANSFORD
@MrTHEHANSFORD 4 жыл бұрын
Question: I've gone through the tutorial and it works fantastically, however there is a problem where if the first room is tagged as persistent the first sequence loops upon returning to the first room. Do you possibly know why that might be? For context I'm making a jrpg style game and am using the screen transition when you run into a random encounter. However the overworld is persistent so that when you end a battle you can continue exploring from where you were. Thank you!
@SaraSpalding
@SaraSpalding 4 жыл бұрын
If the room is marked persistent then the room will be persistent so the sequence will remain on the layer after leaving the room. Persistent rooms cause a lot of issues. You can avoid this by instead using something like global variables to track your player's overworld position and using this to set the player's position when you start the room rather than making the entire room persistent.
@MrTHEHANSFORD
@MrTHEHANSFORD 4 жыл бұрын
@@SaraSpalding I had a feeling that might be the case. Thank you so much!
@PheonixMetal60
@PheonixMetal60 4 жыл бұрын
Add a layer_sequence_destroy(self.elementID) to the change room function BEFORE you change rooms. This destroys it on your way out
@PheonixMetal60
@PheonixMetal60 4 жыл бұрын
@@MrTHEHANSFORD I had this same issue but the solution I posted helped me keep the persistence
@PheonixMetal60
@PheonixMetal60 4 жыл бұрын
@@burntshooter did you put the sequence destroy the line before room_goto? Inside the transitionchangeroom? It shouldnt be in any more statements besides the initial function
@xFetoidx
@xFetoidx 2 жыл бұрын
Is there any way to do this using visual studio? I made the sequence but can't get it to show up.
@KungFuChowder
@KungFuChowder 4 жыл бұрын
For me this resulted in both the fade out and fade in happening before going to the next room. I watched the video a second time and all the code is right. Any ideas why this is?
@crookedbeaker848
@crookedbeaker848 4 жыл бұрын
Hello, I followed this tutorial exactly besides renaming a few variables, and the game refuses to spawn in the transition sequence when I call the transition function. Can someone please tell me what's going wrong here? ///Room transition functions global.transition = false; global.targetRoom = -1; //Place the sequence function TransitionPlaceSequence(seq) { if layer_exists("transition") {layer_destroy("transition")}; var l = layer_create(-9999,"transition"); global.test = layer_sequence_create(l,0,0,seq); } //Initiate a transition function Transition(targetRoom,seqOut,seqIn) { if !global.transition { //Make sure one's not already happening global.transition = true; global.targetRoom = targetRoom; TransitionPlaceSequence(seqOut); //Place the transition in sequence in the target room layer_set_target_room(targetRoom); TransitionPlaceSequence(seqIn); layer_reset_target_room(); return true; //Success! } else return false; //Unable to execute } //Change rooms woo function TransitionChangeRoom() { room_goto(global.targetRoom); } //Wrap it up function TransitionFinished() { layer_sequence_destroy(self.elementID); global.transition = false; }
@musicjre
@musicjre 3 жыл бұрын
For whatever reason, this breaks when using HTML5. No idea why, though it works great otherwise!
@musicjre
@musicjre 3 жыл бұрын
(specifically, the first transition works fine, the the fadein doesn't happen at all, and then it stops working entirely)
@FoziVideos
@FoziVideos Жыл бұрын
@@musicjre Having the same issue, but two years later lmao
@Washed0n3
@Washed0n3 2 жыл бұрын
how do i make it so when i get to a point in the level that it transitions to the next room
@Stefan-bn4wh
@Stefan-bn4wh 3 жыл бұрын
@opagel
@opagel 6 ай бұрын
It's good, but doesn't work in HTML5.
@thefufuu3157
@thefufuu3157 4 жыл бұрын
big this is big ... you know what else is big ?`... yes my student loan ....
@lt1529
@lt1529 4 жыл бұрын
First!! And I don't know how I got too many likes!!
@buizelmeme6288
@buizelmeme6288 3 жыл бұрын
I wanted to make a transition that is similar to WarioWare. This transition is fade to black. I wanted a transition that fade to the next room. Useless tutorial. :(
@kewdii
@kewdii 2 жыл бұрын
That would be complicated with the way gamemaker uses rooms. These are just basic transitions to get you started. Useless comment :(
@buizelmeme6288
@buizelmeme6288 2 жыл бұрын
@@kewdii what useless comment? A comment is just a comment, a.k.a. feedback, *It's not useless!* >:/
@kewdii
@kewdii 2 жыл бұрын
@@buizelmeme6288 By your logic the video is just a video, aka information, not useless.
@buizelmeme6288
@buizelmeme6288 2 жыл бұрын
@@kewdii ... Still waiting for a game engine that will make wario transition cutscenes. >:(
@emaaaaax
@emaaaaax 2 жыл бұрын
@@buizelmeme6288 what a useless comment
GameMaker Studio 2.3 - SCRIPTS HAVE CHANGED!
11:23
Sara Spalding
Рет қаралды 42 М.
Beginner GameDev Mistakes - Ep 1
6:40
Sara Spalding
Рет қаралды 167 М.
"Идеальное" преступление
0:39
Кик Брейнс
Рет қаралды 1,4 МЛН
GMS2 Cameras: As Simple as Possible
13:27
PixelatedPope
Рет қаралды 68 М.
How to Code an Inventory System
23:16
GameMaker
Рет қаралды 19 М.
GameMaker Sequences (Pt. 1) - Editor & GML Usage
13:12
GameMakerStation - Matharoo
Рет қаралды 24 М.
I Made the Same Game in 8 Engines
12:34
Emeral
Рет қаралды 4,4 МЛН
Can I 100% Superliminal and Get a Refund?
23:36
Gronf
Рет қаралды 402 М.
RESOLUTION guide for game devs & GameMaker
8:50
Sara Spalding
Рет қаралды 74 М.
5 Useful Scripts for GameMaker Studio 2 (and 1!)
9:34
Sara Spalding
Рет қаралды 101 М.
Optimisation Tips | GameMaker Studio 2
19:10
FriendlyCosmonaut
Рет қаралды 52 М.
Organising Data | Menus: GMS2 [P1]
28:19
FriendlyCosmonaut
Рет қаралды 69 М.