• Log in or sign up for an account here: https://www.sythe.org/login

Generating NPCs like RuneScape?

Joined
Feb 4, 2011
Sythe Gold
0
Messages
869
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
landexplorerss.png
 
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?
 
duelarena.gg
Back
Top