CAPXs for Platformer Hazards/Tools

0 favourites
  • 3 posts
From the Asset Store
Make your craft game come to life with this sounds :D
  • Hey guys.

    I tried making a "Pressure Plate" that triggers traps using these events:

    Player is overlapping Pressure_Plate | Pressure_Plate is set to Movable

    x Player is overlapping Pressure_Plate | Pressure_Plate is set to imMovable

    Pressure_Plate.current_position >= Pressure_Plate.starting_position + 10 | Trap is "activated"

    I also made a mediocre "Trampoline" with this event:

    Player on collision with Trampoline | -20 Y Impulse force on Player

    The problem is that it applies the Impulse whenever the player collides regardless of where it collides. If it collides from the bottom, the player is still flung upwards.

    While this works to a certain degree, I'm not satisfied with it.

    I'd like to create a pressure plate that sinks SLOWLY and SNAPS BACK INTO PLACE after a certain amount of time.

    Since we're talking about pressure plates, does anyone have CAPX examples of other hazards you'd normally see in platformers?

    -platforms that follow paths like in Super Mario World


    -Crumbling Bridges

    -Collapsing Blocks when player stands on them for a certain amount of time.

    -Trampolines that sink before applying Impulse force on player

    -Anything else

    Thank you to who ever provides examples.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • You can make your pressure plate sink slowly using LERP to position in on the downwards motion...

    Something like; lerp(a,b,x)

    [Set pressureplate.Y position] -> lerp(pressureplate.Y,desired.Y,1-0.9^dt)

    You can set the desired.Y position manually, or have an instance variable set at startup of layout to be pressureplate.y+10 or whatever, then reference the variable as the B component to the lerp formula. The X component can be changed for faster or slower reaction. 1-0.9^dt is pretty slow, but you can do like 0.99 for even slower.

    For your trampoline, you will need to do a Y comparison between the player and the trampoline to determine if the player is below or above the trampoline in order to apply the impulse in the correct direction;

    [Player collides with trampoline]

    [player.Y is greater than Trampoline.Y]

    --- Impulse down

    [Player collides with trampoline]

    [player.Y is less than Trampoline.Y]

    --- Impulse up

    You can make the trampoline "sink" by having a small animation of it "bending" - then apply the impulse when the animation frame reaches the desired one. In the above example pseudo-code, you would do "play animation XYZ from beginning" instead of "impulse (angle)" then make another event that triggers the impulse once the animation is at whatever frame you like.

    Hope this helps


  • ~Sol

    Thank you! I'll try those. Sorry for the late reply.

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