Conditional Solids

0 favourites
  • 15 posts
  • I have a question. I am working on a game and one of the mechanics that I want to implement is conditional solids. To explain what I mean, I will explain how they would be used. Your characters basic color is green; everything that is green in the level the player can interact with but not with anything else of another color, unless it is a color changing block, for this example it will be for pink. If the character hits this block, they change color to pink and then can interact with all the pink objects and not the green ones.

    I know I shouldn't just use a collision detection condition and I can't just make a floor object that works with this because the levels themselves rotate around so the level would have to be all floor objects, allowing the character to stick to walls.

    Any thoughts?

  • Why couldn't you set all same colored objects to a family, and have a family condition (new to r78) triggered in an event? Example.

    Make a Family "RED"

    Something happens to Set Family "RED" to 1

    If Player on contact with Family "RED"

    & Family "RED" = 1

    --> Do whatever...

    Why would this not work?

  • conditionalSolid.capx

    Will you be able to guess the trick?

  • Thanks you two. I hadn't tried the family variables yet because I started working on this in r77, which I couldn't see how it would work. Anyway, thanks Yann, that helped slightly, but can you explain exactly how that works, because I have no idea how the lerp() function is working on this or with all the changes in animation frame work with this. I also have a question if this should work if the layer is rotated as well?

  • OctaveEight

    It uses a frame with "no collision polygon" to ignore collisions.

    Although it doesn't work perfectly since C2 doesn't allow a frame to have no collision polygon. If you jump over the top-left spot of an "deactivated" platform the player collides with the tinny collision polygon, when you are expecting not.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • hehe yeah that works how he explained

    the lerp is just to set opacity according to animation frame

    if frame = 0 (with collision) opacity = 100

    if frame = 1 (with the collision trick) opacity = 50

    And it won't work with layer rotation as collision doesn't get rotated.

  • Well, I'll have to try it that way anyway or do it with a families method, but thanks anyway. It helped a lot :D

  • Maybe I'm missing something - couldn't you just set the solid enabled property to disabled?

  • Umm... I forgot you could do that :D Thanks Arima! :D That made it like 20 times less of a hassle :D

  • Heh I was going to suggest that too - maybe people miss that the Solid behavior actually adds a 'Set enabled' action you can use to enable or disable it :)

  • Ashley Yeah I almost posted it as a feature request a while ago, and then I was like "Wait a - IT'S ALREADY THERE!"

  • Oooooh I didn't know that :D

  • can we get that in the families? say a family consisted of all solids ...platform pieces. would be nice to disabling the solid trait family-wide, as opposed to piece by piece.

  • headpain: I believe as Solid is a behavior and families behaviors aren't implemented that you can't do that for now.

    It's merely a matter of weeks though.

  • i have this "solid" problem in my beat'n up game, to make "FAKE SOLID" (so the enemy can enter in the screen but not leave.) i use:

    PLAYER is overlaping TILED OBJECT


    PLAYER platform Set vetor force in X + 200

    So they can enter but, if they try leave the force push they back

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