Topdown AI workaround help

This forum is currently in read-only mode.
  • 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

    Thank you for your time.

  • 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

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Sweet! But i still wonder why the cross is shown at the character, when it should be looped 1000 pixels forward..

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)