How do I atack same object but other player?

0 favourites
  • 2 posts
From the Asset Store
Basic Rounded Vector Geometry Player Design with Glow for 3 player games
  • Hello, I'm having difficulty attacking objects that belong to different players.

    Thinking about offline, you could call it player1 and player2

    Thinking about multiplayer would be peerid...

    But how do I compare this to being able to attack enemies? I tried this from the link.

    onedrive.live.com/redir

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • You need to set some variable on the object to define what team it is on. Then, when targeting, check the instance variable to see if the object is a valid target. In the conditions you should do something like this:

    Pick Sprites in range.

    Sprite has peerid = enemy.peerid (or Sprite has peerid <> self.peerid)

    Pick closest Sprite.

    All these conditions need to be in a single action. That way, each following condition would filter the list. First you pick all sprites in range. Then keep only the sprites from the previous list that are enemies. Then choose the closest sprite from the previous list.

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