How to make solids for specific sprites?

  • I have enemies and a player, and they both interact with solids (they don't go through them) because of the 8 direction movement behavior, but I want a barrier sprite that acts as a solid so the player can't go through until the objective variable is the same or greater than the barrier sprites objective variable.

    Initially I was going to do that just by saying -- If Objective<= barrier.objective ---> barrier>Solid>set disabled.

    BUUUUUUUT I need the enemies to be able to go through the barriers.

    I feel like the idea is simple enough that it doesn't need a capx example. But simplified I need a solid, 2 objects that interact with solids, but only one of them interacts with that specific solid.

  • Okay I would delete this post because I just figured out a way, but I want to keep it incase someone else has the same wondering//idea

    So what I did was On the collision of the player and the barrier, I set the vector Y to


    And same thing respectively for Vector X.

    What this does is changes the direction of movement, it kind of makes it more of a bouncy barrier rather than just solid, but it does the job really simply. the number 4 at the end was to ensure that it canceled out the movement of the player, Any number above 2 should work, the higher it is, the bouncier.

    For example if the number at the end is 2 instead of 4, and the vector is 50, then the vector will get set to -50.

    And if it's -50 the vector will get set to 50.

    Anything under 2 for the multiplier will only slow the player down.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Construct 3 has solid "Tags" to only collide with certain solids

  • I'm so comfortable with construct 2 that ive been really weary about making the switch, plus theres the monthly fee rather than the one already done payment.

  • you can do that in C2 by using physics instead of solids. however physics and platformer behavior /solids behavior if i remember correctly they don't work well together. so u have to dump one to use the other. but basically with physics u can disable collisions for specific objects.

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