Game Maker Tutorial – Snake Game Part 1

[ad_1]
Brand new 2017 Game Maker Studio: 2 Course available right now

In this video we start by creating a very basic snake game with Game Maker. If you have any questions then be sure to leave a comment or contact me on twitter; realtutsgml. If you learned something then be sure to leave a like, comment, and favorite.

Outro Song:
Name: Spitfire (Kill the Noise Remix)
Artist: Porter Robinson
Youtube channel: /user/PorterRobinsonMusic
Website:
Facebook:

Have you ever wanted to create games? Have you ever gotten fed up with it being to difficult? Well now is the time to thank me and possibly subscribe because you have just found the channel for you! Game Maker Tutorials, Java Game Programming, Unity3D Tutorials, Batch, C++ and much much more! This is the channel for you, the one stop shop for an exploration of your hidden talent as a game developer. Unleash your potential and go wild with imagination when you finally figure out how to make any game you want!

Visit CodingMadeSimple for more exclusive tutorials and get the help you need to succeed as your very own indie game developer!

Follow me on twitter for exclusive content and interaction with me!

Game Maker Studio: Programming
Game Maker Studio: Tutorial
Java Programming
Game Programming
Game Tutorial
Programming Tutorial


Posted

in

by

Tags:

Comments

32 responses to “Game Maker Tutorial – Snake Game Part 1”

  1. Kisaragi Chrono Avatar

    My snake keeps extending even with the control with global.length in the room, What should I do? Pls reply I need to make this for class

  2. Charley Erd Avatar

    So I'm making a snake game for my friend, and here's my issue:I have an alarm that goes off depending on the length of the snake and it will then create an object based on the player's direction, great.I have a 'controller' object that is responding every frame to my input.The problem is that, say a player is trying to move up and left while moving right (when the speed of the snake becomes quicker it becomes an issue beyond cooldowns) , the second direction(left because it's moving into the snake, before head is created in 'up' direction) is being processed in the create statement instead of the first direction(up) ; therefore, my object now checks the following condition in the 'controller' obj step event INCORECTLY because the 'up' obj was never created(functionally I'm still moving right):
    obj_controller: step event://one of 4 conditions //global.dir 0-3 represent direction of creating the next snakeheadelse if (keyboard_check(vk_left) && (global.dir != 0) ){   //global.dir is recognized by the program as '3' for up
     global.dir = 1;
    }
    references:https://www.youtube.com/watch?v=8iU_V3iSJTk

  3. Charles Erd Avatar

    So is each head being recreated every 30 frames in a new location that's dependent on the previous head location? I'm not understanding how the alarm is causing the appearance of movement.

  4. Thomas Le Avatar

    = and == are WAY different if you do a single = sign in an if statement then you are assigning the variable BIG MISTAKE and will cause issues!

    currentID = 0 assigns the value of 0 to the variable currentID

    currentID == 0 is comparing currentID TO 0 so it returns true or false on whether they are equal.

    so if(currentID =0) will ALWAYS return true because you are setting the variable every time it will cause lots of problems if you are not expecting this behavior.

    Also, you do not need to do parentheses around equations on either side of the == because it is a comparison operator so it will complete both sides and compare them to each other. So

    if(1+1+5 == 1+3+3)

    will return true because it does 1+1+5 = 7 THEN 1+3+3=7 and compares 7 and 7. Putting parentheses around the equasions is fine but are completely unnecessary. The only time you need them is on more complicated formulas that require them to change the order of operations.

    I am watching your tutorial to give me a head start on a project I am working on (I am not familiar with GML that much) but some of the stuff you are teaching is completely wrong and bad to give that information to new programmers.

  5. Liam Borella Avatar

    At first I though this was going to be a good video.

    Then I saw your code structure.

    I HATE you.

  6. AHNG Avatar

    this just pops up
    _________________________________________
    ############################################################################################
    FATAL ERROR in
    action number 1
    of Alarm Event for alarm 0
    for object oSnake:

    global variable <unknown built-in variable>(-1610512735, -2147483648) not set before reading it.
    at gml_Object_oSnake_ObjAlarm0_1 (line 25) – }else if(currentID == (global.length – 1)){
    ############################################################################################

  7. Kyle Reese Avatar

    How to make the snake start with one block? When I put ´one´ in the global lenght it grows forever.

  8. Kyle Reese Avatar

    I fixed it. Now I have another problem: my snake reestart after I go up and left.

  9. Kyle Reese Avatar

    My snake doesn't grow to the number I put in the global.lenght. I always grown to 13 blocks.

  10. Omar De la Cruz Avatar

    My snake keeps moving to the right, if i press down it goes down one step but then it goes to the right again, help, please.

  11. Timothy Hargrove Avatar

    why does it say missing resource obj

  12. patrik männikkö Avatar

    I know nobody is probably not going to anserw but if somebody would anserw why do i keep getting this error
    ############################################################################################
    FATAL ERROR in
    action number 1
    of Alarm Event for alarm 0
    for object obj_head:

    Variable obj_head.currentID(100003, -2147483648) not set before reading it.
    at gml_Object_obj_head_ObjAlarm0_1 (line 1) – if (currentID == 0){
    ############################################################################################

  13. Pinkie Pie Avatar

    @RealTutsGML

    I'm not sure I understand why that if statament runs true in Alarm[0]. Since you are increasing the value of CurrentID within that if statement should the first if statement, "if(currentID == 0)" not run more than once? Yet I see multiple green boxes that continue to spawn despite this. Why is this?

  14. Syafique Azraei Avatar

    my snake sometimes disappears. WHY ARE YOU TOO FAST!!!!!

  15. Syafique Azraei Avatar

    Dammit why couldn't you take it slow. You just click the objects in he Resource Tree and now I don't know which object to have which events and what codes to type. CONFUSING! YOU ARE A BAD TEACHER!

  16. Katya Fedorovskaya Avatar

    PLEASE HELP omg what did i do?!!!
    _________________________________________
    ############################################################################################
    FATAL ERROR in
    action number 1
    of Alarm Event for alarm 0
    for object obj_snake:

    Push :: Execution Error – Variable Get -5.dir(100001, -2147483648)
    at gml_Object_obj_snake_ObjAlarm0_1 (line 10) – switch(global.dir){
    ############################################################################################

  17. FantasticA Avatar

    Well explained, but you were a little fast.

  18. CADEH50 Avatar

    How do you make a tail made from different segments, like large medium small?

  19. A King Avatar

    my snake just gets longer and longer not only by 2

  20. Patrick Kinnane Avatar

    _________________________________________
    FATAL ERROR in
    action number 1
    of Alarm Event for alarm 0
    for object obj_snake:

    COMPILATION ERROR in code action.
    Error in code at line 10:
       swtich (global.dir) {

    at position 1: Unknown function or script: swtich :: CreateFunctionToken

    Help!!!!!!!!!!!!!

  21. cros107 Avatar

    at 8 minutes my snake wouldn't move it would just sit there in 1 block

  22. YOLO GAMERS Avatar

    _________________________________________
    ############################################################################################
    FATAL ERROR in
    action number 1
    of Alarm Event for alarm 0
    for object obj_snake:

    Push :: Execution Error – Variable Get -5.dir(100001, -2147483648)
     at gml_Object_obj_snake_ObjAlarm0_1 (line 12) –     case 0:
    ############################################################################################

  23. rock launcher Avatar

    what sofware is he using it's Java eclipes or what

  24. Barnabás Szegleti Avatar

    help me pls
    _________________________________________
    ############################################################################################
    FATAL ERROR in
    action number 1
    of Alarm Event for alarm 0
    for object oSnake:

    Push :: Execution Error – Variable Get -5.dir(100001, -2147483648)
     at gml_Object_oSnake_ObjAlarm0_1 (line 11) – case 0:
    ############################################################################################

  25. lejon draken Avatar

    currentID doesn't work on mac -.-

  26. CreaturesOrigins Avatar

    I feel like a lot of these old tutorials are just a waste of time because they just don't work with gm:s

  27. Esports Khiladi Avatar

    I am getting this error ,Don't know why…HELP!!!

    ############################################################################################
    FATAL ERROR in
    action number 1
    of Alarm Event for alarm 0
    for object oSnake:

    Push :: Execution Error – Variable Get -5.dir(100001, -1)
     at gml_Object_oSnake_Alarm_0 (line 6) – switch(global.dir)
    ############################################################################################

    I did all the coding as you did 3 times still getting this error 🙁 

  28. ITmasterfull Avatar

    too fast , you just clicking and writing .. :(( 

  29. Chit0 Avatar

    Too Fast!
    A Little bit slow Pls 🙂

  30. Jacob Smith Avatar

    No matter what I make the global.length it is always a continuous line. D:

Leave a Reply

Your email address will not be published. Required fields are marked *