Smilex's Recent Forum Activity

  • > You can go with the random() option, but the most common ( at least that I've seen in games ), is doing like most humans do, target the closest one.

    > To do this you could use pythagoras ( a^2 * b^2 = c^2 ), where a = object.X - target.X and b = object.Y - target.Y, do this to find the distance between all the targets ( on screen or whatever ) and check for which distance is the shortest. If some distances are equal, just take the first one or run the test again, considering the chances that something has moved.

    >

    > There might be a better way, but this idea popped into my head. Can't really consider it much though, as I am in class.

    >

    You can do that a bit easier with the Distance(x1,y1,x2,y2) expression.

    lol yeah, I guessed there was one of those around Just started using Construct last night, so havn't really got around it much

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • You can go with the random() option, but the most common ( at least that I've seen in games ), is doing like most humans do, target the closest one.

    To do this you could use pythagoras ( a^2 * b^2 = c^2 ), where a = object.X - target.X and b = object.Y - target.Y, do this to find the distance between all the targets ( on screen or whatever ) and check for which distance is the shortest. If some distances are equal, just take the first one or run the test again, considering the chances that something has moved.

    There might be a better way, but this idea popped into my head. Can't really consider it much though, as I am in class.

Smilex's avatar

Smilex

Member since 7 Jan, 2011

None one is following Smilex yet!

Trophy Case

  • 13-Year Club

Progress

13/44
How to earn trophies