How to make a top-down fishing minigame like Stardew Valley?

I want to create a fishing game with a minigame concept similar to Stardew Valley. However, I couldn’t find any tutorials on Google or YouTube. I’m confused about how to start, including the coding and mechanics.

I don’t remember how exactly it works
But for sure you will need to learn how to calculate % of something
For example that green bar on blue bar on which fish is in your screenshot

Needs to be calculated on 100% of bar
And hits position and size is calculated fishing skill and potion if used and i don’t remember if also there were multiple rods

FOR EXAMPLE
We have there blue bar of height like let’s say 200
SO that green bar should be

BlueBar.Height() / Maximum GreenBar Could Be * (FishingLvL + PotionUsed + RodLvL)

For example let’s assume Maximum GreenBar Could Be
Would be actually 20
FishingLvL is 5
PotionUsed is 2
RodLvL is 3
So we get 10
So half of 20
And now you get that green bar at 50% of height of blue bar

And only thing left to put that green bar at SOME position in relation to blue bar
It can be random but then you need to make sure it will not go beyond blue bar height (like its bottom)

That green bar on the right
I don’t remember for what its for
But i will assume when you pull rod it drains itself if fish is not inside green bar
And if fish is inside green bar then that green bar on blue bar pulls up and if you bring fish up you catch fish
That can totally be done with check if fish is in collision with green bar
If yes you don’t drain green bar on right if no you drain it
Where that green bar on right is nothing else as HP bar from which you would subtract HP

Last thing to do is to cancel fishing when green bar on right is 0 so HP = 0

Im sorry i dont understand. can you make example for source code?

Yes i can
But no i will not
Cause you ask for something complex
Just because i gonna make it will not help you in any way cause you will not know how to adjust it to your needs
And you end up in same situation you are right now

And the fact you say you don’t understand anything what i wrote just proves it

So you can start building it step by step and i will guide you

1st make fish icon
Then make that whole panel with places for 2 bars blue one which will hold green one then green one to the right
And make panel sprite for that small green bar which will be inside blue one
And we will move on from there

1 Like

“Thank you, I really appreciate that you’re willing to teach me. I’ve already made the sprites as you asked. What should I do next?”

And i am very glad i found someone who want to learn

So before we begin
THIS

Will need to be 4 times longer (so imagine 4 more pages of this size worth of events MAYBE 3)
For we to recreate it as you seen it in stardew valley

RMB to enter fishing
LMB to try to catch the fish
Rules you know but just for sake of reminder
Green bar (CatchBar) on the right will constantly decrease no matter what you do
IF you LMB when fish is in collision with green bar (FishBar) then green bar on right will rise up
If you LMB when fish is not in collision with it then bar will shrink even faster

There is no end goal so you can make bar on right go beyond window frame
Right bar is not properly scaled but close enough for sake of example
Fish moves too random which would require A LOT of tweaking while considering attributes of each fish
Fish will need variable for when she can escape
Another for how fast
Another for how often
And don’t forget about chance for treasure chest
Green bar on left should be moving
At beginning of scene (top most event) i set some values to some variables
Which i mostly use to calculate how high green bar on left will be

So my question
Looking how complex it is right now
And imagining how complex it will need to become
Do you still want to replicate stardew valley fishing

OR we gonna simplify it like ultra hard
Cause i already feel like it took more effort than what it’s worth
But i have no problem going deeper with it if you feel capable enough

But if you decide we go deeper i 1st want to see you replicate what i did and paste here screenshot of your events and link to preview so i can see it actually works

I tweaked it a little
And works A LOT better now
BUT that is still just random movement for fish
Imagine adding here all that crap i mentioned above
Some fishes need to move faster others need to be more unpredictable like let’s say wild changing directions more often
Some needs to have better chance to avoid green bar
And then longer period of how much they can avoid it
On top of at chance and period of running away from green bar when being pulled

Anyway i changed names to green bar (on on left) and yellow bar (one on right) so it is easier to understand

Again what you want to achieve is 100% doable and not rocket science
But time consuming and requiring more effort than it is worth it at least in my eyes

I personally would go for something way more simple
But again choice is yours
But remember i will expect you to show me how you replicated all i sent you to make sure you understand what you are doing
Choice is yours

I am very grateful to you for teaching me such valuable knowledge. I never expected that I could create something like this in GDevelop.

There are some things I understand about the mechanics from the code you provided, but there are also some parts that I still don’t fully understand.

In your opinion, what would a simpler fishing minigame look like? Would it be similar to fishing in Harvest Moon: Back to Nature or Harvest Moon: Friends of Mineral Town?

I have tried following the code you provided, but I encountered some issues when implementing it:

  1. My fish icon does not respawn inside the Fish BG. I have tried my best, but I don’t know what I need to fix.
  2. When the fish icon touches the green bar, the yellow bar does not increase.
  3. When I press the green bar up to the maximum, I don’t know why there seems to be a limit, even though it hasn’t reached the top of the Green BG. Also, when it goes down, my green bar drops below the Green BG.

