# Topdown AI workaround help

This forum is currently in read-only mode.
0 favourites
• 3 posts
From the Asset Store
Create your own adventure map with this easy to use asset pack.
• I've allready posted this problem in a thread in the uploads forum, but it seemed a little missplaced so i figured i'd repost it here.

What i'm trying to achieve is simply a remake of Ashleys Perfect topdown shooter AI, ( posted here; the third frame in the .cap) but without the badass math and in a way that normal people can understand.

I've figured out exactly how to do it, and i've programmed it as it should be. Now i have just one problem. It doesn't work. Why? I don't know. So have a look at this .cap and read the comments and then tell me what you think is the problem. I've checked it so many times now that i'm starting to think it's not my fault. Some things (like the cross showing on the same position as the player) really indicates that a bug is hiding somewhere, but it might as well be a stupid mistake.

http://www.mediafire.com/?jwurdaalaam

• ## Try Construct 3

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

Construct 3 users don't see these ads
• Firstly a quicker way to move an object forward 1 pixel is to use the new 'Move at angle' action: move 1 pixel at .angle will do the trick.

Secondly, the distance between the two objects is unlikely to ever be identical. Because you move in units of 1 pixel, the closest it might ever get is 100.5 and 100.7, for example. Distance() returns a floating point value which, due to rounding errors and all that, will very rarely satisfy equality.

Change it to "Greater or equal" and it works (but still kinda weirdly). Still, I've already implemented a 'LinearAim' expression in the next build which does the perfect aim maths for you, so you can do it with a non-iterative approach and without nuts and bolts maths

• Sweet! But i still wonder why the cross is shown at the character, when it should be looped 1000 pixels forward..