Moving a ball to random instances?

0 favourites
  • 4 posts
From the Asset Store
Random Maze Generator with Door & Key System - tutorial capx
  • Hi,

    I have 3 instances of football players and 1 ball on the pitch.

    1. On start, the ball have to move to one random instance of a player

    2. On collision with one player, the ball should move to a random instance of another player.

    My Problem is: How can I target the two players without the ball?

    I need some kind of synthax or path notation wich allows me to adress random instances, like:

    on collision:

         set angle toward position: player.random (instancevariable 1 or 2)

    (and a solution that only a player without ball get the pass)

    I had a hard time with the manual and tutorials and it would be great to get a hint here?

  • Don't know what you are saying

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Give the players a boolean variable HasBall

    when the ball is near the player set it to true, when the ball isn't near the player set it to false.

    when the ball collides with the player have the system pick an instance of the player with hasball is false and set the balls direction towards it.

  • ...thanks a lot LittleStain, I will try it!

    4932004: it's easy, 3 players passing and receiving the ball. Random is for the view of the opponent, like in a real game, he don't know were the ball goes... See it as a small part of a much more complex football match (I mean real football, like we will see in Brazil this summer, only with foot and with a real ball, not an egg... :-)))

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