How do you handle multiple NPC types

0 favourites
  • 3 posts
From the Asset Store
Be quick and choose the right answer for the shown equation.
  • I would like to know how others handle multiple NPC types. I started off with only one NPC, type A. When I was ready to start adding additional NPC types; obviously, I wasn’t going to just duplicate the lines for each individual NPC type. So I used local variables to configure and style the NPCs depending on their type, which works ok. I guess the only disadvantage in doing it this way is having to create separate sprites for equipment and apparel (img1). I thought creating different animations for each type would also be painful and confusing.

    The other thing I did was creating spawn points for the positioning of the NPCs with the aim of reducing the potential lag and perhaps eventually randomizing positions and types (img 2). The NPCs will spawn when Player X <= to each NPC spawn point. This way I don't have 30 NPC running at once all over the level.

    Anyways, how do you handle multiple NPC types in your games?

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • My methods are quite clunky, and could probably do with (another) refactor, but a combination of families, instance variables and folders of animations on a single sprite is broadly how I am working with multiple NPC types in my project. Though my NPCs will be pre-placed in the layout so I don't need to worry about spawning.

    This tutorial (again, probably in need of a refactor) talks through how I've done it. It's not the best thing in the world, and I will probably go back and experiment a bit more with timers and other bits later down the line. And it's probably not exactly what you're looking for, but perhaps parts of it could be adapted for what you want?

  • Awesome, thank you Laura!

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)