How do I Make a sprite move to a point (on its own)?

1 favourites
  • 3 posts
From the Asset Store
Connect the dots in the correct order and draw happy animals!
  • I have a VERY simple process I'm trying to do, but I'm really struggling. I have a super simple prototype I'm building where a pillar constantly rises, and you have to shoot it to make it go back down for a moment, then it starts to rise again. Simple, right?

    I'm having a lot of trouble finding a tutorial on this. Every tutorial I find talks about "moving platforms", slaps on Sine on an sprite and calls it a day. I just need it to go up at a fixed rate, go down when hit, then continue going back up. Any assistance you could offer would be GREATLY appreciated. Thank you.

  • There are many ways to do this.

    The easiest is with Bullet and Timer behaviors. Enable the Bullet behavior on startup with angle of motion set to 270 degrees. When the pillar is hit, change the angle of motion to 90 and start a timer. On timer event change the angle of motion back to 270 degrees.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • If you add a variable t to the pillar then you could do something like this:

    On bullet collides with pillar
    — pillar: set t to 0.5
    
    Pillar: t<=0
    — pillar: set y to self.y-50*dt
    
    Pillar: t>0
    — pillar: subtract dt from t
    — pillar: set y to self.y+75*dt

    With that it will go up at 50 pixels per second. Once it gets hit it will go down at 75pixels per second for 0.5 seconds. You can change all the values.

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