How do I smoothly move a sprite up? (rising door)

  • I have a switch that triggers a door sprite to move up. But rather than just changing its position, I want it to take time to move. What would be the simplest way of doing it? .capx if it would be useful.

  • You can use Bullet behavior with deceleration, but bullet behavior is hard to control.

    Or you can install one of these great behaviors - MoveTo or LiteTween.

    You can also move sprites without any behaviors, try this for example:

    On every tick-> Set sprite Y -> Lerp(self.Y, 500, dt*2)

  • lerp() expression isn't quite applicable to what I want. I think bullet behavior is the easiest/most straightforward solution for me. Thanks!

    Bullet behavior is, indeed, hard to control: it only ever approximately moves the amount it typically "should". If I enable an object going 72 pixels/second, then disable it 1.0 seconds later, it only moves ~70 pixels. Works for my purposes however :)

  • Try Construct 3

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

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

    You don't need to mess with BULLET - you can do it simply using a small number and small pixel position logic:

    when X happens:

    and when DOOR.Y is less than [ the place up to which the door goes ]

    Every X seconds (use a small number for smooth movement, like 0.1 or 0.25)

    set DOOR.Y to Self.Y+1


    when DOOR.Y is equal or greater than [ the place up to which the door goes ]

    either bring the door back or stop it

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