[Request]Turn off collisions between some objects

Discussion and feedback on Construct 2

Post » Sun Jan 26, 2014 12:03 pm

Here's my really drawn out thoughts and ideas on this subject, as I have hit points where I have had problems dealing with this whole "turn on and off individual collision" thing.

So the problem is that if we are using a behaviour (such as platformer) that relies on another sprite having the "Solid" behaviour in order to be able to collide/stop/land on, we can't. Instance Variables (like @Thndr mentions), would honestly be the most AWESOME way to handle this, but we don't actually have the action avaliable to make a behaviour sprite act properly unless the target sprite has a Solid behaviour on it. So the current methods we have aren't good because:
1) Deactivating the Solid behaviour on the sprite, would mean all other behaviours that rely on the Solid platform will also be deactivated.
2) Deactivating the Platformer behaviours collision would mean that if they were to land on a Solid, or walk into a solid that they should be able to collide on whilst still being over the floor that should be deactivated, the result could end with the player being able to walk through obstacles they shouldn't be. (So for example, your within some lava that causes you to be deactivated of collisions since you don't have a powerup to walk on lava. Whilst you are in the lava and collide with a wall, you would go through that wall.).

If I were to implement 1 (seemingly) easy feature into C2 to help, that would be some form of "Treat as solid" action. "Treat as solid" would be available in all behaviours that interact with Solids (platformer, 8 direction, ect), and it could be called during a "Is Overlapping" event (or however collisions are usually called within the code of behaviours normally).
What this action would do, is simply make the behaviour behave as if it has just collided with a sprite that has a "Solid" behaviour applied to it, even though it doesn't have a solid behaviour...*mindblown*
So if we take the lava example,
The lava would NOT have a solid behaviour applied to it, and we could allow multiple platformer players that each have different states to determine whether they can walk on the lava. So the events to make ONLY players with the powerup able to walk on lava:

-"Player.WalkOnLava" = True
-On Collide "Player + Lava"
+ Player "Treat As Solid [Lava]"

This uses instance variables to see if they are allowed to walk on lava, and then detecting if they are on lava, then colliding with the lava, stopping the player from falling through it, whilst any other players that have that variable set to False, they would fall through it.
The only downside I can think of with this, is that if you would want to take advantage of this sort of mechanic, you would need to remove all "Solid" behaviours that exist in the sprites, and have to handle it manually in events.
Good idea?

tl;dr Add a new "Treat as Solid" action to behaviours that rely on collision with solids, so that we can make them collide with non-solid sprites as if they are solids.
Posts: 571
Reputation: 9,819

Post » Mon Apr 14, 2014 4:12 am

I'm bumping this.
My professional Royalty Free Music at Scirra Assets Store
Specs: i5 2500, 16gb of ram, gtx 770, win 7, Focusrite Scarlett 8i6, Mackie mr8mk2, Alesis 320, browsing the net on chrome.
Posts: 1,985
Reputation: 20,099


Return to Construct 2 General

Who is online

Users browsing this forum: No registered users and 17 guests