How do I make shape travel at an arc like this? (no physics)

0 favourites
  • 3 posts
From the Asset Store
Design for game, asset for game, game kit, UI design, completed design for game, mobile game
  • I figured the X component is fine. I only want the Y component to have that arc

    I am garbage at this

    dropbox.com/scl/fi/1fz1wgskcobehqiasxtn6/JUMP_BW_POINTS.c3p

    Tagged:

  • You can do it with the qarp() expression.

    x=lerp(ax, bx, t)

    y=qarp(ay, (ay+by)/2-400, by, t)

    where ax,ay and bx,by are the two endpoints and t is a variable that you'd gradually change from 0 to 1 and vise versa to go back.

    In the example I just set t to a triangle wave that ping pongs from 0 to 1 and back with abs((time/duration+1)%2-1) since it matches your example.

    alternately you could just do set t to clamp(self.t+dir*dt/duration, 0, 1) where dir is -1 or 1, and the clamp avoids overshoot. You could then compare if t is 0 or 1 to see where it's landed.

    dropbox.com/scl/fi/zxa5wnncpmhyrovadxia0/jumpArc.c3p

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • You can do it with the qarp() expression.

    x=lerp(ax, bx, t)

    y=qarp(ay, (ay+by)/2-400, by, t)

    where ax,ay and bx,by are the two endpoints and t is a variable that you'd gradually change from 0 to 1 and vise versa to go back.

    In the example I just set t to a triangle wave that ping pongs from 0 to 1 and back with abs((time/duration+1)%2-1) since it matches your example.

    alternately you could just do set t to clamp(self.t+dir*dt/duration, 0, 1) where dir is -1 or 1, and the clamp avoids overshoot. You could then compare if t is 0 or 1 to see where it's landed.

    https://www.dropbox.com/scl/fi/zxa5wnncpmhyrovadxia0/jumpArc.c3p?rlkey=5n5s9v0bqg8hxu8ctm2nxsqh8

    Oh man you're a life saver. I just never understood how to use qarp particularly what to enter in the last value.

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