How do I make objects in a family act differently from a differing instance variable?

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

    I am trying to make a project where you have spaceships with a set range of movement.

    All the ships are part of a family called "units", and inherit an instance variable for range from it.

    In the code, i compare distance from its starting position.

    As long as it stays within the parameters, it moves freely to wherever you clicked.

    Here is a screenshot.

    The issue that keeps occurring is that when I tweaked the code, either all the ships stayed in the smallest range, or only one of each object type under the family stays in its own range.

    I suspect that the issue is related to the family that all the ships are under "Units".

    any suggestions on how to fix this?

    Thank you all so much

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Hello, I found the problem. I went back to the code where I used the "for each" loop, and found that I simply had inconsistent instance variables. two ships had 0 set for range, and the other three ships worked as they should have. I just had to set the variables and it worked as intended.

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