switch statement

  1. 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()...
  2. Slothagami

    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"...
  3. H

    GMS 2 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 =...
  4. S

    GMS 2 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, }...
  5. 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...
  6. Jochum

    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...
  7. 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()...
  8. 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...
  9. 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...
  10. 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