Hi.
I'd like my enemies to have a behavior like this (sort of) :
[attachment=0:ij9t3kj4][/attachment:ij9t3kj4]
Let me know if it's not clear enough
I'm pretty sure I need some math (angles and stuff) to do this but I don't have any clue about how to do this. Plus I don't know math.
Any advice/idea ?
Give them the "Custom Movement" behavior with Set Angle towards position Player.X, Player.Y.
And you might want to combine that with:
System > Distance (Player.X, Player.Y, Enemy.X, Enemy.Y) <200
or something like it..
Hope this helps.
Develop games in your browser. Powerful, performant & highly capable.
Thank you for your reply. <img src="{SMILIES_PATH}/icon_e_smile.gif" alt=":)" title="Smile">
I managed to do exactly what I intended using two algorithms :
https://math.stackexchange.com/question ... d-distance to defines two very distant point related to the enemy's current angle
And http://devmag.org.za/2009/04/17/basic-c ... 2d-part-2/ to test the collision between a circle and the line defined by the previous two distant points.
[attachment=0:3jvkskso]surrounding.png[/attachment:3jvkskso]
You can try it here : http://canapin.com/construct/scarletland/01/ and use the arrows to move (and left click to shoot)
Since it may interest other people, I attach the commented .capx.
You'll also need the LiteTween behavior : behavior-litetween_t70700