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
    OP

    Delta517 Its okay...Im a ninja ;)

    Member
    1,327
    35
    Nov 25, 2008
    Norway
    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

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

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