How do I Make Multiple Companions

  • So I have been using the example here to try and figure out how to make multiple companions that have the same behavior. The problem I am running into is when I clone, or create more of the fairy object, they all float to the same spot. Its like they are not setting themselves as their own x and y positions.

    So the fairys are scattered throughout the layout, and I only want them to start following when they come within a certain distance of the player. I figured that part out by changing the greater than sign to less than. I still have the problem though, that all the fairies congregate at the same spot on the layout when it loads, even if I change the call to set xPos to fairy.X (fairy2, fairy3, and so on) instead of self.X in all instances it asks for self.

    What do I have to do or am I doing wrong to get each of them to stay put where they are placed on the layout until the player comes close to them?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • In the example you are using the variables are global..

    All the fairies will have the same target, for they all use the same target-variables..

    Giving the fairies instance variables and setting them for each would be a good start in solving a your issue..

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