Collision detection with AI enemies

For questions about using Classic.

Post » Wed Aug 17, 2011 12:33 am

Yo!

Still trying to come up with a nice collision detection system for the little baddies that are running after my character, in a top view Link to the past style game.

I'm wondering if an 8-direction behavior could be overridden with events that would enter "fake" inputs. The collision detection works so nicely with that behavior.

Is there a way to replicate that quality of coll detection on another object like a potential enemy?

In my .cap I tried to recalculate the position of the enemy at every tick when colliding with a box but I have no idea how to get the actual angle of the surface my baddie is colliding with, so that the baddie would "rebounce" in the right angle.

You can see that my system works well with a vertical wall, but not at all with a horizontal wall.

http://dl.dropbox.com/u/38319441/CollisionTest.cap

Thanks a bunch!
B
4
S
2
G
2
Posts: 108
Reputation: 1,366

Post » Wed Aug 17, 2011 12:45 am

If you're going for top down, RTS is very good and easy to use. It finds the path automatically and collides with solid objects.

I use it for top-down AI and, in platforming games, flying AI. :)
B
26
S
7
G
5
Posts: 202
Reputation: 5,235

Post » Wed Aug 17, 2011 1:23 am



And it was right in my face all along...
Thanks a lot!

When I set Pathfinding to Off or Custom, he seems to got right through solid objects... hmmm.
B
4
S
2
G
2
Posts: 108
Reputation: 1,366

Post » Wed Aug 17, 2011 1:52 am

Indeed.
It is the way it is supposed to. Off turns the collision off, and custom requires you to set the action "Add pathfinding obstacle" for it to make a map of obstacles.

Source: Scirra wiki
A must read

Have fun :D
New to Construct ? Where to start

Image Image
Image Image

Please attach a capx to any help request or bug report !
Moderator
B
247
S
85
G
40
Posts: 6,998
Reputation: 57,791

Post » Wed Aug 17, 2011 2:39 am

Oh ok so you're saying RTS either goes through solid object or pathfinds its way around it. That'll have to do it's the best I've...

FOUND BETTER!

Custom movement
Every tick
Sprite Bouce off Box (friction 0,5)
Sprite Set speed: 100 toward Target

Thanks guys!
B
4
S
2
G
2
Posts: 108
Reputation: 1,366


Return to Help & Support using Construct Classic

Who is online

Users browsing this forum: No registered users and 1 guest