GameMaker - Pause Menu Tutorial (Method 1)

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

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

  • @EpicChadGaming
    @EpicChadGaming 10 лет назад +8

    answering the question before it shows up, if your room is bigger than your view you want to use view_xview and view_yview instead of room_width and room_height.
    Great tut

    • @LinkFaroreHylian
      @LinkFaroreHylian 10 лет назад

      Brilliant, thank you so much

    • @Zei33
      @Zei33 10 лет назад

      lol

    • @DezzarTac
      @DezzarTac 9 лет назад

      [resolved]
      When I replace those two, it didn't work. Could you elaborate? (the following writes the text in the top left (no black rectangle))
      -----------------------------------------------------------------
      if (global.pause)
      {
      draw_set_color(c_black);
      draw_set_alpha(0.5);
      draw_rectangle(0,0,view_xview ,view_yview ,0);
      draw_set_halign(fa_center);
      draw_set_font(fnt_prn3);
      draw_set_color(c_yellow);
      draw_set_alpha(1);
      draw_text(view_xview /2,view_yview /2,"Connection Paused");
      draw_set_color(c_black);
      }

    • @EpicChadGaming
      @EpicChadGaming 9 лет назад

      there is nothing wrong with that right there. you have the view turned on right? Also you are using view 0? your code worked fine for me

    • @DezzarTac
      @DezzarTac 9 лет назад

      eviltowely
      Gotta go facepalm, brb. Another object was controlling the view[0] using code.
      Thanks for the response, and enjoy your day!

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

    I understand that this video is very old, but I still found it useful and I'm sure others do as well. A quick tip for the issue regarding alarms, instead of using GM:S' built in alarms you can make your own by running setting a global variable (I use global.timer_x where x is a number to separate unique timers) to the value you would set your alarm and just have the global variable decrease by 1 in the step event of the object its related to and have your code run once it hits 0, that way when you exit out of the objects step event it also pauses you alarms/timers. (You can also use local variables if the alarm only affects the one object it's attached to, but I would recommend setting global variables in you game initialization just to make things easier to work with and having all your eggs in one basket kind of thing)

  • @Visionsofmortality
    @Visionsofmortality 10 лет назад +3

    Thanks for this, it is a very simple but useful insight. I'm looking forward for better implementations (maybe more complete/straightforward) and a possible actual menu on pausing. Love your videos, keep up the good work as always.

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

    Out of all the methods I've tried, this one just seems to work the best, which is convenient because of how straight forward it is. Alarms can be a problem, but making "custom" or kind of "homemade" alarms in step events is an easy solution, and is still simpler than other methods I've used.

  • @MattVidPro
    @MattVidPro 9 лет назад +2

    how would I make it follow my obj_camera?

    • @sakexz
      @sakexz 9 лет назад

      +MattVideo Productions i wanna know too!

    • @sakexz
      @sakexz 9 лет назад

      +MattVideo Productions FOUND IT! draw_text(view_xview[view_current] + view_wview[view_current] / 2, view_yview[view_current] + view_hview[view_current] / 2, "PAUSED");

    • @bBewnie
      @bBewnie 9 лет назад +1

      +Jimm Well you found it from someone else just saying but thanks for commenting anyway i saw yours first

    • @sakexz
      @sakexz 9 лет назад

      although i didnt find it anywhere, i just tinkered with it and after like 30min i got a hold of it ^^

    • @bBewnie
      @bBewnie 9 лет назад

      ok then... if ya say so
      *cough**cough* Steve Vautour 8 months ago
      @ Destro700
      Is your room bigger than your view? Use something like this:
      draw_text(view_xview[view_current] + view_wview[view_current] / 2, view_yview[view_current] + view_hview[view_current] / 2, "PAUSED");;des i found it !
      ahem

  • @liggiorgio
    @liggiorgio 10 лет назад +1

    That's really a nice idea to create a pause system in a game. On the other hand, working this way involves dealing with controls checking, objects movement, collision checking and on all in the step event; btw I think I'll redefine my games with this new knowledge...

  • @PackSciences
    @PackSciences 10 лет назад

    Nice pause work :)
    If you want to manage your loads, exit the game in the pause menu, I recommend creating objects like obj_exit or obj_load on obj_pause's step event in if (global.pause == 1) {instance.create(yourstuffs)} and then add a left click event to use a load script (as shown on Shaun in early tutorials) or exit the game.
    This way to pause a menu is a bit tricking the computer because in fact in just freeze ennemies and player but it works well on little games so thank you Shaun.

  • @ZachDaChampion
    @ZachDaChampion 8 лет назад +11

    Quick tip: for toggling 1/0 or true/false use "var = 1 - var"

    • @loan181
      @loan181 8 лет назад +4

      Or simply "var = not var;"

    • @AJman14
      @AJman14 8 лет назад +12

      Or even more simple "var =! var"

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

    Alarm system is just an array.
    When starting pause copy all `alarm` values to `my_paused_alarms` and set every alarm to -1, when resuming copy back from `my_paused_alarms` to `alarm`. Or don't bother with alarm system at all, decrement counters in step event, you will get better naming. 3 days later variable `next_boss_phase_counter` makes much more sense than `alarm[5]`.

  • @Destro7000
    @Destro7000 10 лет назад

    5.24 after doing this, my screen darkened but no text showed up (even after quickly adding a font set as Arial) why is my text not showing up? Also 8:00 I added [if (global.pause) exit;] (without brackets) to my obj_Enemy's step event and it didn't stop it at all. The background dimming action works though!

  • @jimjimson4261
    @jimjimson4261 10 лет назад

    Thank you for making this video! I've been looking for something like this for a long time.

  • @tanuguitar1
    @tanuguitar1 10 лет назад +1

    how you do this for the view window? I try this out and it prints the inputs in the middle of the room but the view is still focus where the player is

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

      Hey I have the same problem, did you end up finding a solution?

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

    The tutorial ddi not worked to me. Is there some functions or variable to be pre-determinated before thsi video?

  • @FunGrack
    @FunGrack 10 лет назад +17

    It's possible with that system to have not errors with timers.
    In every frame if pause you easily can add one frame to all your timers.
    example:
    if (global.pause)
    {
    alarm[0] ++ or +=1
    exit;
    }
    and that for every Timer :D

    • @FunGrack
      @FunGrack 10 лет назад +1

      ***** Ok sorry,
      Yes I can imagine.
      By the way you are making cool Videos.😊

    • @matthewlemmel3256
      @matthewlemmel3256 10 лет назад

      ***** Yes and no I think, I just created this same pause system for my game weeks ago and did the += 1 thing on all timers and I ran into that issue of pausing at the worst frame. But you should be able to circumvent that issue easily by saying "if alarm[] < 0 alarm[] +=1" this way it only pauses the alarms if its active.

    • @alexisottina5756
      @alexisottina5756 10 лет назад

      ***** So smart ! :D

    • @Zei33
      @Zei33 10 лет назад +2

      ***** Okay come on, we're programmers here:
      if global.pause && alarm[0] > 0{alarm[0] += 1;}
      If an alarm has already hit -1, then it's essentially executing the code, assuming someone paused on that point (for this example let's say something would be created when the alarm went off), the object would be created and should then in turn notice that the pause variable was set to true. This would then pause that object. Let's be realistic, it's almost impossible for a player who isn't looking very very hard to spot that one step difference.
      And now that I read ahead it seems someone already beat me to it. Matthew Lemmel

    • @CrazyNinjaMike
      @CrazyNinjaMike 10 лет назад

      ***** I use a very similar pause system approach in my game. To solve the alarm issue, at the moment the game gets paused, I looped through every pausable object, stored all of their alarm values into an array, as well as the instance's id. Then set their alarm's value to 0 to deactivate the alarm. Then when I unpause the game, I simply looped through the array and restored the alarm's value. It has worked very well. I do the exact same thing for every object's gravity, hspeed, vspeed, image_speed and path_speed

  • @prankworkstudios8939
    @prankworkstudios8939 8 лет назад

    What button did you press at 2:08 to space from here to here in the code?

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

    this tutorial was perfect great job m8

  • @SyntekkTeam
    @SyntekkTeam 10 лет назад

    Nice video. I look forward to seeing the next tutorial in the series.
    I've got a few comments.
    1. You might have just been doing it your way to keep the code easier to understand but at 2:00 you could have done global.pause= 1-global.pause, or if you were using booleans (and in this case you are because of the way game maker variables work) global.pause=! global.pause is also valid
    2. I've used this technique before and I've come across an issue with parenting. So let's say the parent has if(global.pause) exit; in the step event and I have a step event in the child using event_inherited() to manually inherit the step from the parent. When event_inherited() is called the event of the parent is exited but the rest of the code in the child step event still runs.
    I guess the solution is to copy the code over to everything, but it's frustrating that parenting can't be used.

  • @matthewsly681
    @matthewsly681 9 лет назад +2

    Whenever I use the pause feature the draw takes place below all of my other objects, so none of the characters are tinted grey and the pause text is often obsured by the level environment. :(
    Please help :P

  • @BabetteAppelman
    @BabetteAppelman 8 лет назад +2

    if i press pause, the overlay appears. But my object (with gravity) falls, how do i make it stop.
    Is there a code to put in extra?
    Thankyou so much for this video btw!!!

    • @TheArchitectOfDreams
      @TheArchitectOfDreams 8 лет назад

      Use a global variable to hold the gravity value, set your gravity for your "object" to zero (0) in your if-else for your pause, when the player presses escape again, set the gravity of your "object" to the global variable. I'd recommend making your own global variable for your gravity vs using the Game Maker predefined Gravity. Could cause problems.

    • @TekkoPvP
      @TekkoPvP 8 лет назад

      Welp. Use instance_deactivate_all(true); in your pause object when paused, and instance_activate_all(); when not paused.

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

      I have the same issue as sascha and that doesn't even work. How do I fix it?

  • @justinsaunders5504
    @justinsaunders5504 10 лет назад

    I have a problem, I don't have the movement or collision in the step event for my player, and I also don't have a step event for another object that changes sub-image every second (It does that automatically) and so the pause does not stop anything. Where would I put the code for stopping things? All of the movement and collisions are frag and drop.

  • @user-bv1tv9ef9y
    @user-bv1tv9ef9y 8 лет назад +1

    What if i have set some view,how i can set the pause text,score,hp etc. to be in the view?

    • @user-bv1tv9ef9y
      @user-bv1tv9ef9y 8 лет назад

      And how to menage it with alarms?

    • @jonatheringaming8369
      @jonatheringaming8369 8 лет назад +1

      Oh I got it from another comment! Hopefully this works! draw_text(view_xview + view_wport / 2 ,view_yview + view_hport / 2,"PAUSE") Also you probably want to add draw_set_halign(fa_center);
      draw_set_halign(fa_middle); so that its centered

    • @AJman14
      @AJman14 8 лет назад

      Your "draw_set_halign(fa_middle)" should be valign "draw_set_valign(fa_middle)"

  • @thebeluvdtrex
    @thebeluvdtrex 10 лет назад

    Question? Is it absolutely necessary to add a semicolon after every piece of code?
    I never added it before and my game is working just fine.

    • @OMGitsjustperfect
      @OMGitsjustperfect 10 лет назад +3

      not in gml, but in some other languages it is necessary. I would recommend making it a habbit.

    • @eathams
      @eathams 10 лет назад

      I know for sure it is in Java, not sure about others. As the person before me said, make it a habit.

    • @barfgameplay
      @barfgameplay 9 лет назад

      You should use it every time you define a variable or use a function. It's not needed after a code block like an if statement or loop, just like most programming languages. The game might work without the semicolons, but it might create errors, and you should add them anyway to avoid confusion.

  • @taylortindol52
    @taylortindol52 9 лет назад +2

    Anyone know how to fix the problem where if you pause, objects overlay the pause text?!?!?!

    • @JordanPool13
      @JordanPool13 9 лет назад +1

      +Taylor Tindol I've found 2 ways to do it.
      1. Since the default depth for your created text is 0, you can set all your other object's text to a number bigger than 0, that way all other objects will be underneath the text.
      2. Use the "with" statement to define the depth when you draw the text. So everything would look the same the way he had it, but on the draw text you would put
      with(draw_text(x, y, "Paused Game"))
      {
      depth = -100
      }
      "with" lets you define an object's characteristics when you create it.

    • @mercedis2000
      @mercedis2000 9 лет назад

      +Jordan Pool thanks bro ! :)

    • @AJman14
      @AJman14 8 лет назад

      It's easier to set the pause menu to a negative depth. -999 should do the trick ;)

    • @mercedis2000
      @mercedis2000 8 лет назад

      AJman14​ hahaha that eas 36 weeks ago man i already finished my game

    • @AJman14
      @AJman14 8 лет назад

      Well, anyone else reading the comments will see it, anyway

  • @_pure_4930
    @_pure_4930 8 лет назад

    In my game I have the money displayed at the top left corner of the screen. Now when I pause the game, that text displaying the money moves left and goes off-screen a little. Help Please?

  • @BlastTheBat
    @BlastTheBat 9 лет назад

    So moving objects return to the same velocity and direction as when unpaused?

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

    My Character does not use step events it uses key presses and key releases. How do I get the animation to stop

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

      I don't know if it still matters or not, but you can set image speed to 0 when paused.
      Doing that stops the animation completely, and setting it to 1 resumes the animations.

  •  8 лет назад

    Would this work if we make an object called obj_pausable which only has a step event with the line if (global.paused) exit; and have every object that we want to be pausable be children of this object??

    • @AJman14
      @AJman14 8 лет назад

      No, children won't pause. You have to put the statement in the child's code, as well.

    •  8 лет назад

      I thought that that children inherited every single behavior from their parents

  • @jaredbauer1656
    @jaredbauer1656 9 лет назад

    My problem is that the majority of my enemies code is not in a step event and my if (global.pause) exit isn't working on the codes outside of the step event please help!

    • @har10210
      @har10210 9 лет назад

      Jared Bauer Try a d&d test variable in teh control section. I dont this with some of my work, just make the variable global.pause and the value true/false

  • @powergannon
    @powergannon 8 лет назад

    Is there a decent way to detect whether an instance is currently calling an alarm to execute or not? For an object I could create a variable that gets set to true when the alarm is called and sets to false when the alarm executes, and add ticks to the alarm if that variable is true; but I don't think that method would be very efficient.

  • @TheLordBeast
    @TheLordBeast 8 лет назад

    Does anyone know how to enable tool tips. I can't get any to come up and is making it difficult to learn gm. I looked in preferences but still not working

  • @benjamincastro3840
    @benjamincastro3840 9 лет назад

    how can you do the rectangle relative to your view
    i have tried
    draw_rectangle(view_current)
    but for some reason it says error
    help plzz

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

    This method messes up my sprites depth and it creates instances that I did not put in the scene! Gms2 here. Any help?

  • @Packerr
    @Packerr 10 лет назад +1

    hi Shaun I am having a problem with your enemies tutorial here is what the error says FATAL ERROR in
    action number 1
    of Step Event0
    for object obj_enemy:
    Push :: Execution Error - Variable Get -1.grav(100000, -1)
    at gml_Object_obj_enemy_StepNormalEvent_1 (line 2) - vsp += grav;
    please if you or anyone else can help me that would be great thanks

  • @jarnozondag6347
    @jarnozondag6347 8 лет назад

    is there any way to pause only one action instead of an whole event?

  • @mcgamesize8065
    @mcgamesize8065 8 лет назад

    ok i have a problem, everything works as it should be, but the text does not show on top of the walls, which means you cant so the text when there are wall objects in the way.

  • @e3102bete
    @e3102bete 10 лет назад

    is there a way to set up a script that just freezes everything when you are paused?

  • @GreakFTW
    @GreakFTW 10 лет назад

    For some reason my Draw event does not work.. I have not idea how it is suppose to work, but the script inside do not run.

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

    Why not make global.pause a bool? like just use global.pause = !global.pause to switch between on and off.

  • @LanTylr
    @LanTylr 9 лет назад

    My enemies still move when i put in if (global.pause) exit; any fixes?

    • @sakexz
      @sakexz 9 лет назад

      +LWT did you do it at the beginning of the step event of all the enemies?

    • @LanTylr
      @LanTylr 9 лет назад

      Jimm Yes

    • @sakexz
      @sakexz 9 лет назад

      then idk. i'd say you should either redo it all, or try the other method :)

    • @LanTylr
      @LanTylr 9 лет назад

      Jimm k thanks for trying to figure it out

    • @sakexz
      @sakexz 9 лет назад

      no worries

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

    For the alarm situation couldn't you just create your own alarm that ticks down every step event? This pauses the step event so that seems like it would make sense.

  • @matth6954
    @matth6954 10 лет назад

    So I am trying to use this pause strategy with a view. However, the rectangle always draws in the upper left corner of the room no matter where the view is. The code I am using in the draw event of the pause object is: draw_rectangle(view_xview[0],view_yview[0],view_wview[0],view_hview[0],0); Any suggestions?

    • @Leo7531
      @Leo7531 10 лет назад

      well it will keep drawing it in the top right because you set it there, you need to offset the location like view_xview[0] / 2 - 200 or view_yview[0] / 2 -200 or else it will keep drawing it at the top left
      try this, it may help:
      (view_xview[0]/2 -num,view_yview[0]/2 -num,view_xview[0]-num,view_yview[0]-num)

    • @MrStopTeme
      @MrStopTeme 10 лет назад

      Matthew Subrattie didn't work for me... should I change the "-num" to a number?

    • @Leo7531
      @Leo7531 10 лет назад

      MrStopTeme well yes of course

    • @MrStopTeme
      @MrStopTeme 10 лет назад

      Matthew Subrattie well, in that case, what number should I use?

    • @Leo7531
      @Leo7531 10 лет назад

      MrStopTeme well try a number until you get a result that suits eg. 200,200,250,250

  • @DrewFKADruid
    @DrewFKADruid 9 лет назад

    I'm a little stuck. I want my game to have the "System" typeface used as the font, but I can neither use that as a font nor add it into the game, it seems. Neither does it work with Terminal, which is similar. Any tips?

  • @JessicaClarke
    @JessicaClarke 9 лет назад +1

    Can you explain how to make a pause menu using views please?

  • @Tyler-dh8fb
    @Tyler-dh8fb 7 лет назад

    Hey Shaun, I was wondering something because I have come across a very strange problem. For some reason, when I press the escape key, nothing happens at all. I checked the code and everything and nothing happens. I was wondering why it was doing this.

    • @Tyler-dh8fb
      @Tyler-dh8fb 7 лет назад

      My code is as follows for the draw. It now works, but the Game Paused string appears in the top left corner and moves out of the screen. And the obj stops after my player is out of the same space as the object is in because it is a space shooter that keeps on moving.

  • @CyberpowerPCGUA3100aGaming
    @CyberpowerPCGUA3100aGaming 8 лет назад +1

    how you did font menu? plz help dude

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

    I have 2 questions towards this method:
    1. Is it possible to program the pause menu to dim the objects as well as a the background?
    2. When using views for your game (rather than using the full room) Is it possible to make the text that appears when paused to be centered onto that view?

  • @ub3rfr3nzy94
    @ub3rfr3nzy94 8 лет назад

    My view follows my character. I've looked trough the comments and used some of the code suggested but it doesn't do anything for me. The text is not centered on my view.

    • @santripta
      @santripta 8 лет назад +1

      Nikolaos Giannoulatos
      This (80%) works:
      draw_text(view_xview + view_wview/2, view_yview + view_view_hview/2, "Your text here")
      Yeah so just insert [] and mess around with the view_set_halign(fa_left/fa_center/fa_middle)
      probably fa_middle
      Hope this helped!

  • @ooootttiiu
    @ooootttiiu 9 лет назад

    I'm trying to make the background see through when you hit pause like in the vid but it keeps giving me a solid black background :/
    I used:
    draw_set_color(c_black);
    draw_set_alpha(0.5);
    draw_rectangle(0,0,room_width,room_height,0);
    draw_set_halign(fa_center);
    draw_set_font(font1);
    draw_set_color(c_white);
    draw_set_alpha(1);
    draw_set_color(c_black);
    Help?

    • @ooootttiiu
      @ooootttiiu 9 лет назад

      ooootttiiu
      nvm..

    • @sakexz
      @sakexz 9 лет назад

      +Pedro Mendes i found it ! draw_text(view_xview[view_current] + view_wview[view_current] / 2, view_yview[view_current] + view_hview[view_current] / 2, "PAUSED");

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

    The 2nd method is working a bit better for me than this one.
    What if an object that's moving, doesn't have a step event?
    I'm actually following your first game tutorial, and the obj_asteroid and a few others don't have step events. Even when they do, like obj_player, I plugged in the code and it's still moving at my command, nothing's paused. :/
    The only thing I don't like about method 2 is that it doesn't render anything. I want the player to be able to see the screen just before hitting the escape button to UNPAUSE the game, in case they were about to run into something. Want it to be a fair game, you know. Any help on that?

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

    I'm using a system for movement of my enemies like this: move_towards_point(obj_player.x,obj_player.y,6); however, when I pause the game they keep moving, every other step event pauses exactly like it should but it seems that this line of code keeps running, any help?

  • @Autisnic1
    @Autisnic1 8 лет назад

    I have a thing of text in my room and when i go in the escape menu it moves the text out of the room... Any fix?

    • @AJman14
      @AJman14 8 лет назад

      Set that text to have a font. If it's not set, it'll grab the first font used, in this case, your Pause screen font.

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

    is there anything that has to change now? It isn't working for me and I've tried looking in the comments but haven't seen anything that works but haven't found anything. Can anyone help out?

  • @kzazen
    @kzazen 9 лет назад

    Is it possible to stop the motion of my ship and my asteroids if I follow your asteroids tutorial and continue their original motion when I resume?

  • @zstorytime
    @zstorytime 9 лет назад

    So I'm using this for a TDS engine and the if (global.pause) exit; is working for the player except one problem, I have no idea how to make the bullet stop moving

    • @har10210
      @har10210 9 лет назад

      Evan LeClair Hi, I could help you with that. Im making a tds game too and just added the pause menu. This is what I done -
      if (global.pause){
      speed = 0
      }else{
      speed = 48
      }
      adjust the speed obviously to what you have.
      Hope this helps.

    • @zstorytime
      @zstorytime 9 лет назад

      I'll try it, thanks!

  • @TheArchitectOfDreams
    @TheArchitectOfDreams 8 лет назад

    If you have a problem with it not showing up, more than likely it's behind your room, instead of setting the depth of your pause object to zero, set it less than zero like -1, or -999, in case you have multiple layers on your room.

  • @karacontessa758
    @karacontessa758 10 лет назад

    soooooooo, anyone else having problems. GM does not like "global.pause" anymore. if i just use "pause", it says a value cannot be assigned to a constant

  • @captainstar1013
    @captainstar1013 8 лет назад

    I nenes help, i uses the code but my game uses views to move around and the pause does not appear in the middle of the view

    • @captainstar1013
      @captainstar1013 8 лет назад

      *need

    • @santripta
      @santripta 8 лет назад

      Poliswag Jr.
      ThIs is better, but Essentially the same:
      draw_text(view_xview + view_wview/2, view_yview + view_view_hview/2, "Your text here")
      Yeah so just insert [] and mess around with the view_set_halign(fa_left/fa_center/fa_middle)
      probably fa_middle
      Hope this helped!

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

    Guys when I Press the Esc, game is shutting down how can I prevent that.I want to use Esc key for an action.

  • @MrBlaze3445
    @MrBlaze3445 10 лет назад

    can you create a video on using multiple save & load slots

  • @pebn
    @pebn 10 лет назад

    When i hold down esc the pausing just flashes. pls help ?

    • @Zei33
      @Zei33 10 лет назад

      Hard to say, did you put the code in the button_check event or the keyboard_check_pressed event? Also did you make sure not to write something like global.pause = !global.pause? Oh and do you set the variable to false anywhere that might be likely to cause it to flash lol

    • @pebn
      @pebn 10 лет назад

      Zei33 Thanks

    • @TheBranchan
      @TheBranchan 8 лет назад

      Make the even a release instead, the key press event is way too sensitive.

  • @JorgetePanete
    @JorgetePanete 10 лет назад

    what happens to the vid? i see black flickring screen

  • @CONTROLTHEYOUTH
    @CONTROLTHEYOUTH 10 лет назад +3

    Ugh. I hate my life. I worked all day on my game. Then I search up how to change the project name, and it said to rename the project file and the directory. So I did that, and now I can't open the project. I have to redo EVERYTHING.

    • @xDprinDx
      @xDprinDx 10 лет назад

      GameCentral Then if that happens then your gamemaker project was damaged

    • @Chuckerblack
      @Chuckerblack 9 лет назад

      You can try to create a new project and import every sprite, object, room ecc. of your game. I had the same problem and I resolved it.

    • @SydeLeaderRayOLD
      @SydeLeaderRayOLD 9 лет назад

      EverythingZelda That sucks.

    • @SonicXRage
      @SonicXRage 9 лет назад

      EverythingZelda It's late, but I had the same problem. Open any file and then open another project from File. Find the directory where your files are and then open the folder. Your game should be in there.

    • @igxdankengine3294
      @igxdankengine3294 9 лет назад

      +Pile of Sand just clik export again :)

  • @StudioRamenCat
    @StudioRamenCat 10 лет назад

    heh nice Just this morning I Fixed my Pause method utilizing your checkpoint tutorial this is pretty cool.

  • @csz4135
    @csz4135 10 лет назад

    ***** how can i fix the "out of memory" i literally tried all over on google and reinstalled my studio and still get the message please help me :(

    • @EpicChadGaming
      @EpicChadGaming 10 лет назад

      I fixed it by uninstalling gms, deleting the gamemaker folder in the appdata folder and in the registry, then reinstalling.

    • @csz4135
      @csz4135 10 лет назад

      ok ill try it asap thanks

    • @csz4135
      @csz4135 10 лет назад

      eviltowely where is Registry again i cant seem to find it

    • @AedxRedux
      @AedxRedux 10 лет назад

      Sebastian Zeballos Alt+R (Or Win+R on Windows 8/8.1), then type regedit and click 'OK'

    • @csz4135
      @csz4135 10 лет назад

      Ok thanks

  • @brendanperdue6778
    @brendanperdue6778 8 лет назад

    can you use color codes for the text color?

    • @calindroxx1818
      @calindroxx1818 8 лет назад

      What do you exactly mean by color codes? If you refer to hexadecimal codes, its pretty simple:
      You can create colors from their hexadecimal value using the "$" symbol.
      col = $983c95
      Where 98 is the blue component, 3c is the green component and 95 is the red component - The color would be purple.
      If you press F1 in GMS and search for the keywords "Colour And Blending" you can also read the whole chapter about that in the Help Section :)

    • @brendanperdue6778
      @brendanperdue6778 8 лет назад

      exactly what I was looking for, thanks!

  • @MrmeowerGaming
    @MrmeowerGaming 9 лет назад

    When I do it, my text wont go over the platforms and same with the rectangle.

    • @iamsleepy
      @iamsleepy 9 лет назад +2

      +MrmeowerGaming Set the depth of obj_pause to -99999. Just make that number higher than anything else so it draws it in front of everything.

    • @MrmeowerGaming
      @MrmeowerGaming 9 лет назад

      Thanks!

  • @horseygirl03
    @horseygirl03 10 лет назад

    Hey Shaun! I added some background music to my platformer and I can't figure out how to make the music pause aswell. I tried editing the code, I even tried making a new object for everything but I cant seem to figure it out. Thanks in advance :)

    • @Zei33
      @Zei33 10 лет назад

      I'm going to tell you right now, music is a bloody pain in Game Maker, also watch out for all the legacy functions.

    • @OMGitsjustperfect
      @OMGitsjustperfect 10 лет назад

      audio_pause_sound
      audio_resume_sound
      You need to work with bolean variables to make this work.(at least most of the time) And yes sounds is a pain in the ass.

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

    I've successfully created a menu which can close the program and start the game. also if you were to press ESC in the game, it would open the menu again. If i click start game it just respawns. Ive used the goto room next and goto room previous lines

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

    Does this method pause alarm ticks too?

  • @MrBlaze3445
    @MrBlaze3445 10 лет назад

    and it autosaves at checkpoints and level switches please

  • @M74031
    @M74031 10 лет назад

    can we get the project download???????

  • @Vereonis
    @Vereonis 8 лет назад +1

    This works great, but the 0.5 alpha is being applies to everything in my level, not just the drawn rectangle.

  • @iglimilaqi7976
    @iglimilaqi7976 10 лет назад

    how can i set that the pause followes the view plss help :D

  • @AkariEnderwolf
    @AkariEnderwolf 8 лет назад

    I might make my own "alarms" that are based around personal variables. just using a way I actually understand how to do it.
    I will probably make my "alarms" be a variable that ticks down to 0 each step, which would then make it so it does pause with this kind of system.

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

    Ty so much it's still work in gamemaker studio 2

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

    When I pause, an alarm of my player continue. How do I stop it?

  • @iseemeyouseeyou
    @iseemeyouseeyou 9 лет назад

    Great video as always:) I think it's worth noting though that GMS now requires brackets around strings for some odd reason so it should look something like this now: draw_text(x,y,string("Game Paused")); This was a source of some frustration for me before I figured it out so I thought I'd spare whoever reads this the headache in case they don't yet know that.

  • @Oddnerz
    @Oddnerz 9 лет назад

    I may sound dumb by asking this, but what language does game maker use?

    • @GameFreak7744
      @GameFreak7744 9 лет назад +1

      Less 'dumb', more 'lazy'. The answer is seriously 1 google search away.

    • @barfgameplay
      @barfgameplay 9 лет назад

      Sorry mate but indeed, that's a lazy question. But to answer it: It's called Game Maker Language (or GML for short). A simple name but exactly what it is. It's an extremely easy language to learn and use, as the syntax is very forgiving, and if you've ever programmed in any language; BASIC, C, PHP, Java or anything else, you can pretty much program GML.

  • @2012booklover
    @2012booklover 9 лет назад

    Brilliant tutorial! Although, I am running into a few problems. In my rooms I have two objects where I have drawn text (to display the score and the lives) and they have been created to sit in specific locations. When I press escape, these objects jump slightly to the left and it doesn't go back when I exit the pause menu...I don't know if any of that made sense, but if anyone could help me out that'd be great!! :D

  • @ItsNat21_
    @ItsNat21_ 8 лет назад

    can you make a video on how to make the pause as big as your veiw????

  • @b_a_c_k_t_r_a_c_k_._g_o_b_7504
    @b_a_c_k_t_r_a_c_k_._g_o_b_7504 8 лет назад

    doesn't work, I wrote everything down corrected it, nothing was wronge, and when I pressed it it crashed

  • @PierceKeaton
    @PierceKeaton 8 лет назад

    Lets say I added this to my Asteroid game from your series.
    It says "Game paused" but everything is still in motion. My ship moves(cannot be controlled while the game is paused, though ) and asteroids still move as well. However, my ship does not get destroyed when an asteroid touches. So it's somewhat satisfactory.

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

    Still works, thanks

  • @TheGrapeSquad
    @TheGrapeSquad 10 лет назад +1

    if (global.pause == 0);
    {
    global.pause = 1;
    }
    else
    {
    ERROR at line 5 pos 3: Unexpected symbol is expression
    What the fuck.
    It turns yellow so it recognises it .but It says that and wont let me start my game :L
    Help :S

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

      if (global.pause == 0)
      {
      global.pause = 1;
      }
      else
      {

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

    Project download: [Coming soon]
    We are on 2018...

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

    what if my view is smaller than my total room?

  • @bl00dbr0ther666
    @bl00dbr0ther666 10 лет назад

    ***** Hey, great video. I'd actually just been trying (and struggling lol) to add a pause system to my game. I'm now trying to create help text signs that, when the player is overlapping them, will show instructional text (i.e. how to move, this is an enemy, etc.) until the player stops overlapping the sign. However, using the method of displaying text you used in this tutorial, I can't seem to get the text to appear. Mind looking over this?
    In the sign's step event:
    if (place_meeting(x,y,obj_player))
    {
    draw_set_halign(fa_center);
    draw_set_font(fnt_menu);
    draw_set_color(c_white);
    draw_set_alpha(1);
    draw_text(room_width/2,room_height/2,"Press the left and right arrow keys to move the player.");
    }
    Thanks in advance to anyone that helps :)

    • @bl00dbr0ther666
      @bl00dbr0ther666 10 лет назад

      Whoops, aha no more late-night coding for me. I just realized I put it in the step event, not the draw event.

  • @haroldmulder9862
    @haroldmulder9862 9 лет назад

    you can put:
    if(global.pause = 1){
    alarm[alarm number] += 1;
    }
    inside your step event above the if statement this will instantly make your alarm go back up by one each time it goes down. easy fix for alarms that keep going.

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

    It freezes the game when I unpause I need help

  • @LinkFaroreHylian
    @LinkFaroreHylian 10 лет назад

    Shaun you should do a tutorial on a Highscore menu. There are a lot of tutorials but none explain things as well as you do in your videos.

  • @stijnkoornstra
    @stijnkoornstra 9 лет назад

    i did everything the video says me to do, but it doesn't enything.

  • @Brandon_519
    @Brandon_519 10 лет назад +1

    Does not work in 8.1

    • @CannibalMcpig111
      @CannibalMcpig111 10 лет назад

      wut..

    • @Brandon_519
      @Brandon_519 10 лет назад

      NoDillonTheHacker
      Doing exactly what he shows here causes your game to crash in Game Maker 8.1 when you try to run it.

    • @barfgameplay
      @barfgameplay 9 лет назад

      Windows 8 doesn't support some functions (like game_end) because of the way Windows 8 applications work. If you show me the error and line of code the error occurs, i can help you out finding alternatives.

    • @VioletIsOnTheNets
      @VioletIsOnTheNets 9 лет назад

      B r a n d o n That's because this is a tutorial for GameMaker Studio, not GameMaker 8.1

    • @TheLaserFinger
      @TheLaserFinger 9 лет назад

      Alpha Hedge Using GM 8.1 can assure you it works

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

    Now how to with gamepad?

  • @LucasJefrey
    @LucasJefrey 10 лет назад

    ***** i dont understand the end of your game Another Perspective, explain for me please?

  • @MainGameProduction
    @MainGameProduction 10 лет назад +2

    do enemy collision, with knockback :)

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

    It's not really a "menu". Just an overlay. A menu would have things you can select.

    • @autumn_breeze616
      @autumn_breeze616 8 лет назад

      It's a visual overlay sure, but you can have it set in the step event so that a variable changes when the player presses the up or down arrow key, resetting after rising above its set maximum. Pressing space in this mode would either bring you to a sub-menu or select the option (controlled by the previous variable I mentioned). You would then control the position of the arrow (on the screen) by drawing it at different set areas depending on the submenu and the variable. All of this would be controlled by a few simple lines of code in the step and draw events. Pretty simple, all you have to do is build off of this tutorial.

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

    You should add a parent obj to everything so it’s easy to pause everything

  • @happygmod5677
    @happygmod5677 9 лет назад

    Hey can u help make a game with me maybe?

  • @areallyboredindividual8766
    @areallyboredindividual8766 9 лет назад +1

    Push :: Execution Error - Variable Get -5.pause(100015, -2147483648)
    at gml_Object_obj_enemy_StepNormalEvent_1 (line 1) - if (global.pause) exit;

    • @bence1750
      @bence1750 8 лет назад

      You should write the if (global.pause == 0)... thing into press Event, not in the Create event. in the create event you should write *global.pause = 0;* I hope, that i have helped you out :)

  • @illdie314
    @illdie314 10 лет назад

    I wish I learned about the exit function 4 years ago when I started game maker.

    • @Zei33
      @Zei33 10 лет назад

      Agreed. I feel you man.