Windows Game Maker Studio 2 instance_create function

Discussion in 'Programming' started by Vesk, Dec 14, 2016.

  1. Vesk

    Vesk Member

    Joined:
    Dec 13, 2016
    Posts:
    9
    I recently got Game Maker Studio 2 Beta and I imported a game from gms 1.4. The problem is that the new gms doesn't recognize the instance_create. It wouldn't be a problem in older gm versions because you could use d&d and gml at the same time. But in gms 2 you can't. The function is essential for my game, so is there any alternative and if anyone from yoyo games reads this please consider adding the function.
     
  2. CloseRange

    CloseRange Member

    Joined:
    Jul 2, 2016
    Posts:
    813
    i think the replacement is instance_create_depth with an added variable in the () being a depth value.
     
  3. Vesk

    Vesk Member

    Joined:
    Dec 13, 2016
    Posts:
    9
    thanks a lot!
     
  4. Lemth

    Lemth Member

    Joined:
    Oct 7, 2016
    Posts:
    79
    instance_create_depth and instance_create_layer are the replacements.

    I would look into both and consider which is more useful to your project.
     
  5. ztvmark

    ztvmark Guest

    Resuelto - Solved

    Code:
    //Crear un objeto player e importarlo al room
    
    //Add Event Create
    disparos_blue_laser = 0;                    //Variable iniciada para evitar errores
    segundos_entre_disparos_blue_laser = 0.5;    //Segundos que habra entre disparos aqui medio segundo
    
    //Tiempo que habra entre disparos ya calculado
    tiempo_disparos_blue_laser = 30*segundos_entre_disparos_blue_laser;
    
    
    //Add Event Alarm0
    disparos_blue_laser++;
    
    
    //Add Event Step
    // If Key Down     //Si presiona la tecla de espaciado
    var l1A5E3514_0;
    l1A5E3514_0 = keyboard_check(vk_space);
    if (l1A5E3514_0)
    {
        //Y si el contador de alarma es 0
        if(alarm[0] == -1) {
    
            //Le asigna a alarm[0] el valor de tiempo_disparos_blue_laser
            alarm[0]=tiempo_disparos_blue_laser;
    
            //Crea el disparo
            instance_create_layer(x+0, y+0, "Layer_player", obj_blue_laser);
        }
    }
    
     

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