Solid only for same object type

0 favourites
From the Asset Store
Change delay, create new lines, "backspace" the text
  • How do I make an 8-direction behavior sprite collide with its instances but not other 8-direction sprites? I'm talking about a scenario where player and the enemies are both controlled by an 8-directional behavior. Player should be able to walk through enemies (to prevent a ton of collision shenanigans), but enemies should collide with each other (so they won't overlap due to rather simplistic AI).

  • I am not at my computer to confirm this works but from memory this should be possible

    Event 1 - on player collision with enemy - player will have collision set to off or false

    Event 2 {invert} on player collision with enemy - Player will have collision set to true

    See if that works.

  • Alright, that worked, but it brought up another issue. Now my character can walk through all solid objects, walls etc. I tried enabling player's collision when colliding with the walls, but that didn't work. Now I can walk through walls whenever an enemy touches me while I'm against a wall.

  • Hasuak

    Hmm, try adding this:

    Event 1 - on player collision with enemy -> player will have collision set to off or false

    AND Player not colliding with wall

    Event 2 {invert} on player collision with enemy - Player will have collision set to true

    That won't fix the issue completely as it will stop the player from walking through if he's against the wall. Let me think about it some more

  • Hasuak Another thought would be to have a gap between the enemy and the wall. only allow the enemy to get within 10 pixels of the wall or whatever.

    OR Have an invisible tiled background that sticks out from the wall a little ways that way the player will not be too close to the wall while overlapping the enemy. Make the invisible wall a solid but allow the player to walk through it the same way as you allowed the player to walk through the enemy.

    Event 1:

    Player on collision with invisible wall -> turn off collisions for invisible wall.

    Event 2:

    on player collision with enemy -> player will have collision set to off or false

    Event 3:

    {invert} player not colliding with invisible wall -> turn on collisions for invisible wall.

    Event 4:

    {invert} on player collision with enemy - Player will have collision set to true

    Let me know how that goes.

  • That looks like it should work, but collision checks can't be inverted. I tried the overlapping check and overlapping with offset, but neither of those worked either.

    What a hassle for such a small thing. Why can't we just set collisions between objects seperately if needed?

  • Hasuak Here you go. Check starting at event 11. Seems to be working and not allowing the player to walk through walls.

  • I don't know if I'm doing something wrong, but your example doesn't work. I can't walk through enemies. Pretty odd since the event for disabling collision is there and it should work. At least the not being able to walk through walls part is working, heh.

  • bump

  • I'd like to know this as well, write fassFlash if it's solved

  • Hasuak

    fassFlash

    Try switching the collisions off for the enemy instead. I am not at a computer where I can update the CAPX. All the events that deal with the collisions for the player being turned off switch those with the enemy. That should work.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • bump

    This can't be such a hard thing to make. Currently my only problem is that if I use the Solid behavior on the enemies, they can push the player around and that's something I don't want. It glitches out easily if the enemies surround me and push me into a corner.

  • just an idea... I'm not even sure that 's a good idea

  • Hasuak

    fassFlash

    Try switching the collisions off for the enemy instead. I am not at a computer where I can update the CAPX. All the events that deal with the collisions for the player being turned off switch those with the enemy. That should work.

    That don't seem to work either. Also sorry, didn't notice your reply earlier. The problem is that the overlapping check doesn't work that way. The objects won't overlap at all during collision so the check becomes useless. I'm getting the feeling that this is something the devs have overlooked and is currently impossible to get working correctly.

    just an idea... I'm not even sure that 's a good idea

    Sorry, but I'm not using the Bullet behavior for enemy movement in my game so that won't work either, except only for special animations.

  • Hasuak korbaach there has to be a way to figure this out. We can get this working correctly.

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