Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie
Hi there,
There is an issue with role permissions that is being worked on at the moment.
If you are having trouble with access or permissions on regional forums please post here to get access: https://www.boards.ie/discussion/2058365403/you-do-not-have-permission-for-that#latest

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