Solid only for same object type

Get help using Construct 2

Post » Fri Oct 17, 2014 9:41 pm

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).
B
21
S
7
G
4
Posts: 231
Reputation: 3,470

Post » Fri Oct 17, 2014 9:51 pm

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.
B
13
S
5
G
1
Posts: 119
Reputation: 2,292

Post » Fri Oct 17, 2014 10:06 pm

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.
B
21
S
7
G
4
Posts: 231
Reputation: 3,470

Post » Fri Oct 17, 2014 10:15 pm

@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
B
13
S
5
G
1
Posts: 119
Reputation: 2,292

Post » Fri Oct 17, 2014 11:00 pm

@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.
B
13
S
5
G
1
Posts: 119
Reputation: 2,292

Post » Sat Oct 18, 2014 9:28 pm

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?
B
21
S
7
G
4
Posts: 231
Reputation: 3,470

Post » Sun Oct 19, 2014 4:35 pm

@Hasuak Here you go. Check starting at event 11. Seems to be working and not allowing the player to walk through walls.
You do not have the required permissions to view the files attached to this post.
B
13
S
5
G
1
Posts: 119
Reputation: 2,292

Post » Mon Oct 20, 2014 12:55 am

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.
B
21
S
7
G
4
Posts: 231
Reputation: 3,470

Post » Mon Oct 20, 2014 5:22 pm

bump
B
21
S
7
G
4
Posts: 231
Reputation: 3,470

Post » Mon Oct 20, 2014 5:36 pm

I'd like to know this as well, write @fassFlash if it's solved
HARMLESS SIGNATURE THAT IS VIEWED BY OTHERS AS OFFENSIVE AND CONTROVERSIAL
B
14
S
3
G
3
Posts: 356
Reputation: 4,377

Next

Return to How do I....?

Who is online

Users browsing this forum: camtray, Lancifer, marcoscodas and 10 guests