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
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
instead of making a new if statement for every new NPC
also here is a picture
Code:
NPC 1 = new NPC(x, y, hp, ect...)
Code:
if(playerRect.intersects(NPCRect))
also here is a picture