I am very interested in learning complex things like this if you don’t mind teaching me. However, if you prefer to teach me a simpler mechanism as you mentioned, I also don’t mind. i give you my video character and my code :slight_smile:



I did not even take a closer look just quick glance

You are creating / deleting with RMB
And what button you use to fish? Also RMB where i use LMB

Where i see more mistakes but whatever

Anyway look
Problem here is your time
I come here everyday i am losing here nothing
You are losing your time either to learn something complex and by now i can tell you it will be long and bumpy road
OR you can look for something more simple
And again choice is yours i am fine with either way

Where you should learn valuable lesson of measure your skills for your intentions
We can go event by event and i can explain everything not a problem

Or you can go to youtube type fishing minigame
Look on fish minigames in other games and find something way more simple

For example 1:00
This game is topdown as you see but it takes you to totally different scene when you start fishing

Tell me this does not looks more simple?

You just make bar to how far you throw your bait
Bar that drains when you pull rod
And actually visible fishes there

But that is just an example
There are TONS of fishing games

So again you need to choose what is best for you and what you would feel capable of achieving

Right now you are stuck at copying stuff you seen in my screenshot
Sometimes you need to scale down your ideas
But sometimes you should strive to perfection
BTW never played any of games you mentioned
And to make matter worse i hate fishing in games

I would make what you see in breath of fire 2
Instead of rod with bite i would give player harpoon
And make player choose his angle and throw harpoon whatever angle he choose
And difficulty would come with fishes that are closer to the top
Since if harpoon hits any fish it retracts automatically
So that would be like natural shield
And more rare fish would be on bottom of water body

And your level potions skills harpoon type WHATEVER would affect how fast harpoon would be

And that would be ultra dumb and easy to make

BUT again and again
You need to make your choice
Listen to what i suggest BUT do not take it as i have better idea than you
YOU need to have better idea what will fit your game and what you will be able to accomplish

Thank you for your advice . :pray: It’s true that my current skills are not advanced enough to create something that complex. If I force it, I’ll just end up wasting time.

Maybe it’s true that I should start with something simpler. Can you teach me the fishing mechanics from Harvest Moon: Back to Nature or Harvest Moon: Friends of Mineral Town (GBA)?

The mechanics are simple:

  1. Casting the fishing rod into the water.

  2. Waiting.

  3. When a fish bites, clicking multiple times to catch a random fish.

I’ll give you example

OK maybe you took my words too deeply
That is like brain dead simple

BUT on other hand now you will know some basic logic
And then you can try to build upon it

RMB to start throwing
Then release RMB to actually fish
This is bare bones
Press space to reset scene
Your actions affects only that player closer to water (the one facing right by default)

THIS

Fisher.X()+10+(40/100*ThrowCharge)

Is formula to calculate where coin to appear so imagine its bite
Which is Fisher X pos +10 pixels right from him + (40 pixels but they are caluclated from % of ThrowCharge variable)

It goes like

40 / 100 * ThrowCharge)
40 is 100% of something
then 100 is how much you can change value right from it so ThrowCharge
It cannot be greater than 100

So you are basically going like
Give me % of 40 based on how high ThrowCharge value is

Or imagine this like 
You wanna change HP bar width to value of player HP
Formula is the same

215 / PlayerMaxHp * PlayerCurrentHP

Where 215 is max width of your hp bar

I made a slight modification to the code regarding the bait, where when right-clicking and releasing, an animation of the bait I created appears. This works well, but I’m facing some difficulties with the next steps. Here are a few things I’m struggling with:

  1. How to make the bait, after being cast and hitting the water, show an animation where the bait goes up and down like real bait affected by waves.
  2. After the bait is cast, wait for about 10 seconds before a fish bites the bait.
  3. When a fish is caught, I want the fish to be selected randomly from the 4 fish I created.
  4. When a fish bites the bait, the player must click the mouse at least 3 times to reel the fish in. If not, the fish will escape.

Thank you for helping me so far! I’m happy to learn with you.




this is for bait animation ,if you dont understand for my bait code :slight_smile:

1 - There is no water so you need means to simply check if animation of bait BaitThrow is finished
Where i think you made mistake of it going purely with it as animation
I would say you should add to bait tween behavior
And now you could create bait above player head
And tween its position to

Fisher.X()+10+(40/100*ThrowCharge)

Where for Y you would tween it to Fisher.Y()+Fisher.Height()
Which would be height of fisher feet

2 - That is just adding timer

3 - That is just setting some variable to RandomInRange(0,3) so there are 4 possible values 0 1 2 3
And now you would make event
Variable = 0 create fish BlueFish
Variable = 1 create fish RedFish
And so go on

4 - I have here better idea
We could use that catch bar of mine
And with each player click it increases bar width
Where automatically on its own bar decreases
So you need to spam click like work for your catch

