How would I control jumping arcs? LiteTween combining?

0 favourites
From the Asset Store
Supports keyboard, mouse and gamepads. Supports several gamepads at once.
  • Hey guys, I beg for your help.

    I want to control the arcs of my character jumps to mouse position (fake iso). I store values in fromPosXY (from SelfXY), toPosXY (from MouseXY) for the Shadow which moves linearly, and a Character, that has linked Character.X to Shadow.X, however Character.Y calc'ing is my struggling point.

    I've abandoned Lerp solution in favor of LiteTween, as it offers easy to control easings and durations, however I am failing miserably in trying to combine ascent and descent of my character into one arc. I want to sequence LiteTweens with easeOutQuad and easeOutBounce (easings.net). On MLB release I calculate intermediate target for zenith:

    LiteTween_U.targetX = (Shadow.X+Shadow.Target_X)/2; // iso not implemented yet
    LiteTween_U.targetY = (Shadow.Y+Shadow.Target_Y)/2-jumpHeigth;
    

    and "On LiteTween_U end" I Start LiteTween_D... In theory, should work, however, all I get is just sliding Shadow and Character, no jumps.

    Questions:

    1) Is LiteTween an appropriate solution for the case? Better alternatives?

    2) How to correctly set conditions for LiteTween? Should I use two separate LiteTween behaviours for upward and downward motion or would it be sane to combine them into one?

    3) How to query LiteTween.TargetY? the Text prints just TargetX.

    4) Tips/tricks, like, auxiliary objects to store up and end targets?

    Tuts/references are welcome too. Ty in advance.

  • Is this what you are trying to make?

    dropbox.com/s/x9qyn2ynmnr4j28/Arc_LT_Bullet.capx

    There may be an easier way to make an arc with just one bullet behavior, but I'm not that good at math.

  • Hi dop2000,

    Thank you for your response.

    Sorry, I was not able to open your CAPX, as it comes from a newer C2 277 version, while I have 227. As suggested here, I used a text editor to change the version entry, yet still having issues.

    Any way to see what have you made there?

    I try to make jumping player Character, and jump arcs are essential to convey game dimensions. See my Capx here.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I suggest you to update your C2 to R277 as it is much more optimized than your version...

    I tried to open your CAPX but Google drive asked me for permission

  • Thanks hugone,

    I've changed access permissions, plz have a look once again.

  • Here you have an example... but please try to update... if not takes longer time to help you

    I made it all in global variables so can be seen whole idea in one screenshot... if you got the idea then can include in variable instances and play with tweens etc

  • I seen your files and see there is two new ones...

    was helpful? is what you need?

    really try to update the example post by dop2000 its great as it shows you how to make it with tween or bullet, and in bullet he made a smart way of bounce... worth to see it

  • Hugone,

    I think I managed to recreate your screenshot in C2, however it still acts erratically, will dig into it tomorrow.

  • nailHammers r227 is over 4 years old! Why can't you download and install the latest version?

  • dop2000 Thanks, I saw your LT and Bullet example, and unfortunately it is not what I meant. You have a flat 2D world, where player determines highest point of each jump/motion vector, however I am looking into faking an isometric world, where player lands on mouse click position - I was trying to make skewed jump trajectories.

    Thank you for sharing your file anyway - it is educating to observe how more experienced users do things.

  • Hugone,

    I think I managed to recreate your screenshot in C2, however it still acts erratically, will dig into it tomorrow.

    its working erratic cause you left the behaviors litetween and bullet active on start, here: prnt.sc/tpkmex

  • anyway, take a look at your drive... I corrected a little, changed the landing point to where your arrow selects, and move along the shadow using same lerp for Y (but not making the Arc as shadows go straight to the floor) and play a bit with shadow opacity for you to see a use of distance expression too...

    hope it is useful to learn a bit more!

    now already seems perspective movement?

    P.S. I would not be using tweens for what it seems you need, also not bullet...

  • I seen your draw.. and see you wanted kinda perspective and bouncing effect...

    well I upload again with this features and other in order for you to learn a bit more what I think you would need for this.

    if you study it a bit you will learn I think in good direction :)

    this way, just playing around with the basic expressions, not using tweens or bullets, you got complete control over the object situation... as you can see it will go exactly to where you pointed... and the use of CPU is near to zero :)

    let me know if it was what you needed

  • nailHammers, have you checked the drive?

  • Woah, hugone! Just noticed your example with perspective jumper and was in... awe, mucho!!!!!!!!! 8-) Close to what I was intended, thanks.

    Tweens and Bullet: Bullet is dynamics, would not vote for it anyway, as it is suitable for different gameplay concept. Why would you avoid LiteTween? I thought that LT would give more intuitive control over trajectory adjustments, like for variable jump heights, quicker to set up.

    I like your Case (move) branching, makes entire code more structured. Is this still hardware independent, since you use dt increments?

    Your example made me completely reconsider my approaches to the code, as I naively thought that everything must reside under everyTick. I will post an update with what I ended up. Gracias!

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