Moving one instance relative to another?

  • TL;DR: How do I set the position of an object in relation to another instance of the same object, how do I distinguish them in the action?

    In my game, the player character is composed by several objects. Some of them look identical but behave differently. Right now, each part of the character is an individual object, but some of these object share identical sprites, and it would be better to make them all just different instances of the same object.

    For example, right now the body's X coordinate is calculated like this:

    Body1.X = (Body2.X + Back.X)/2-10

    Where Body1 and Body2 are instances of the same object. Should I just keep it as separate objects with the same sprite or is there another way?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Have you tried the Pin behavior? when it comes to positioning, it's very handy (pretty much removing the need to worry about any positioning at all). You just position your sprite in the layout view, pin them, and there you go.

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