• Hey Guest! Ever feel like entering a Game Jam, but the time limit is always too much pressure? We get it... You lead a hectic life and dedicating 3 whole days to make a game just doesn't work for you! So, why not enter the GMC SLOW JAM? Take your time! Kick back and make your game over 4 months! Interested? Then just click here!

switch statement

  1. flyinian

    Upgrade system help

    I'm looking for ideas on how one could create a robust upgrade system that allows for multiple items to be selectable and each item has its own stats that can be individually upgraded. I have a system in the works but, I've hit a wall where each item is selected through a switch statement and...
  2. PlayLikePig

    GML Switch statement with multiple expressions [SOLVED]

    I am very new to GML, and the only language I've written in before this is c#. Now, in c# you can put multiple expressions(variables at the start) into a switch statement like this: switch ((bool1, bool2)) { case (true, true): break; case (true, false): break; case...
  3. J

    Switch Statement with Key_board_check_pressed not working.

    trying to do simple switch code, for some reason (key_board_check_pressed) does not work, but (keyboard_key) does. I want check_pressed over keyboard_key because it goes too fast. Trying to keep everything in the step event. Doesn't work vvv //Step Event switch (keyboard_check_pressed){...
  4. Wonsubon

    SOLVED Using functions in switch statements?

    Is it possible to use functions in a switch statement? I have an object that, when destroyed, will destroy another object with it, but there are multiple security camera objects and only one can exist at a time. if(instance_exists(obj_camera01)) instance_destroy()...
  5. S

    SOLVED Multiple expressions in switch statement?

    Can you do something like this? if so how? I will eventually have many commands like this and don't want to have 100+ if statement's if possible // Something like this: if keyboard_check_pressed(vk_enter) { switch keyboard_string { case "START" or "Start" or "start"...
  6. H

    GameMaker Switch statement using all cases

    Hello, I am trying to switch the costume of the player (ball) to corresponding wings costume when colliding with the wings object. For example _________________ Collision event: if global.costume = spr_ball sprite_index = spr_ball_wings if global.costume = spr_ball2 sprite_index =...
  7. S

    GameMaker Wrong switch statement

    Ok i have problem with this. My switch statement make fatal error at line 20 and in line 29 i think same issue.Please little help with this. //variables kspace = keyboard_check ( vk_space ) ; attackspeed = 3 ; dire = 0 ; //code for attack move enum dir { maxx, minn, }...
  8. Z

    Attacking while Jumping

    Dear Game Maker community I have been working a platformer game and been implementing an attack system. I have created a state machine to switch between Walking and attacking it works perfectly when pushing the Z button the character stops performs and does the attack animation and returns back...
  9. J

    Translate code, not working?

    Hi, I've tried to create a code for a game translation myself. Unfortunately, it's not working. The translation_counter is working but it's not getting the right translation to it. How can I fix this? //Create Code //Set Total Translations total_translations = 3; //Set translation counter...
  10. G

    [SOLVED] Need help at switch statement: Wont work

    Hey there guys, today I have a cool error, I made a Switch-Case Statement in a Script for choosing the Enemy, but every time, I get the last case (case 2: ). So, if my Variable for the Switch Statement is 0,1,3,4,5... I will get the Case 2 for sure. I was print te Variable with draw_text()...
  11. X

    Legacy GM [SOLVED] Trouble with switches

    I'm kind of new to switch statements and one of them is giving me trouble. My game involves accessing terminals, of which there are several kinds. I want a different menu to display depending on which kind of terminal is accessed. The problem is that accessing a terminal is not creating a menu...
  12. A

    GML How many cases can be in a Switch statement?

    Is there a built in limit, or a practical limit (causes slow down), to the number of cases that can be in a switch statement? does it matter where the switch statement is (like in a step event vs a draw event)? the player in my game has a complex set animations/states and gear you can see, and...
  13. D

    Legacy GM HELP! Changing Sprite Index based on Mouse Location

    Hey everyone! I'm trying to use the switch statement right now to change the direction my player is looking. This is what I have right now. Create Event: /// Variables move = 0 // 0 for stop and 1 for running attack = 0 // 0 for no attack 1 for attack floorValue =...
Top