This is my first tutorial so hopefully it isnt confusing. I decided to add fishing to my game but realized it was way too simple and boring to just go to water and hit the action button. I decided to make fishing much like Harvest Moon. Here's my tutorial on how to make Twitch Skill Fishing.
Step 1: VariablesFirst we need to initialize two variables.
The first will be our timer, so I'll call it Fishing Timer. Lets set that to 0
The second is our random, variable. I'll name is just Random. Lets set that to a random number between 20 and 120. This will be how many Frames it takes for the fish to appear
Step 2: The WaitSince we cant tell the wait command how long to wait based on a variable, we have to find a workaround. Here's how.
Start by making a Loop.
Inside the loop make a Wait command of 1 Frame.
To find out how many times the loop has run, we simply do Fishing Timer +1
Now we have exactly what we want to know how long we need to wait.
Make a conditional branch with the condition Fishing Timer == Random
This finds out, did we wait the number of frames that was randomly selected?
Once we have we need to break out of this loop of waits.
Inside of the conditional branch do:
Reset Fishing Timer to 0 because we are going to use this again in a second.
Now put a Break Loop after resetting the Fishing Timer.
Step 3: A NoticeNext I put a Sound effect to make the player know a fish has bitten. Make sure that this is after everything else we have done.
Step 4: Catching The FishOk next is deciding if the player caught a fish.
We need to make another Loop with Wait 1 Frame
Now is did the player push the A button?
Make a conditional branch with the condition A button being pressed.
Inside of this Conditional Branch is what happens when the player catches the fish. So for now I'll put Show Text "You caught a fish!"
After the text use Exit Event Processing so we dont run anything else.
After this conditional branch we need to do Fishing Timer +1
After we add a +1 this is where we decide how long the player gets to push the A button.
Make a conditional branch that is Fishing Timer == 10 or however long in Frames you want to give them.
Inside of this branch is what happens if the player didnt catch any fish. For now just Show Text "You failed to catch anything!" and leave the event by Exit Event Processing Again.
Step 5: Fixing BugsAlmost done! We have a bug right now though. The player can easily cheat and just hit the A button over and over. How do we fix this? Simple. Use the same idea as before with the A button. Lets go back to the first loop we made. Use the same exact conditional branch as in the 2nd loop and paste it here. It really doesnt matter where as this just finds out if the A button was pushed at anytime during the waiting period.
Anyway, inside of the conditional branch put Show Text "You failed to catch anything!" And Exit Event Processing
Done! Now this can easily be applied to anything you want twitch based in your game!
Fishing_1.png ( 36.36K )
Number of downloads: 123