Chapter 2: Create Gold Rush Game by Unity

In this part, Gamemakerlab will introduce the next chapter to create a completed Gold Rush game by unity.

The details information as below: 

Part 2:  Create GameMNG.script to manage -> In the Hierarchy, create objectgame named as GameMNG -> Drag and drop this script into ObjectGame GameMNG

Manage states of hook such as: pause, drop the line, pull hook

                                    

Image 7: Code describes GameMNG.script

Part 3: Create Script which is named as Hook.script-> Drag and Drop hook.script into ObjectGame Hook in the Hierarchy

It means that we have a fishing line and hook. When we touch screen, hook will move following  that way . Fishing line will be fixed and render line follow hook. So, on Hook.script Function, we will do:

Step 1: Create checked Function. If state of the hook is idle, we will move the hook  following the direction to the screen.

 Step 2: Check moving of Hook. If it moves out of camera screen, you should pull the hook on.

Step 3: Continuously, if we pull the hook on and it touches fixed location, it will be stopped


         
                        

        

                                                           Images 8 + 9: Code describes Hook.script
Part 4: Create Script which is named as LineFishing.script -> Drag and drop it into ObjectGameLineFishingin the Hierarchy

Because fishing Line is fixed.  So, Every time it touches screen,  hook will move and fishing line will be fixed

 We use LineRenderer to render line hook.

                                    

 

                                                             Image 10:  Code describes LineFishing.script

This is just chapter 2 of Gold Rush Game Tutorial. If you want to implement, keep doing well the last part in next post.

Thank you for your advocacy in the past period.It is motivation to team continue organize and create more and more useful tutorials.