0 Favourites

Moving a ball to random instances?

  • 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

  • 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.

  • Construct 3

    Buy Construct 3

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

    Buy Now Construct 3 users don't see these ads
  • ...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)
Similar Topics Posts Views Last Post
Unread hot topic
564 105,181
rexrainbow's avatar
rexrainbow
Unread hot topic
0 Favourites
Time to move forward?
110 9,560
GG-Works's avatar
GG-Works
Unread hot topic
0 Favourites
[Plugin] instance bank2
85 18,367
rexrainbow's avatar
rexrainbow