Need some help setting up a basic Mob Spawner in my Java game :)

Discussion in 'Computer Programming, Emulation, and Game Modding' started by Delta517, May 5, 2013.

  1. Delta517

    Delta517 Its okay...Im a ninja ;)

    Nov 25, 2008
    Hi! :D So I'm currently working on my first game in java, and I'm trying to create a basic mob spawner in it :)

    What I have done so far, is that I created a If statement, in the Enemy class I made, that uses a Random number generator to check if it should spawn something (Im considering making it time based, since I want the game to get progressively harder). :)

    The problem is that for every mob it's supposed to create, I have to manually make a different object for it (Ex Enemy1, Enemy2....), which makes it really time consuming (and probably very CPU consuming). :(

    That's why I wondered if there is some other way to do this? :P Maybe storing them in arrays or something if thats possible :P Thanks in advance ;)
  2. Issac

    Issac I

    GBAtemp Patron
    Issac is a Patron of GBAtemp and is helping us stay independent!

    Our Patreon
    Apr 10, 2004
    My first thought would be to make enemy objects and store them in arrays, just like you say.
    Minox likes this.