Collisions and mouse clicking

This forum is currently in read-only mode.
From the Asset Store
Total customisation of the input! You can combine inputs from all peripherals. Make your game accessible for everyone!
  • 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.

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

    You could temporarily enable collisions when you click:

    +On mouse left click:
    --- ememy: set collision to per pixel
       +mouse is over enemy:
       --- do stuff
       +always:
       ---ememy: set collision to none

    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.

  • I'm using the RTS behavior's "Move To Object" where the Object is the picked player.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • 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.

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