Generating NPCs like RuneScape?

Discussion in 'Programming General' started by Quadro, Aug 29, 2011.

Generating NPCs like RuneScape?
  1. Unread #1 - Aug 29, 2011 at 3:16 PM
  2. Quadro
    Joined:
    Feb 4, 2011
    Posts:
    869
    Referrals:
    0
    Sythe Gold:
    0

    Quadro Apprentice
    Banned

    Generating NPCs like RuneScape?

    Ok I'm making a 2D game and I'm kind of confused on how to generate NPCs like runescape does, because as of now I have to do like
    Code:
    NPC 1 = new NPC(x, y, hp, ect...)
    also I have to add the if(intersects) for the new NPC, I was just wondering if there was a way to assign the NPC class a rectangle inside it so I can just have one if statement in my Player class like
    Code:
    if(playerRect.intersects(NPCRect))
    instead of making a new if statement for every new NPC

    also here is a picture
    [​IMG]
     
  3. Unread #2 - Aug 30, 2011 at 1:41 PM
  4. wackywamba
    Joined:
    Jul 14, 2005
    Posts:
    1,358
    Referrals:
    0
    Sythe Gold:
    1

    wackywamba Guru

    Generating NPCs like RuneScape?

    I'm not too sure what you're asking, but why don't you just create an array or arraylist of NPCs and loop through them?
     
  5. Unread #3 - Aug 30, 2011 at 9:30 PM
  6. Quadro
    Joined:
    Feb 4, 2011
    Posts:
    869
    Referrals:
    0
    Sythe Gold:
    0

    Quadro Apprentice
    Banned

    Generating NPCs like RuneScape?

    Ah yah that's what I was thinking but I wasn't sure if I was correct
     
< Online Game - School project | Grouping List Items >

Users viewing this thread
1 guest


 
 
Adblock breaks this site