How do I get angle beteen two instances of one object

0 favourites
  • 2 posts
From the Asset Store
112 High-Quality destruction sounds for videogames
  • Hi,

    i'm trying to get an angle between two sprite instaces of object Player (sprite). And since it is a local PVP multiplayer game I have 2 instances of Object Player, so getting angle would look like this "angle(Player.x,Player.y,Player.x,Player.y)" which in this case means I won't get the correct angle, right?

    How do I distinguish between those two instances and get the correct angle between them? I would share the capx, but it is controlled with gamepads only.

    Thx in advance

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • angle(Player(0).x, Player(0).y, Player(1).x, Player(1).y)

    Or you add two temporary variables tempX, tempY, pick the first Player instance, set tempX=Player.X, tempY=Player.Y

    Then pick the second player instance and use angle(tempX, TempY, Player.x,Player.y)

    Or you can create a family with Player object, then you'll be able to pick Player and PlayerFamily in the same event and do angle(Player.x,Player.y, PlayerFamily.x, PlayerFamily.y)

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