How do I follow an object of the same type?

Not favoritedFavorited Favorited 0 favourites
  • 3 posts
From the Asset Store
Hand-painted tiles, objects, animated objects, and background to build a colorful Mayan civilization environment.
  • Hi,

    I am looking through the forums for this but the forum search gives me an error. I will try google search - there has to be something on this already...

    I have an npc that goes left 100 pixels and right 100 pixels in a patrol fashion. It is a mother.

    I have an npc, a little boy that patrols (I use a tick event to move them) with the mother. They are both separate sprite instances of the object "NPC". It is limited and it seems like the follow behavior would be less work and give me more functionality.

    The mother has npc.uid = 2207

    The boy has npc.uid = 2208

    Using the follow command (I'd like to get rid of my custom patrol that is timed to move with the mother) for its simplicity. Is there a way I can have one instance of the sprite npc follow another instance of the sprite npc?

    I am guessing not and I have to create different sprites altogether. The way my game is set up, I have a sprite NPC that has 100 animations which are different NPC animations. I don't have separate NPC sprite objects.

  • The way you've done this is a nightmare for picking instances but also not great for performance as all animations are on the same object. The best way is to create separate objects altogether as you mentioned. Objects that use similar things can be grouped with Families, for example mother and son object could appear in 'NPCs' Family but are also separate objects.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Thanks. It seems I need to outgrown my laziness and need do things the right way going forward. :-)

    Families makes sense. I was dabbling with them this morning - having avoided them a long time.

    I suspected this was going to happen some day.

    Thanks again.

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