Collisions and mouse clicking

For questions about using Classic.

Post » Tue Jun 19, 2012 5:51 am

So I'm trying to design a movement system using RTS behavior. The enemies are not very good at navigating around objects. What I mean is, if they are chasing the player, and the player is moving close to irregularly shaped walls, they will get stuck. I solved this problem by disabling collisions for the enemies and setting them to avoid wall objects. What this does is that although they will avoid walls, if they do get too close to an irregularly shaped wall edge, they will go through it. I know I'm not explaining this right but it works well and looks fine.

Problem is, if I disable collisions I can't click on them :( Is there some way for me to accomplish that?

Alternatively, is there a way to prevent enemies from getting stuck on irregularly shaped solid objects with collisions enabled? I tried messing around with the box size to no avail. Some way to maybe get them to slightly push off a solid object on collision?

I also tried to use the On collision with "Solid" and Is overlapping "Solid" and then use a Push out, since the walls are solid but that didn't work. The conditions never triggered even when the enemies were stuck, though I'm not sure why. The 'walls' are one gigantic sprite that covers the entire level, and the 'open' areas that enemies and players can walk on are transparencies in that sprite, if that has something to do with it.

Thanks!

EDIT: Just to clarify, it's not that the space for the enemies is tight. It's wide open. The only reason they get stuck is because I have them chase me around, and I drag them across protrusions on the irregularly shaped walls. Juryiel2012-06-19 06:19:06
B
11
S
2
G
3
Posts: 283
Reputation: 1,968

Post » Tue Jul 03, 2012 1:36 am

[qoute]Problem is, if I disable collisions I can't click on them :( Is there some way for me to accomplish that?[/quote]
You could temporarily enable collisions when you click:
[code]+On mouse left click:
--- ememy: set collision to per pixel
   +mouse is over enemy:
   --- do stuff
   +always:
   ---ememy: set collision to none[/code]

For the enemies getting stuck close to the walls how are you making the enemy chase the player? I imagine they wouldn't get stuck if you moved them with the rts behavior.
B
79
S
24
G
54
Posts: 4,743
Reputation: 40,749

Post » Tue Jul 03, 2012 2:45 am

I'm using the RTS behavior's "Move To Object" where the Object is the picked player.
B
11
S
2
G
3
Posts: 283
Reputation: 1,968

Post » Tue Jul 03, 2012 2:56 am

That's a neat idea though about clicking, I didn't think about it. I'll give it a try if I can't get the RTS behavior to behave correctly. Haven't worked on it in a while since I was stumped and have been working on a different part of the game.
B
11
S
2
G
3
Posts: 283
Reputation: 1,968


Return to Help & Support using Construct Classic

Who is online

Users browsing this forum: No registered users and 8 guests