Best way to make a falling ceiling trap?

0 favourites
  • 3 posts
From the Asset Store
Best car suspension with spring effect and very cool terrain generation.
  • Hi!

    Classic trap, the ceiling that falls to the ground and then goes up to stomp over and over again. Problem is that I can't seem to be able to get the colissions perfectly right. They are getting the desired Y point or the colission too late.

    The sprite's speed is not incredibly high, by any means. Maybe there's a better behaviour for this, less problematic?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Add a boolean variable (isFalling) to your ceiling.

    Add platform behavior to it.

    isFalling = true: set platform enable

    Ceiling on landed: set isFalling to false

    isFalling = false: set Ceiling.Y = self.Y - 2

    If Ceiling.Y <=0: set isFalling to true

  • Thanks. The moment I posted, the idea of adding the platform behaviour came to me. It works nicely now. Changing the gravity angle also creates a wall trap, so I'm happy with this solution :)

    Thanks!

    EDIT: Another problem raised up. When using the platform behaviour on several instances of an object, there's a problem I can't solve:

    "Platform on landed - then the code", BUT, it's not a per-instance condition. It only considers the landing ok when every instance of the object is touching the ground. If I use the "For Each" loop, it tells me that a trigger can't be a subevent in a loop and it kinda crashes.

    It seems like "platform on landed" doesn't work the same way as "on collision". Problem is, as I said originally, collisions are not working well in this particular case.

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