Results 1 to 2 of 2
  1. #1
    Kridane is offline Member
    Join Date
    Feb 2012
    Posts
    1
    Rep Power
    0

    Default Spawning enemies for my game

    Let me start off by saying I'm really new to java I just started like a month ago,
    Here's my problem... I'm making a simple 2D platforming game, but i'm confused on how to get enemies spawning and or working.
    I just need the whole concept of how that would be done, I don't want to be spoon fed the actual code.
    Would I make a class for it and then every time I want a new enemy on screen i would do something like (if I had a class called "enemy") enemy = new enemy?
    Also how can I use an array to control their x and y locations?

    Any help is appreciated, thank you.

  2. #2
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    Eastern Florida
    Posts
    17,792
    Rep Power
    25

    Default Re: Spawning enemies for my game

    Having a class to control the location of each object is useful. The class would contain their x,y location.
    Their movement would depend on the game's logic.
    You could use an ArrayList to contain a list of all the currently alive objects.

Similar Threads

  1. JDBC Spawning and Never Closing
    By domeger in forum JDBC
    Replies: 2
    Last Post: 11-29-2011, 02:18 PM
  2. Replies: 1
    Last Post: 06-02-2011, 10:29 AM
  3. Replies: 2
    Last Post: 08-05-2010, 05:49 AM
  4. game code for any game
    By deathnote202 in forum Java Gaming
    Replies: 4
    Last Post: 06-10-2010, 09:06 AM
  5. Thread Spawning
    By ersachinjain in forum Networking
    Replies: 10
    Last Post: 05-24-2010, 10:21 PM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •