Room Transitions | Farming RPG Tutorial: GMS2 [6]

Поделиться
HTML-код
  • Опубликовано: 21 дек 2024

Комментарии • 223

  • @clasherclan9222
    @clasherclan9222 3 года назад +25

    2:20 GMS2 No longer loads the first room in your list, you have to set the start room by clicking the little house icon

    • @LoadedGunsTTV
      @LoadedGunsTTV Год назад

      Thank you! I was having a hard time with this LMAO My transition into the house, I have to walk the player up before the blackalpha will go away where I can see, but when I leave the house its normal, any ideas?
      EDIT: I figure out my issue was my obj player was spawning on the transition zone creating more then one instance of it I believe, either way when I changed the spawn coords the transitions are smooth and fixed

    • @lloyd011721
      @lloyd011721 9 месяцев назад

      int he "room order" underneath "favorites", the first room int he list is the one that gets that little house icon

  • @joostkivits
    @joostkivits 7 лет назад +4

    Really helpful tutorial! How I personally handle room transitions is by creating a room transition object when the player colliders with the door and having that object handle all logic and then deleting itself.

  • @ZakTheFallen
    @ZakTheFallen 5 лет назад +11

    I am totally using this codebase when making an rpg. It has all of the basics covered, and organized in a better way. I appreciate GameMaker Studio because it's a middle ground between RPG Maker and games coded from scratch. The scripting is very powerful, but a lot of the basics for 2D games are already built into the editor. At the same time, the limits of the game engine are very few.
    The only really noticeable downside is that the event system could be improved (mainly not being able to define custom events). Oh well, there are other ways to do the same thing, it just requires a different kind of solution. Honestly, all game engines have their downsides, but GameMaker Studio has good documentation and people like FriendlyCosmonaut are amazing at giving tutorials :)

  • @starscapesmusic
    @starscapesmusic 3 года назад +1

    Loving this series so far! Thank you for all the great explanations! :D
    I keep having typos and messing stuff up, but when I do find the solution it's just that much more rewarding :P

  • @killerb144
    @killerb144 7 лет назад +9

    I can't tell you how excited I get when I see one of these pop up in my feed. Can't wait for the next one.

  • @FeniksGaming
    @FeniksGaming 7 лет назад +20

    Thanks a lot. It took me much longer than I expected to finish this video there was a lot of material covered and had to go back few times to figure it out. Not really your fault just me being rather slow learner when it comes to abstract things.
    I have learnt a lot however and can't wait to get started on your next video soon.
    Keep them coming :)

    • @FriendlyCosmonaut
      @FriendlyCosmonaut  7 лет назад +3

      Ah, well let me know if there are concepts you struggled with! I'm mildly aware when I'm explaining that I could have spent longer or gone through it differently, but it's hard to know how you guys find it. So if you are having trouble, maybe it is my fault! Always feel free to tell me if you'd have liked something explained more/differently.

    • @FeniksGaming
      @FeniksGaming 7 лет назад +8

      No I think I got there in the end just needed to pause few times and rewind. Overall I find your series very organised and much more clearly explained than most I have seen on youtube.

  • @Zoyous
    @Zoyous 5 лет назад +11

    Wow... 12:30 - 18:30 you're going blazing fast. I think that section could benefit by being supplemented by maybe showing a little flowchart like you did with the movement code earlier in the series.

  • @zexyu
    @zexyu 4 года назад +2

    Awesome tutorial, love these and and am enjoying learning gamemaker. @29:40 I was able to also fix this by putting this at the start of my player step event:
    if (game.transitioning) return;
    This is neat because it prevents input for a few so the player can't accidentally move back and avoids some code duplication. I also moved the collision layer hiding logic to the game's Room Start event just so I don't have to remember to add this in every instance create.
    if (layer_exists("Collisions")) layer_set_visible("Collisions", false);
    if (layer_exists("Transitions")) layer_set_visible("Transitions", false);
    Hope this helps someone else. 👍

  • @Sacchari
    @Sacchari 4 года назад +2

    I have a problem! Around 23:00 you typed enum dir { right = 0; up = 90; left = 180; down = 270 } Well, for some reason it is only recognizing "right"! up, left, and down are all white instead of red, and the code won't run. I don't know why it is like that. I did everything exactly like you did!
    Edit: NEVERMIND I FIGURED IT OUT! I was using a semicolon instead of a comma.

  • @bradleebowers8203
    @bradleebowers8203 7 лет назад +3

    Wonderful!
    And just to note, not only can you use your mouse to get an idea of the x/y of where your character should spawn you can drag one of those npcs to the position to see how you would basically be standing at that location and note their x/y to put in the warp field.

  • @connorsol
    @connorsol 5 лет назад +5

    Does anyone know when in this series she wrote the code on screen at 9:49 ? (the //horizontal and //vertical collision detection) I am having an error on one of those lines because I can't see the full line of code to make sure I match it!

    • @Xayify
      @Xayify 5 лет назад +3

      Hi! that would be in the "movement and collisions" video, the second one in this series i do believe!

    • @Saioren
      @Saioren 4 года назад +4

      im having trouble there too. her code is different than the one she had us write in video 2!

  • @jasonr5248
    @jasonr5248 4 года назад

    Your tutorials are amazing! Thanks for spreading that knowledge around!

  • @YoshimiGames
    @YoshimiGames 6 лет назад +7

    Fantastic tutorial series. Thank you. I had a problem where the player object wouldn't appear at the correct co-ordinates when moving room. Worked out I didn't have my 'game' object set to persistent.

    • @micke8161
      @micke8161 5 лет назад

      Thank you!..

    • @_bubblezzzzzz_
      @_bubblezzzzzz_ 5 лет назад

      I had the same problem and found that in my player obj the persistence was not checked, I checked it and it works now.

    • @MatthewElric
      @MatthewElric 3 года назад +1

      If I could explain to you how long I've been digging through comments looking for a solution...You're a legend, John. Truly.

  • @tiberionx
    @tiberionx 4 года назад +2

    hi! at 4:26 how did you specifically cut that part of the tile ?

    • @Angelosanto
      @Angelosanto 4 года назад

      The sheet by itself exists independently of the bed sprite, it's towards the bottom of the sprite sheet

  • @GusOfTheDorks
    @GusOfTheDorks 5 лет назад +1

    I'm watching your tutorials and I'm having fun learning, but I'm curious. At places like 24:00 you have us set up new variables but you have us set the variables as -1. I'm assuming this is because 1 is true and 0 is false, so -1 wont trigger anything or in data sets like directions where you only have 0-360 degrees, -1 doesnt exsist and will get ignored. Is that why you keep using -1 for values that are going to be replaced based on instances later? Or is there another reason for that?

  • @chipa.2738
    @chipa.2738 7 лет назад +7

    I'm having a problem similar to gloss_v2 below, where the spawn point isn't getting properly set. Through a little debugging, I can see that the problem is that the player's X and Y are never properly updated - the spawn point is just whatever oPlayer's X and Y were at the time of the room transition instead of targetX and targetY in the oTransition's instance creation code. And the reason for that is that spawnX and spawnY aren't being updated in oGame. I think the issue is in my oPlayer's step event:
    var _inst = instance_place(x, y, oTransition);
    if (_inst != noone)
    {
    with(oGame)
    {
    if(!doTransition)
    {
    spawnRoom = _inst.targetRoom;
    spawnX = _inst.targetX;
    spawnY = _inst.targetY;
    doTransition = true;
    }
    }
    }
    ...well, never mind. I figured out what I did. I'm posting it anyway in case anyone else does the same thing. I plugged in the coordinates just next to the Transition instance I was colliding with instead of the Transition instance I'd be arriving at. For example, at the exterior door to my farm, I set targetX and targetY to coordinates just outside the farm's exterior door, when I should have set coordinates that are just INSIDE the interior door in the interior room. Ugh, I shouldn't code when I'm tired...

    • @FriendlyCosmonaut
      @FriendlyCosmonaut  7 лет назад +1

      Sorry for the late reply (I'm still on holidays) - though I'm happy to see you've solved it! Thank you for posting the solution, I'm sure it will help others.

  • @adamki-7x
    @adamki-7x 3 года назад +1

    I got an issue in fading part. Idk why it works like that:
    1.When stepped on transition obj Fading beggins
    2. When it is >=1 then changes room
    3. And there is an issue that fade out is instantly.
    Idk why GMS2 forgots about what it done to black_alpha an sets it to default from number from create

  • @canned_charisma4416
    @canned_charisma4416 4 года назад +1

    Hey, not sure if you or anyone else checks this, but for whatever reason the black box thats supposed to appear over the entire gui only does a partial block, even though I have the viewport properties, camera properties, etc all in sync. I fixed it by using display_set_size(1600, 1440);, but I'm still wondering why the issue was there in the first place...

  • @balanmatei5981
    @balanmatei5981 5 лет назад +2

    When I try to make a transition from the farm to the farm_house mmy game freezes a bit then the player appears in the top left corner. Somehow the transition to this room doesnt work but when I make the transition into the forest it works without a problem. Do you know why this may occur? It may be from the dimensions of the room?

    • @CrazyFanaticMan
      @CrazyFanaticMan 5 лет назад

      If you click on your room and then check you Properties box in the bottom left corner, is your Viewports and Cameras settings ObjectFollowing attached to your player object?

  • @wolfs-hunt1812
    @wolfs-hunt1812 4 года назад +1

    I'm new at programming so I'm not sure how this is happening, but the transition is only working correctly once, from the farm to the house, and all other transitions are putting the player on the (0,0) coordinates, and from what else I could find out, changing the player layer. as in, the player starts the game in the correct layer, but once it does the transition once, and then goes back outside, the player can walk on top of the roof but still collide with the stuff. I'm not sure why it's doing this, and I'm sure I probably misspelled something somewhere, but I can't figure it out where....
    update: I remade the code this time trying to pay even more attention to your video and I think I managed to fix it, I still don't know how ...

  • @jordanproclan
    @jordanproclan 4 месяца назад +1

    the obj_player does not appear in the coordinates that I indicate and I have checked the Code and I do not have any error, it appears in other coordinates not even close to those that I have placed.

  • @theinternet6313
    @theinternet6313 5 лет назад +18

    I swear I spend most of my time figuring out what I did wrong when all it was, was an "x" where a "y" should be, took me 20 minutes to find it.

    • @DavidWilsonJr
      @DavidWilsonJr 5 лет назад +2

      I gave up last night because of the same thing in the Room Start! lol it's nice to figure it out what went wrong on your own though

  • @philluprider7191
    @philluprider7191 5 лет назад +1

    I've watched the video twice now but for some reason the black fade rectangle only forms over the top left portion of the screen, I can't figure out why

    • @panzeros5714
      @panzeros5714 5 лет назад

      So the rectangle is drawn in the "Draw GUI" event of the game object. The command is draw_rectangle_color and the first four parameters it asks for are x1, y1, x2, y2. X1 and Y1 are the origin at the top left of the screen and they should be set to 0, 0 because GMS2 draws the room from the top left to bottom right.
      X2 and y2 are the finishing co-ordinates for the rectangle and the value we put in there is guiWidth and guiHeight which are variables we have set ourselves in the create event of the game object. The variables are guiWidth = display_get_gui_width(); guiHeight = display_get_gui_height(); The "display_get_gui_width/height" function returns the value of the amount of pixels in the display. So you are telling it to draw from the origin at the top left, all the way to the number of pixels that exist in the display.
      Hope this helps and apologies if I've got anything wrong, i'm pretty new to this myself.

    • @Xayify
      @Xayify 5 лет назад

      @@panzeros5714 im getting this same problem, its drawing over most of the screen but the fade is being cut off on the bottom and right. ive checked my code a dozen times, its gotta be returning wrong values or something. im on two screens, my laptop screen, and a high-resolution monitor, could it be the difference in resolution? that really shouldn't be it but ive been trying to fix this for over an hour

  • @blackshiro3354
    @blackshiro3354 4 года назад

    I'm not sure if this was adressed in a video but why use the =-1 when setting up a reference? Thanks!

  • @DragonHuntersXD
    @DragonHuntersXD 3 года назад

    I dont Know whats wrong, i wrote the code out with the room_goto (var) and it worked. I then added the rest of the code in the vid and now my player would collide with the door. it just fases through... any ideas? To be honest in the one just before this i couldent get the 'with()' command to work either... is it just my version of GMS?

  • @masquerade0133
    @masquerade0133 4 года назад +2

    Great tutorials but I can't get my transitions to work even though my code is exactly the same as yours. And no typos have been made. :(

    • @masquerade0133
      @masquerade0133 4 года назад

      Berk Unver Still nothing :(

    • @athemulu
      @athemulu 4 года назад

      That happened to me.. I just retyped the code and it started working for me

    • @william1026
      @william1026 4 года назад

      @@athemulu lol

  • @Gtea4ever
    @Gtea4ever 5 лет назад +1

    If you have physics enabled make sure to use phy_position_x & phy_position_y for the player object

  • @GusOfTheDorks
    @GusOfTheDorks 5 лет назад +2

    So, I'm at 21:28 and I've hit a problem. When I transition rooms I go to the next room. However, I instead of spawning next to the transition object, I spawn directly at the top. I assume I'm spawning at 0,0. I'm not sure why. Its also a problem because I have collision boxes set up around the edge of my map, so I'm spawning inside a collision box when I transition. Otherwise everything about the transition including the fading is working. I'm gonna re watch the video to make sure I did everything right, but any help would be loved. If and when I figure out whats gone wrong, I'll post it in a reply to this comment so anyone having similar issues can get a leg up.

    • @GarettMitchell
      @GarettMitchell 5 лет назад

      I've been having the same problem in my code. I have been working on this sense May 3rd. It's super annoying.

    • @GusOfTheDorks
      @GusOfTheDorks 5 лет назад

      @@GarettMitchell have you been working on this video series since may third or on this problem since then? Its gotta be something to do with the coridinates not connecting. Because everything else works perfect.

    • @GarettMitchell
      @GarettMitchell 5 лет назад

      @@GusOfTheDorks I've been working on the problem sense may third.

    • @GusOfTheDorks
      @GusOfTheDorks 5 лет назад

      @@GarettMitchell oh wow. Now I really want to figure this out. Id hate to leave a gellow gsme maker hanging. Ill let you know when I find anything.

    • @GusOfTheDorks
      @GusOfTheDorks 5 лет назад +1

      @@GarettMitchell Ok, so I figured out what we did wrong. or at least what I did wrong. at 19:44 is about when she starts explaining it but for a very brief explanation, you need to set the transition coordinats (TargetX and Target Y) in the transition instances themselves and do it for where you want your sprite to end up in the next room. So for instance, you need to have a line in the instance creation code of TargetX = and then set the X postion in the house where you want the sprite to appear.

  • @canibalstalker314
    @canibalstalker314 5 лет назад +1

    What is the importance of setting a variable to 0 versus -1? If these variables are going to be changing anyway, why not set them all to 0?

  • @davidpaul6822
    @davidpaul6822 4 года назад +1

    I had a problem that the game was not transitioning when I switched to the fading.
    deleting the game object in room 0 and re adding it fixed it. Strange but that's all it took.

    • @fk4158
      @fk4158 4 года назад

      thanks.....thanks....sooomuch!!!!!

    • @lordsgate7774
      @lordsgate7774 3 года назад

      didn't work on me, scren goes black, black never fade aways, it just stay as it is.

  • @sumbudi2734
    @sumbudi2734 4 года назад

    what exactly do I have to consider if I want to program this room transition with an following object like a NPC? Thanks in advance and merry christmas :D

  •  7 лет назад +1

    Thank you so much! But I have a problem.
    Everthing worked fine until I move the code below to "object game". when I start the game my char facing north and move animation is on all the time.without even pressing any movement key:( and facing only changing when a room transition done.
    with(oplayer)
    {
    switch (facing)
    {
    case dir.left: yframe = 9; break;
    case dir.right: yframe = 11; break;
    case dir.up : yframe = 8; break;
    case dir.down: yframe = 10; break;
    case -1 : xframe = 0; break;
    }
    }

    •  7 лет назад

      seems like I cut the code. but I had to copy! . it sounds bit weird to have same code twice in 2 different objects.animation problem solved but facing after transitions are not right. bit confused:)

    • @FriendlyCosmonaut
      @FriendlyCosmonaut  7 лет назад +1

      Sorry, do you mean you moved this bit of code, which is how the player sets its sprite/direction, entirely out of the player and moved it to the game object?

    •  7 лет назад

      Yea. at first I cut the code out of objectplayer and ruined all facing animation stuff:) then fixed it by copying.

  • @cdominguez95
    @cdominguez95 5 лет назад +1

    I'm struggling with the transitions and different camera sizes. I've noticed that my draw GUI events never actually cover my whole display when I run the game, which messes with the transitions and other screen related stuff. I had the same issue following Shaun Spalding's tutorials. I know how to fix it, but I'd like to understand why it happens. Any suggestions? (I'm literally copying and pasting your code and settings)

    • @athemulu
      @athemulu 4 года назад +1

      Exactly my problem. When I worked on this on a monitor it wasn't doing it though, so maybe it's the type of computer?

  • @TechBoxNorth
    @TechBoxNorth 7 лет назад +3

    A lot of stuff going on in this one, gonna have to watch it through a couple of times to make it stick :) Looking forward to the next part!

    • @FriendlyCosmonaut
      @FriendlyCosmonaut  7 лет назад +1

      Yeah I'm worried it got a bit convoluted at times :S!

  • @zaclester6761
    @zaclester6761 6 лет назад +1

    I'm having some trouble after switching from the "room_goto" method to the "spawnRoom" method where the character no longer transitions when touching the transition object. I've checked the debug and it says transition = 1 and the spawnRoom changed each time, so I'm not sure what's wrong. I can upload my project if need be.

    • @FriendlyCosmonaut
      @FriendlyCosmonaut  6 лет назад +1

      Hey - I've had a few people had this problem before. Interestingly, every single time it's been an issue with inconsistent variable names, ie. calling spawnRoom Spawnroom, spawnx and spawnX, etc. So I'd suggest having a very careful look over your code for these, they can be hard to spot! Let me know if you still can't find the issue.

    • @masquerade0133
      @masquerade0133 4 года назад

      @@FriendlyCosmonaut Still cant sort the issue out :( All of the variables are correctly named

    • @william1026
      @william1026 4 года назад

      @@masquerade0133 Same :(((

    • @marianovikova3483
      @marianovikova3483 4 года назад

      @@FriendlyCosmonaut Still same problem here even though I'm fairly an experienced programmer, but never made a game with Gamemaker Studio 2 before. Please let me know if you or someone has a fix for this.

    • @marianovikova3483
      @marianovikova3483 4 года назад

      @@FriendlyCosmonaut I debugged and blackAlpha never gets updated to more than 0.10, so that's why the transition didn't work, because the if statement didnt' meet the condition of blackAlpha >= 1, so room_goto(spawnRoom) wasn't used.

  • @avaneeshsharma3370
    @avaneeshsharma3370 5 лет назад

    My room transitions aren't working, the character just collides with obj_transitions and stays there, any help?

    • @ryanwenke8380
      @ryanwenke8380 5 лет назад

      Feel free to send over the code if you are still working on this series :)

  • @440trigger
    @440trigger 3 года назад

    I had a problem where my player was changing rooms fine, but the black transitions were not showing. I eventually solved it by removing the code " room_goto(inst.targetRoom); " from the player objects step event
    Perhaps this will help someone else with the same problem.

  • @Saioren
    @Saioren 4 года назад

    I just cannot figure out why my character wont move after the transition. it's hopeless.

  • @codypotter93
    @codypotter93 6 лет назад

    Couldn't you leave off draw_set_alpha(1) when handling the fade? Every frame, the alpha is being increased until it reaches one. no reason to set it to one at the end of the script every time...

  • @CodeWorkshop
    @CodeWorkshop 7 лет назад

    Another great tutorial covering a lot of little tricks for the transition. Great job!

  • @sergioakirautime7944
    @sergioakirautime7944 6 лет назад +1

    The fading effect only works once... I wonder what's going on. I appreciate any help...

    • @PokeizelVEVO
      @PokeizelVEVO 5 лет назад +1

      If an object isn't persistent, it won't move on to the next room. Maybe your fade object isn't set to persistent yet

  • @troublehunters3671
    @troublehunters3671 7 лет назад +1

    whenever I go between the rooms, im seeing the background of the new room, but my player is not showing up in the new room. Any idea why that would be happening?

    • @FriendlyCosmonaut
      @FriendlyCosmonaut  7 лет назад +3

      That sounds like the room transition is happening correctly, but the respawning of the player isn't. I'd check all the variables and code involved in respawning the player (usually things like this can be as simple as a spelling/grammar mistake). If you can't find it, feel free to send me your project file (file -> export project) and send it to friendlycosmonaut@gmail.com

    • @Montigorable
      @Montigorable 4 года назад

      I have faced the same problem. Maybe someone will find my suggestions useful.
      1. Make sure you have a background set in your house room, (just a flat black color for example, i personally created a filled with black "background" layer to solve this problem ).
      2. Make sure you have house's entrance trigger TargetX and TargetY set properly (choose the coordinates inside of your house room, where you want your player to spawn).
      3. Make sure you have made a camera persistent.

  • @chipa.2738
    @chipa.2738 7 лет назад

    I'm using the tileset you provided to make the room interior, and I'm trying to use the technique you showed us for animating tiles in a tileset. But I'm having an issue trying to animate the clock and the stove. When I go to the Tile Animation area for the tileset, I can only set one FPS for the entire set. I'd like the clock to move at 1 FPS but the stove to move at 5 or 6. How do I accomplish that?

    • @FriendlyCosmonaut
      @FriendlyCosmonaut  7 лет назад +3

      Yeah the FPS you set is shared by all the tiles. A way around this is to set it at the "fastest" FPS you need, and then for the slower ones, just fill up the frames with the same picture to make it seem like the animation is slower.

  • @rreeppeeaatteerr
    @rreeppeeaatteerr 6 лет назад +1

    Lovely tutorials! My GUI dimensions are coming up smaller than my viewport and I can't figure out why. I've followed along super closely. Has anyone else had this issue, or anyone know what I could try? I'm really scratching my head on this one!

    • @clarisse9170
      @clarisse9170 5 лет назад +2

      I actually had the same problem, but I found a solution to this! Before your code, in the Draw GUI, try typing in:
      display_set_gui_maximize();

    • @rreeppeeaatteerr
      @rreeppeeaatteerr 5 лет назад +2

      @@clarisse9170 Funny enough, I just found that solution a couple days ago! It comes up again in a view videos when we do the day/night cycle and the lighting. I actually put it on the game object Create event. Something seems fishy about it, but it does appear to work fine. Must have something to do with different computers/monitors and screen resolutions? :shrug:

    • @AbdiYohan
      @AbdiYohan 5 лет назад

      @@rreeppeeaatteerr really helped me out here, thank you so much! working on a non-pixel art game so my dimensions for these videos are all sorts of different, lol

  • @benblanchard5343
    @benblanchard5343 5 лет назад

    in my game world when I move my MC next to a npc he's behind the NPC any fix?

  • @OndrejKollar
    @OndrejKollar 7 лет назад

    Hi, great video. My idea about spawn is using another object as spawn point with assigned variables facing and spawnName, then you need only store in persistent game instance 'targetSpawnName' because all others value are assigned on spawn object and object position you can use x,y for player spawn position.
    // Room start event
    //obj_player.x = spawnX;
    //obj_player.y = spawnY;
    var i;
    for (i = 0; i < instance_number(obj_spawn); i += 1)
    {
    var spawn = instance_find(obj_spawn,i);
    if (spawn.spawnName == game.targetSpawnName)
    {
    obj_player.x = spawn.x;
    obj_player.y = spawn.y;
    obj_player.facing = spawn.facingDir;
    exit;
    }
    }
    Great job with GM2 tutorials btw. ;)

  • @LadenIsle
    @LadenIsle 5 лет назад

    For some reason blackAlpha is not increasing when I touch obj_transition. I've checked over all the variables and they're consistent. I'm completely stumped.

    • @LadenIsle
      @LadenIsle 5 лет назад

      Never mind it was one lousy curly brace that was very easy to miss.

  • @haydencarlson2746
    @haydencarlson2746 5 лет назад

    I am having an issue coding the transition for entering into the house. I have checked over my code and re-watched the video, with nothing seeming amiss. The transition to the forest and back to the farm works fine. However, the one to the house is having issues. I get a fatal error in the Room Start event for the game object. It lists:
    "Unable to find any instance for object index '1' name 'obj_player'
    at gml_Object_game_Other_4 (line 4) - obj_player.y = spawnY"
    I have looked over that section of the code and there seems to be no irregularity. Could anyone give me any advice regarding the matter? I cannot fathom why the code would work for the transition to the forest but not the house.

    • @Karazaro
      @Karazaro 5 лет назад +1

      Hey. It means your character object gets deleted before it can be read - there is a simple fix for it.
      1. Go to Objects > Characters > obj_player (or wherever your obj_player is located at)
      2. Double-click it
      3. Below "Collision Mask", there are four tickboxes
      4. Tick Persistent
      Have fun coding!

    • @haydencarlson2746
      @haydencarlson2746 5 лет назад

      @@Karazaro That worked! Thank you very much, I have thoroughly been enjoying the coding.
      But I have another issue as well. When I enter the farmhouse, (either from upstairs or downstairs), there remains a still image behind it. When I enter the farmhouse from the farm, it shows a background of the rm_forest for some reason behind the farmhouse room itself. When I enter it from the upstairs, it shows the last image displayed in rm_farmhouse_upstairs behind the farmhouse (i.e., a still image of obj_player colliding with the stair transition area). Any idea what might be causing it?

    • @Karazaro
      @Karazaro 5 лет назад

      @@haydencarlson2746 At first glance, it looks like your camera object is not moving properly. Try to look up the episode where she created room 0 first and how she made objects change rooms from it! :)

    • @haydencarlson2746
      @haydencarlson2746 5 лет назад

      @@Karazaro I'll check it out. Thank you again!

    • @haydencarlson2746
      @haydencarlson2746 5 лет назад

      @@Karazaro I'll check it out. Thank you again!

  • @MentalAtheist
    @MentalAtheist 2 года назад

    What if you have both a run and walk animation?
    I coded it like this
    if (moveX 2 ) y_frame = 5; //RIGHT RUN
    else if (moveX > 0 ) y_frame = 1; //RIGHT
    else if (moveY 2 ) y_frame = 4; //Down RUN
    else if (moveY > 0 ) y_frame = 0; //Down
    else x_frame = 0; //STOPED

  • @fernandolara2986
    @fernandolara2986 7 лет назад +1

    Awesome video 👍👍

  • @netbofh
    @netbofh 6 лет назад

    Any reason not to put the switch(facing) statement in begin step or regular step before facing gets set? Then its all contained in the player object and you don't need it in your draw event too.

  • @The-Tynman
    @The-Tynman 6 лет назад

    Would there be any reason why the transitions would take a bit of time before actually happening? It seems that the first transition thats made happens instantly but after that intial one all other are taking some time to happen and the chacter can still move before the room is changed.

    • @FriendlyCosmonaut
      @FriendlyCosmonaut  6 лет назад

      Hmm that's a strange one. That shouldn't be happening. One thing that comes to mind is that you might have ticked rooms as persistent? This would mean that more and more memory is being consumed, causing the game to load slower.

    • @The-Tynman
      @The-Tynman 6 лет назад

      all for a "less than" sign being a "greater than" sign which wouldnt change the doTransition variable back to false.

  • @misterbean6136
    @misterbean6136 3 года назад

    I have a small problem... I used the 8 directional movement code from another video of yours, so I dont know how to fix the facing problem. If anyone can help, I'd be really thankful

  • @freeridin
    @freeridin 5 лет назад

    For some reason my rectangle won't cover the whole screen, my variables seem to be exactly as what FriendlyCosmonaut has:
    obj_game:events:create:
    guiWidth = display_get_gui_width();
    guiHeight = display_get_gui_height();
    obj_game:events:draw gui:
    ...
    draw_rectangle_color(0, 0, guiWidth, guiHeight, c_black, ...
    ...

    • @freeridin
      @freeridin 5 лет назад +1

      FIXED!
      I just added display_set_gui_maximize(); to the obj_game create event!

    • @jamiefox
      @jamiefox 5 лет назад

      @@freeridin Congratulations

  • @lukemckim1346
    @lukemckim1346 7 лет назад

    Amazing tutorials! One problem i seem to be having is that dotransition is not registering as true (checked through the debug console) even though inst.targetroom changes appropriatly. I've checked for spelling and my code seems to be spot on with yours so I am really just at a loss. Any help would be appreciated and thanks so much for your hard work!

    • @FriendlyCosmonaut
      @FriendlyCosmonaut  7 лет назад

      No worries - could I see a screenshot of the relevant code? (You can send it to me at friendlycosmonaut@gmail.com)

  • @tgiby9062
    @tgiby9062 5 лет назад

    i cant get fades to work or actually draw :(

  • @videoket
    @videoket 6 лет назад +1

    Here's a huge newbie question for someone: Can you remind me why we are setting so many variables to -1 as their initial value? And how does this differ from setting them to, say, 0 as an initial value? I'm still not thinking like a coder yet...

    • @FriendlyCosmonaut
      @FriendlyCosmonaut  6 лет назад +10

      Great question! I know things like this seem pretty arbitrary - and actually, they are. A lot of the time stuff in programming is done because of convention. And by convention, variables are often initialised as being equal to 0 or -1 or undefined. Those values are sort of supposed to just indicate that the variable hasn't really sorted itself out yet. But there are some quirks in GameMaker where numbers >= 0 are actually used as indexes for things like arrays and data structures (if you run the game in debug mode and have a look at what "value" your data structures are, you'll see a number, not a bunch of numbers like you may be expecting from an ID). So initialising a data structure as being equal to 0 can cause some trouble later on, because if you check for example if that data structure exists, if you've set it to 0, it might think that it actually does (because 0 is a valid value for a data structure in GameMaker).
      So that's why setting them to -1 can be a bit "safer". Hope that makes some sense!

  • @rhysh993
    @rhysh993 5 лет назад

    ok so i managed to get this working fine however i have the same building in multiple rooms and cant figure out how to get the player to go back to the room it came from because i can only put 1 target room. Any ideas?

    • @adrianpaulblake
      @adrianpaulblake 5 лет назад

      So you're saying you have the same instance of the transition object in each room? Remove it and place a new one, so that you can then change the location in that instance.
      Remember you're placing the code in the individual instance, not the main object. You should be clicking Creation Code, not Edit Object.

    • @rhysh993
      @rhysh993 5 лет назад

      Yeah i am putting it in the creation code. I'll rephrase it.
      The building is in village 1. Village 1's target is to go inside the building. Inside the building, the target is to go outside to village 1. However, this same building is in village 2. Village 2's target is to go in the building but because its the same room inside, the transition object still has village 1's target. I need a way to go back to the village it came from. Sorry if its a bit of a bad explanation.

    • @adrianpaulblake
      @adrianpaulblake 5 лет назад +1

      @@rhysh993 ah I get you. So you're treating it as the same building but want it to go back onto to where you came.
      So I can think of two solutions. 1) you make a seperate house for the second place to go to, if you're wanting to pretend they are different this is probably best.
      2) you could create a variable that is changed by the transition squares going to the house. Then the square in the house has an if function that says if variable = A it runs as going to village A, and if variable = B it goes to village B.
      Hmm also, if you're acting like one is a different route to the same exact house, then you could just have a different door, like a trapdoor, that one village is linked to

    • @rhysh993
      @rhysh993 5 лет назад

      Those are pretty good ideas although creating separate houses may be an issue because im gonna need more than two (as i need them for more villages later on) so although that solution would work and i can easily do it, it will just leave me with lots of rooms, taking up space.
      The second option, well I'm relatively new to game maker so i honestly have no idea as to how i would go about making the variables do as intended (i tried before and it was just not working). So if you had any ideas as to how to go about doing it, it would really be appreciated
      As for the third option, there's only one door to the building so making another door is not an option

    • @adrianpaulblake
      @adrianpaulblake 5 лет назад +1

      @@rhysh993 I'm reaaaaaaaaaaaally not an expert, I'm just doing the tutorials like you. And I can't do this on mine coz I'm scared this will break it, but have a go with my solution below, and debug it for practise lol
      But if you take this bit from the player step screen
      var inst = instance_place(x,y,obj_transitions);
      if(inst != noone and facing == inst.playerFacingBefore) {
      with(game){
      if(!dotransition){
      spawnRoom =inst.targetRoom;
      spawnX = inst.targetX;
      spawnY = inst.targetY;
      spawnPlayerFacing = inst.playerFacingAfter;
      dotransition = true;
      }
      }
      }
      This is where the transition happens. So. In the player create (edit: maybe this needs to be in the game object? Try player first) make a new variable, say
      last_room = -1;
      then in the creator for each instance of the transitions to the house, you want them to have a variable.
      room_from = villageA;
      for example.
      Then you want to add a section into the player transition section above that changes the player last_room variable to the room from
      so under spawnRoom = inst.targetroom;
      write
      last_room = inst.room_from;
      This will change the variable in the player to the room that it's just come from
      OK, so we can see in the main player transition that we need the inst.targetRoom, the targetX and targetY. So
      in the transition that you need inside the house to go to multiple places, go to the creation code. It should be
      targetRoom = rm_farm;
      targetX = 1006;
      targetY = 696;
      playerFacingAfter = dir.up;
      playerFacingBefore = dir.up;
      Well now all you need to do is say "If last_room = villageA then do all this for villageA, if last_room is village B, then do all this for village B.
      so for example if my two villages are rm_farm and rm_farmB
      if last_room = villageA
      {
      targetRoom = rm_farm;
      targetX = 1006;
      targetY = 696;
      playerFacingAfter = dir.up;
      playerFacingBefore = dir.up;
      }
      else if last_room = villageB
      {
      targetRoom = rm_farmB;
      targetX = 1006;
      targetY = 696;
      playerFacingAfter = dir.up;
      playerFacingBefore = dir.up;
      }
      So if we think it through, as you transition INTO the house, you change a variable to say "This is the last room I was in" (and you won't have this changed by different rooms in your house, it will just stay the same). Then when you leave you're saying "If the last room I was in was this, send meto this place, if it was this other one, send me there."
      Hope that helps, let me know, and sorry if it doesn't lol I'm really not great at this.
      As an aside, I don't think your game would get too big from just having different houses. dunno if this is possible, but you could maybe have an object that's a house, and then in each house room, you place that, and it's basically a premade house, and then you just add extras, or changes on top of it. The problem will be that if you do as planned, each house won't just look the same, it will BE the same, so at that point, what's the point in having them all?

  • @nuclearbeeberman
    @nuclearbeeberman 6 лет назад +2

    love your tutorial thanks a lot and keep going with this awesome work :)

  • @vaanaktln
    @vaanaktln 2 года назад

    Thanks for the video. Still so helpful even after so many years)
    Can somebody please help me to grasp the logic of Room Start Event - the player's facing is set in Room Start Event according to the obj_transition instance's vale, but shouldn't it be then updating by the player's step event since it should be working every frame after the room start and in that event the player's facing should be reset to -1 since moveX and moveY equal 0 so the facing should be changed again after Room Start Event. I don't get why it isn't happening :'((

  • @vela7358
    @vela7358 2 года назад

    was stuck with the fast part between 'game' , 'obj_player' and 'obj_transition' before realising my brackets should have been closed off before an 'else' DOH. this is what i get for watching this in a tiny popout window

  • @devintidball905
    @devintidball905 4 года назад +1

    my room change isnt working... >.> i dont really know coding all that well but im thinking its the " inst " . those are the only 3times ive used it so i dont see how it would work anyway... any help would be appreciated :)
    var inst (instance_place(x,y, ObjTransition));
    if (inst != noone)
    room_goto(inst.TargetRoom);

    • @masquerade0133
      @masquerade0133 4 года назад

      Managed to solve it? Cause Im stuck too :c

  • @nickspencer2207
    @nickspencer2207 5 лет назад

    The room transitions worked wonderfully, but once I added the fade effect, it stopped working! If anyone has had this problem and knows how to solve it, that'd be nice to hear. Thanks!

    • @nickspencer2207
      @nickspencer2207 5 лет назад

      I decided not to have the fade effect, and got rid of it, but for some reason, my character is invisible when I enter the next room. I can tell he's in the room, because the camera moves, and I can move back into the other room. I tried making another room to see if he'd be invisible if I move into that one. He was. However, if I move back into the starting room, he is visible again.

    • @christophhofer303
      @christophhofer303 5 лет назад

      @@nickspencer2207 check layers

    • @BabaDesBois
      @BabaDesBois 5 лет назад +1

      Did you turn your game object "visible"? If not, the draw events will not perform

    • @william1026
      @william1026 4 года назад

      @@nickspencer2207 try removing the draw event if you have any. Or, you can always to drawSelf() or something like that, cant really remember but make sure you either do one of those

  • @FerdinandCoding
    @FerdinandCoding 6 лет назад

    my character is stuck with the moving forward animation after doing the "case dir" switches

    • @FriendlyCosmonaut
      @FriendlyCosmonaut  6 лет назад

      I'd need to see your code, but one guess is - have you put "break" at the end of each case?

    • @FerdinandCoding
      @FerdinandCoding 6 лет назад

      don't worry i found out a way to get around it, and i'm pretty far into the tutorial now. thanks for replying :)

    • @FriendlyCosmonaut
      @FriendlyCosmonaut  6 лет назад

      Ah, awesome! Too easy :)

    • @gabrielerossi850
      @gabrielerossi850 4 года назад

      I am having the same error, do you remember how you fixed yours?

    • @FerdinandCoding
      @FerdinandCoding 4 года назад

      @@gabrielerossi850 sorry bro its been such a long time

  • @octaviangazell429
    @octaviangazell429 4 года назад

    Make sure to check your indenting/brackets!!! I messed mine up and it was confusing me for hours

  • @shelbymachado8712
    @shelbymachado8712 4 года назад

    just throwing it out there again, you rock so much.

  • @DavidWilsonJr
    @DavidWilsonJr 5 лет назад +1

    Have you ever considered turning this into a Udemy course? It's probably at the same level as most of the one's I've taken - maybe more so because I'm learning a lot! Thank you!

  • @TH3M4G1CM4Nx
    @TH3M4G1CM4Nx 4 года назад +1

    Thank you for another great tutorial!

  • @RavnusLock
    @RavnusLock Год назад

    I don´t know what is happening.. I've been following every step.. but almost anything works..
    I must be freaking stupid :(

  • @Suggo
    @Suggo 7 лет назад

    Is it alright to give you suggestions of what tutorials to do next? If so, would you be up for making a tutorial to a drawing program, something Mario Paint-esque?
    Things like the actual drawing, erasing, saving the images, etc.
    I noticed that tutorials for these kinds of games are very scarce.

    • @FriendlyCosmonaut
      @FriendlyCosmonaut  7 лет назад

      This is a very neat idea! Although I have to say I'm quite focused on this series at the moment. I'll file this idea away though.

    • @Suggo
      @Suggo 7 лет назад +1

      Thanks so much for even considering my idea. Your tutorials are one of the best I've seen. Keep it up!

  • @Greeny_Official
    @Greeny_Official 11 месяцев назад

    I really like your series, but in a bunch of videos and this one specifically a lot of the code doesn't work anymore.
    It would be amazing seeing you do a similair series, but up to date!

    • @roachant
      @roachant 3 месяца назад

      I’m having the same issue, this code no longer works unfortunately.

    • @e.elisha.a4663
      @e.elisha.a4663 Месяц назад

      Do you know what doesn’t work for you? Because everything works perfectly well for me

  • @AiguretDuren
    @AiguretDuren 6 лет назад +1

    Before starting the video, I saw a link to the unit circle: instant like.

    • @AiguretDuren
      @AiguretDuren 6 лет назад +1

      Finished the video: enduring like.

  • @marklakan774
    @marklakan774 5 лет назад

    thank you so much for these videos! they've been a great help!
    Though I ran into a problem with my transitions as it seems that when I collide with a transition object, it works the first time but if I repeat the collision with the transition object it will place me in the room I am currently in. It'll do this as many time as there are rooms in between my current room and the roomTarget (ex: I have 5 rooms set up, current room is 2nd in the list and roomTarget is 3rd. It'll reload me back in the 2nd room every time I hit the transition object after the first time five times, as if going through all my rooms before landing on the right room)
    I'm fairly new to programming and GML in general so I'm not too sure what I did wrong or how to fix this issue? If anyone can offer some advice that would be a real help, thank you!
    (also I do have a room0 set up with my meta objects with room_goto_next(); being the first thing in my create event)
    EDIT: after a lot of head scratching and looking over my code, it wasn't a problem with the code actually lol
    all my rooms were marked "persistent" when they shouldn't have been WHOOPS

  • @strongbullgamer4003
    @strongbullgamer4003 2 года назад

    I made a major boo boo! I made a bunch of rooms right away and viewed them..this erased everything all folders and instances Now rm_1 and Background are blank! ;(
    Idk if I lost it all? I never saved. I shut the game down, I deleted the rooms. I played the game all blank! Do I need to re-do days of work now? Redo all my layers and place things back in or what!
    Be extremely careful when making new rooms people!!

    • @strongbullgamer4003
      @strongbullgamer4003 2 года назад

      I ended up just re-placing every level, instance, collision..all that! :). @FreindlyCosmonaut.

  • @fierorecensione5828
    @fierorecensione5828 Год назад

    top video!!!

  • @ambergamingde
    @ambergamingde 5 лет назад

    Little Question... hope someone can help me with that... after implementing the switch for facing in the player object my character doesnt animate correctly... up and down works fine but left to right doesnt work anymore, she's still moving but wont show the animation for left/right movement... here's my code for that:
    Oh and btw love your Tutorials very much

    • @ambergamingde
      @ambergamingde 5 лет назад

      Nevermind... i put "if" instead of "else if" in the step event of the character :D

  • @princepixel1
    @princepixel1 5 лет назад +12

    possible fix for anyone as dumb as me: make sure you actually placed the game object in your starting room! i forgot to do this lol

    • @athemulu
      @athemulu 4 года назад +4

      And to make sure rm_0 is on the top... LOL

    • @hoenif
      @hoenif 4 года назад +3

      than make sure you add background in rm_house ... LOL

    • @athemulu
      @athemulu 4 года назад +2

      @@hoenif I REMEMBER WHEN I DID THAT OMG I WAS SO CONFUSED

    • @lexfezler9466
      @lexfezler9466 4 года назад +1

      bless you...

  • @Bitcoin-in-a-nutshell
    @Bitcoin-in-a-nutshell 5 лет назад +1

    I had the problem that the teleport did not teleport me into the house but to the teleport point outside the house. Then I realized that the teleporter from outside has teleported right into the teleporter inside. And the inside teleporter kicks me back outside. Omfg 2h of Brainfuck. Hate my life.

  • @lamb1010
    @lamb1010 5 лет назад

    So the code isn't working for me plz help:
    Step Event (oPlayer):
    var inst = instance_place(x,y,oTransition);
    if (inst != noone){
    with (oGame){

    spawnRoom = inst.targetRoom;

    doTransition = true;
    }
    }
    Draw GUI(oGame):
    if(doTransition){
    //Handle Black Fade/Room Transition
    if (room != spawnRoom){
    blackAlpha += 0.1;
    if (blackAlpha >= 1){ room_goto (spawnRoom) }
    } else {
    blackAlpha -= 0.1;
    if (blackAlpha

  • @verohenestroza7179
    @verohenestroza7179 11 месяцев назад

    to anyone getting stuck in the transitions, I deleted my target room and recreated it and suddenly it worked :)
    my advise is try with one room first before creating your whole village just in case you run into an issue

  • @mysteryguy2526
    @mysteryguy2526 7 лет назад

    Hello, can you give me a hand please :D I´m having problem with mooving to 2nd room after finishing fade effect.
    In player/step/objects when I change
    var inst = instance_place (x, y, obj_transition);
    if (inst != noone) {
    room_goto(inst.targetRoom);
    }
    to
    var inst = instance_place (x, y, obj_transition);
    if (inst != noone) {
    with (game) {
    spawnRoom = inst.targetRoom;
    doTransition = true;
    }
    }
    is the point when I can´t move to another room. Im not getting any errors I can walk trough transition object how long I want. I followed everything in the video 3times :D and still not working

    • @FriendlyCosmonaut
      @FriendlyCosmonaut  7 лет назад

      Well you also need the code for actually doing the transition in the *game* object. Everything is set up, but the "doTransition" code might have a problem in it, so have a look at that - or post it here so I can have a look :)

    • @mysteryguy2526
      @mysteryguy2526 7 лет назад

      project file: goo.gl/aa9hoH
      I guess it will be easier than from screenshots. I did everything as you showed until 22:00. If you figure out, please let me know what I did wrong because I spent hours and got nothing :D //doTransition is set to false in obj_game/create event

    • @FriendlyCosmonaut
      @FriendlyCosmonaut  7 лет назад +1

      Oh goodness sorry for the delay - I've found the bug! I've stumbled across this one a couple times before, you'll probably laugh when you read this:
      So the problem is that the game object was not "visible". This means that its draw events will NOT be run - which of course, means the room transition code wasn't running. So just tick "visible" in the object editor and everything will work fine :)

    • @mysteryguy2526
      @mysteryguy2526 7 лет назад

      Haha, no worries I´ve been working on sprites since then :D
      Damn it :D I´ve been playing with visibility on obj_transition, but not on the actual game objective :D Thank you so much for problem solving :)

    • @marlonortiz3841
      @marlonortiz3841 6 лет назад

      I am having the same problem, but not even checking the object to visible solves it :/ Remade the game object copying the code exactly as you did, but nothing works. Help Cosmonaut!

  • @Dragon10x10
    @Dragon10x10 4 года назад +1

    Du skal væra på kjøkkenet å få det ut få det ut! Men mennene tar seg av vaffelkake buisnissen

  • @azzzanadra
    @azzzanadra 3 года назад

    i can't get the player to look the way i want them, but i guess that is a problem with me using a different animation code.

  • @brandonsaiz75
    @brandonsaiz75 6 лет назад +2

    Heehee. I got 30 minutes in and was trying to figure out what the hell I did wrong. Just needed to unpause :)

  • @slumpcat6352
    @slumpcat6352 7 лет назад

    FC your tutorials on textboxes and room transitions are amazing and have really helped me, but I've hit a brick wall in my project at changing the direction the player faces after room transitions :(
    Long story short I set up my animations in the player object's step event and in the creation event I set his initial direction to down, but now every time I change rooms and my player object is created it runs that little bit of code and he looks down, but I can't get rid of it because I need to tell the game where to face my player when I start the game D:
    If anyone can help me I would be really grateful.

    • @FriendlyCosmonaut
      @FriendlyCosmonaut  7 лет назад

      Hmm that's a little odd - that create event for the player should be running BEFORE we change its direction. Unfortunately this one's a bit hard to guess, so I may have to see your code to know what's going on. Could you send me some screenshots of the code pertaining to changing the player's direction, or just the whole project file, to friendlycosmonaut@gmail.com?

    • @slumpcat6352
      @slumpcat6352 7 лет назад +2

      Thank you so much for offering to help me but I ended up figuring it out after some messing around! I'll write out my solution here just in case anyone has the same problem I did:
      I basically just ticked the "persistent" box on my player object so that the initial direction is set when he's created (down) but is then changed to either left, right, up or down depending on which key is pressed, so when I transition through rooms that variable remains the same so if I walk off screen to the right I appear FACING right when I enter the next screen. I realize that I'm a bit limited in that I can't make my character face 90 degrees to the side after a room transition but that doesn't really affect my current project too much.
      Anyways thank you so much for these awesome tutorials FC, you're awesome!

  • @100stopnicelsjusza
    @100stopnicelsjusza 7 лет назад +2

    And another one! :)

  • @azzzanadra
    @azzzanadra 3 года назад

    that alpha tip.
    thank you!

  • @spiderdlh9905
    @spiderdlh9905 4 года назад

    You can use && instead of and. Great video by the way.

  • @Duran8998
    @Duran8998 5 лет назад

    GMS Trial can only have 2 max tile sets. :(

    • @brandonwroblewski6401
      @brandonwroblewski6401 5 лет назад

      look up the browser version of Photoshop and just put all the images into one image. Make sure the background stays transparent and you save it as the right file. It takes a bit of fiddling afterwords to realign all the tiles if you already have some made, but hey it's free!

  • @m0zzy71
    @m0zzy71 7 лет назад

    👍🏻

  • @eviz7768
    @eviz7768 4 года назад

    12:03

  • @clasherclan9222
    @clasherclan9222 3 года назад

    "Should be a quick video"
    *2nd longest video so far*

  • @yatta4339
    @yatta4339 3 года назад +1

    for some reason when i implement the room transition effect it stops it from working?

  • @frogman1
    @frogman1 6 лет назад

    hmmmmm i've been following along, but i didn't move everything to a separate "game" object because i didn't want transitions, so i kept everything in the player object. so in the Room Start event i've got "if (spawnroom == -1) exit;
    playerobject.x = inst.targetX; playerobject.y = inst.targetY;" which seems to work, but when i exit the room to come back to the previous one, it still spawns me in the original spawn point (ie not the inst.targetX/Y). any ideas?

  • @TheScotty103
    @TheScotty103 4 года назад

    I'm sure I have written up the code the same way, but I walk through the transition object and don't move tot he next room, any help please?

    • @harrisonlewis3786
      @harrisonlewis3786 4 года назад +1

      I had the same problem and fixed it by duplicating rm_farm rather than making a new room.