How do I make Physics Immovable "act like" JumpThru in Platformer ?

0 favourites
  • 7 posts
From the Asset Store
10 Retro songs ideal for platformers or farming games
  • I use Physics catapult template

    try to make the main character (Piggy) which is a physics can "push out immovable" when it hit from bottom of immovable object, just like JumpThru solid object in Plaformer..

    I try to make hidden object to check the collision and set the Physics behavior enabled/disable. Which is not wise to implemented in game, it cause to much hidden object, also in certain condition when the piggy doesnt reach "set enable" it make the piggy still fall.

    Is there any better way to do this ?

    dropbox.com/s/kin4a3mz01iff91/PhysicsJumpThru.c3p

  • You can check the vector Y of Physic like this:

    I have tested and it works well.

  • Hi Mave.. thanks for the advice

    It work actually.. but now I face new problem, other physics object also affected.

    If i put other physics object on the top, it will fall because the boxes no longer immovable to hold the object..

    I should find another solution instead of enable/disable the physics behavior on boxes

  • Try Construct 3

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

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

    + Pig: Physics Y velocity < 0

    + System: Trigger once

    -> Pig: Disable Physics collisions with Box1

    + System: Else

    + Pig: Physics Y velocity ≥ 0

    + System: Trigger once

    -> Pig: Enable Physics collisions with Box1

    You could also put any platform with jump-thru in a family and use the family instead of Box1.

    Example:

    drive.google.com/uc

  • Hi Asmodean.. thankyou so much.. it works! Awesome !

    the "disable/enable collision with.." is magic :D

    Anyway.. I want to understand it more about what "System Trigger once" do here ?

    Is that to prevent system keep checking the velocity ?

    So.. once Pig velocity.Y reach the requirement will trigger once Disable/enable collision, and never check the velocity.Y anymore althought the physics still not in sleep mode ?

    Or it actually keep checking all the time when the pig physics not in sleep mode, and stop checking once it reach sleep mode (velocity X and velocity Y = 0 ) ? I assume the velocity.Y always changing since the piggy in moving mode (impulse)

  • Trigger once isn't really necessary here. It prevents that this event is tested every tick. If the velocity is for example 'greater than 0', this event is triggered once and the action will be executed. Only if the velocity changed back from another value 'greater than 0' to 'greater than 0', it will be triggered again. Otherwise it will be ignored. The same for 'less than 0'.

    Those both events will work the same without trigger once, but will be tested every tick. So it's a teeny tiny bit performance save. You also don't need the else ,but is there for the same reason.

    From the manual:

    Trigger once while true

    Turn an ordinary event (which is tested every tick) in to a trigger. For example, if an event plays a sound when lives equals 0, normally this event runs every tick. This plays about 60 sounds a second and would sound pretty bad. Adding Trigger once while true after the other conditions makes the event run just once when it first becomes true. This makes the previous example only play a sound once the first time your lives reaches 0. It must be the last condition in an event.

  • I see.. thankyou very much, Asmodean.

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