Advice on How To Setup AI...

For questions about using Classic.

Post » Fri Apr 08, 2011 3:57 pm

So, I set up my engine and the mechanics are working fine (yay!) now, I need to figure out the best method for handling AI.

Just to be clear, I'm not asking how do I get my sprites to act as enemies, but the best structure for going about doing that.

And for an example of what would need to work...

I have a ship heading towards a planet. This ship has no reverse engines and it's purpose is to dock with said planet. So what to ship would need to do is turn off it's engines (so it won't be propelled into an incorrect heading) then rotate 180 degrees, and when it is 180 from it's original heading it needs to fire back up it engines to slow down.

I have all the math for how long this would take worked out (ReverseCalc).

So, essentially, it goes like this:
[code:1qlbl85a]If SHIP.REVERSECALC is greater than {DISTANCE TO TARGET}: Turn engines off & turn to SHIP.ANGLE-180

SHIP rotates...

Now that SHIP has rotated 180 degrees, turn engines back on[/code:1qlbl85a]

It seems pretty simple, but there will be other things such as if the ship DOES have reverse engines, if the ship is actually on course, and how to get back on course.

So, if this explains enough what would be the method to do this, or the materials to read up on?

Follow me on Twitter @evgLabs
Posts: 251
Reputation: 4,049

Return to Help & Support using Construct Classic

Who is online

Users browsing this forum: No registered users and 2 guests