How do I cast a fishing bobber/float like Stardew Valley?

0 favourites
  • 4 posts
From the Asset Store
High quality spell, looping and casting sounds for your medieval & fantasy settings
  • I've been trying loads of different approaches to this, with very little success so would appreciate some help please.

    For a top-down game, i'd like to add a fishing element like Stardew Valley, however I can't get the motion of 'casting' a bobber/float.

    Is there a way to 'throw' a sprite in an arc?

    I thought of using tweens for the animation... tweening the bobber to the top of the arc, then tweening it back down again but I can't get the tweens to run concurrently.

    Any suggestion please?

    (incidentally I actually paid someone to come up with a solution and it was terrible so trying to figure this out myself with your help!)

  • So i've been working on this a little more and i've managed to 'lob' a bullet to the right using angle=300.

    I can adjust the distance by adjusting the speed...

    However I can't get the bullet to stop moving... so it' just drops off the screen each time!

    I tried... if bullet.Y = player.Y then bullet disabled but it keeps on going. I've even set gravity to 0, speed to 0 etc. but it simply ignores it.

    Anything i'm missing?

  • Here is an old commented example by user kriand that will work at any angle - 1drv.ms/u/s!Asn1IURKZWj8gTWyUBXqilplh8jG

    It was for bouncing sprites in an isometric view, but if you ignore the actual bouncing parts it has what you need to simulate an arcing motion from a top down view in any direction. It uses the bullet behavior for horizontal movement and the platform behavior for vertical.

    Basically you need to isolate the horizontal (x/y), from the vertical (z) movement. An easy way to do this is to use two separate objects, a helper base object, or shadow, that moves directly towards the target, and your actual object which follows an arc. The base of the object will travel in whatever direction you cast it in, and the vertical movement follows that base.

    To know when to stop, you can compare the y position of the object and it's base. When the object passes its base, that is when it has reached the "floor". You can see this in event 10 in the example. Instead of bouncing you would just stop the object/disable the movement behaviors there.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Wow that's a great example thank you... i've already tweaked it to almost exactly what I need... I need to implement the power-bar etc. but I think I can do that.

    Definitely a lot smoother/more appropriate than all the other solutions i've looked at (and paid for!).

    Thanks again.

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