Look 1st of all
You need to use your imagination here
Cause i am not going to draw everything but instead i am using assets i have
So my coin1 (yellow one) is your bait
Coin2 (gray one) is shadow which i tint to black so it does look like shadow for bait/coin1
I change scale of coin2/shadow to be same as coin1/bait but also change its Y scale more so its even more flatten and look like actual shadow
BUT that is optional you don’t need that shadow
I do not have fish so instead we have here weapons Gun Gun2 and Gun3
But let’s imagine they are fish
You see all fisher have animations so you could totally make rod for it
You see some variables
Do not take them as static numbers they can be adjusted by various stuff
For example you see when you hold RMB you add 1 to ThrowCharge var
Imagine you could set that not to 1 but to 1+RodLevel + FishingLevel + whatever else
So you could control how fast you charge throw
And like that you could manipulate everything to work more dynamic

Prepare yourself for wall of text cause today we gonna full course for sake of stupidity
RMB to charge throw
And SPAM LMB when fish takes the bite
DO NOT set it to 10 secs you will piss your players trust me
I set it to 2 and its already annoying
I would consider going RandomFloatInRange( 0.5 , 2)
RandomInRange will pick integer between numbers you specify
RandomFloatInRange will allow for decimal values
Like if you set RnadomInRange(1,3) you can only get 1 2 or 3
RandomFloatInRange(1,3) can give you 1.1 1.2 ANYTHING up to 3
BTW i made mistake checking everything by animation of fisher
I should make text variable with states to have free control over animations
You can see i put there variable FisherState and set it to Charging Throw but i never used it so it serves no function and that was mistake
I should totally build everything about it and just make different states
And now in whatever state i could change animations as i want
BUT that is for you to know when you will build your logic
For now we will be fine with checking animations
image


I will not explain everything cause i assume some stuff you understand
If i omitted something you do not get just tell me which part
And ask why something is in events

Spot how 1st 2 events are if animation is NOT EQUAL to pulling
Where 2nd is IS EQUAL to pulling
That is how i control where to show what and do what
Also remember i did not go full animations and crap so you are totally free to add animations for everything where for me you have single frame for most crap

Animation is pulling
ThrowCharge is below 100 but above 0
All sub events will work now
LMB will add 1 to ThrowCharge (i was too lazy to make var for pulling so we are just using same variable we use for making a throw)
Next event with no condition so this crap happens constantly all the time while animation is pulling and subtracting 0.1 is fine with me where you will need to either go higher or lower
If ThrowCharge is above 100 meaning you won and got the fish
I set some number variable (WeaponSelectd) to random in range 0,2
Cause that is how many child vars WeaponsArray have with names of each object in that group
Which you can see in last pic
ThrowCharge is less than 0 you lost

RMB is pressed we set ThrowCharge to 0 to reset charging
And Change player animation while deleting stuff to start new fresh fishing session
Don’t forget to delete timer here its important so it don’t run when we start new fishing session

Adding 1 to ThrowCharge when holding RMB this is how fast charging will go
While we check if its below 100 so it won’t go above 100 which would be stupid and would make bar expand to infinity and beyond

When you release RMB we create coin above fisher head (your bait)
And shadow (coin2) at its feet
I scale and tint my objects cause they are not meant for fishing
You simply make them proper size and colors and you not need to do anything
Shadow (coin2) needs to be create 1st before bait (coin1)
Shadow have offset of +14 for Y so we just put it in some static position + 14 pixels down
We tween X and Y position of bait (coin1) separatelly
With same speed 0.5 but different easing
Tween identifiers (names on end) needs to be different for each tween that is why one ends with X and other with Y
X formula 20 is base position away from Fisher so it will be 20 + whatever else is in formula
60/100*ThrowCharge is + % of 60 more pixles calculated from value of ThrowCharge
So if you charge it to 10 then result would be +6 pixels
So 20 + 6 = 26
Y tween is fisher Y pos + its height so its at his feet but + 10 to make it little lower
We are constantly changing positions of shadow coin2 to bait position coin1 with offset -1 cause my coins are not even in size
But now you get how to offset something and do you even need it
When tween of bait coin1 is not playing we delete shadow coin2
Cause it makes no sense to have that shadow when bait hits water

Animation is throw and its finished we set animation of fisher to fishing
This can be animated as i mentioned but well i just have 1 frame
We also start here timer you wanted

We check if timer is above 2 secs and we change player animation to pulling
And AGAIN DO NOT set timer to 10
Its annoying as fak
You could use here RandomFloatInRange as i mentioned
And when its done we go to top of events sheet to condition which check if animation is pulling


And here is how you make array with object names
And number var to contro it
You also need to add all your objects to some group
For me it was group called Weapons
For you it will be most likely Fishes or something like that you name it

And now you can random in range your catch

Your goal is not to success with what i explained
Your goal is to replicate as much as you understand and mess with it
Cause when you start messing with it you will start to understand what each part do
And now you will be totally fine expanding your logic