help with switch statements

Discussion in 'Programming' started by confusedperson, Feb 10, 2018.

  1. I went along with a tutorial for unlocking levels which was made in 2013. hopefully not much has changed and I just made a mistake on my behalf however the error reads:

    Variable obj_levelsystem.level(100007, -2147483648) not set before reading it.
    at gml_Object_obj_levelsystem_Create_0 (line 4) - case 0:

    and my coding for the create event is:

    image_speed = 0;
    case 0:
    image_index = 0;

    case 1:
    image_index = 1;

    case 2:{
    image_index = 2;

    I am very new to game maker and I hope I can continue in the future with your help. thank you in advance.
  2. Simon Gust

    Simon Gust Member

    Nov 15, 2016
    How does your object know what "level" is suposed to be? You haven't set it anywhere.
    confusedperson likes this.
  3. Niels

    Niels Member

    Jun 22, 2016
    Your "level" variable controls your switch, and it seems like you haven't initialized that variable before the switch.
    confusedperson likes this.

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice