Advertisement
Help Keep Boards Alive. Support us by going ad free today. See here: https://subscriptions.boards.ie/.
If we do not hit our goal we will be forced to close the site.

Current status: https://keepboardsalive.com/

Annual subs are best for most impact. If you are still undecided on going Ad Free - you can also donate using the Paypal Donate option. All contribution helps. Thank you.
https://www.boards.ie/group/1878-subscribers-forum

Private Group for paid up members of Boards.ie. Join the club.

GameMaker script newb question

  • 17-09-2013 11:30PM
    #1
    Registered Users, Registered Users 2 Posts: 3,831 ✭✭✭


    Hey folks,
    I'm making an endless runner with GameMaker.
    Can anyone help me to get some basic spawning working?

    I have an object at the right of the screen that emits one enemy object so far.
    Eventually I will need to have several different types of enemies spawning from the right, out of view and scrolling past the screen.

    I have a destroy object the height of the screen to the left so anything that touches it is dealt with.I know theres another way, I just haven't found it yet.
    I'm not using xviews.Just a standard room with scrolling background/foreground and player stuck in the middle with a jump action.

    Heres an event I created for the spawner object.
    ///spawner
    var pop;
    pop = 1;
    
    if instance_exists(obj_enemy1) 
    {
        pop = 0;
    }
    else if !instance_exists(obj_enemy1) 
    {
        pop = 1;
        instance_create(x,y,obj_enemy1);
    }
    

    It creates one enemy ok.
    I am trying now to get it to create more than one, preferably on a timer or depending on some other condition.

    Does this code run evey frame/step?
    If so, what did I miss?
    I had thought this would reset the var/bool "pop" to 1/true at the end and rinse repeat the process of spawning if pop = 1

    Maybe in the if statement I need a && pop = 1 ???



    Also If anyone has a link to a site with a list of handy functions for coding GML I would appreciate it.
    I keep finding bits and pieces for different types of games. Nothing so far that is teaching me the basics of GML.
    Tried an example project for an endless runner and a good deal of it is a mix of code and drag and drop :(

    Finally any other handy scripts or code I can use for this endless runner, would be very much appreciated.
    I have till next week to finish it, so I am getting frustrated trying to get the basics of gamemaker in a hurry.
    Unity seems easier in that all the code is done and used through the editor.
    Gamemaker tutorials are a mix of drag and drop and code,...to me I find it a bit confusing, I would nearly rather it all code at this stage!


Comments

Advertisement