How do i make a fishing mechanic in my 2d rpg game, like stardew valley or others if you know?
1 Like
Hi, welcome to the community!
The steps I would take to do a fishing mechanic would be:
- Hold down a button.
- An animated bar appears. The animation increases and decreases the bar’s width.
- Throw a bobber based on the size of the bar.
- When the bobber hits the water Play an animation and starts a coroutine.
- The coroutine has a chance to trigger a fish during each frame, increasing with each frame that passes.
- When a fish triggers play another animation.
- The animation has an event key, if it reaches the event the fish will be gone.
- I suppose you could add a speed for each fish, increasing or decreasing the animation speed.
- The animation has an event key, if it reaches the event the fish will be gone.
- Catching the fish on-time starts the mini-game.
That would be a very basic fishing system, if you want a mini-game it would depend on your idea and design, but basing this on Stardew Valley it would be something like this:
- Create a small sprite that has a
Rigidbody
.- Lock the X position and rotation.
- It should have the gravity activated.
- Add an upwards force to the
Rigidbody
only when holding down the button. - The bar detects if it has a fish inside.
- When the fish is inside the bar increase the “catch bar”.
- Decrease the catch bar every frame unless it has a fish.
- If the bar is full then catch the fish.
- When the fish is inside the bar increase the “catch bar”.
- When catching a fish play an animation.
That’s how I would do it, if you want something more akin to a tutorial or actual code I found this on YouTube.
thank you
This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.