Hooking Fishes

The Fish Master The Fish Master
12 minutes
Share the link to this page
Copied
  Completed
You need to have access to the item to view this lesson.
One-time Fee
$69.99
List Price:  $99.99
You save:  $30
€64.98
List Price:  €92.84
You save:  €27.85
£55.64
List Price:  £79.48
You save:  £23.84
CA$95.72
List Price:  CA$136.74
You save:  CA$41.02
A$105.61
List Price:  A$150.88
You save:  A$45.27
S$94.51
List Price:  S$135.02
You save:  S$40.51
HK$546.96
List Price:  HK$781.40
You save:  HK$234.44
CHF 63.39
List Price:  CHF 90.57
You save:  CHF 27.17
NOK kr759.29
List Price:  NOK kr1,084.75
You save:  NOK kr325.45
DKK kr484.72
List Price:  DKK kr692.49
You save:  DKK kr207.76
NZ$116.27
List Price:  NZ$166.11
You save:  NZ$49.83
د.إ257.06
List Price:  د.إ367.25
You save:  د.إ110.18
৳7,668.91
List Price:  ৳10,956.06
You save:  ৳3,287.14
₹5,843.17
List Price:  ₹8,347.75
You save:  ₹2,504.57
RM331.68
List Price:  RM473.85
You save:  RM142.17
₦86,437.65
List Price:  ₦123,487.65
You save:  ₦37,050
₨19,439.77
List Price:  ₨27,772.29
You save:  ₨8,332.52
฿2,571.29
List Price:  ฿3,673.43
You save:  ฿1,102.14
₺2,259.44
List Price:  ₺3,227.91
You save:  ₺968.47
B$355.04
List Price:  B$507.22
You save:  B$152.18
R1,290.39
List Price:  R1,843.50
You save:  R553.10
Лв127.12
List Price:  Лв181.60
You save:  Лв54.48
₩94,866.43
List Price:  ₩135,529.28
You save:  ₩40,662.85
₪261.89
List Price:  ₪374.14
You save:  ₪112.25
₱3,999.98
List Price:  ₱5,714.50
You save:  ₱1,714.52
¥10,762.93
List Price:  ¥15,376.28
You save:  ¥4,613.34
MX$1,185.03
List Price:  MX$1,692.97
You save:  MX$507.94
QR254.87
List Price:  QR364.12
You save:  QR109.24
P951.97
List Price:  P1,360.02
You save:  P408.04
KSh9,396.15
List Price:  KSh13,423.65
You save:  KSh4,027.50
E£3,355.96
List Price:  E£4,794.44
You save:  E£1,438.47
ብር4,011.08
List Price:  ብር5,730.37
You save:  ብር1,719.28
Kz58,466.37
List Price:  Kz83,526.97
You save:  Kz25,060.59
CLP$65,872.48
List Price:  CLP$94,107.58
You save:  CLP$28,235.10
CN¥495.49
List Price:  CN¥707.87
You save:  CN¥212.38
RD$4,060.47
List Price:  RD$5,800.92
You save:  RD$1,740.45
DA9,414.39
List Price:  DA13,449.71
You save:  DA4,035.31
FJ$157.07
List Price:  FJ$224.39
You save:  FJ$67.32
Q543.15
List Price:  Q775.96
You save:  Q232.81
GY$14,618.48
List Price:  GY$20,884.44
You save:  GY$6,265.96
ISK kr9,767.80
List Price:  ISK kr13,954.60
You save:  ISK kr4,186.80
DH704.80
List Price:  DH1,006.90
You save:  DH302.10
L1,237.78
List Price:  L1,768.33
You save:  L530.55
ден4,001.09
List Price:  ден5,716.08
You save:  ден1,714.99
MOP$562.43
List Price:  MOP$803.50
You save:  MOP$241.07
N$1,293.49
List Price:  N$1,847.92
You save:  N$554.43
C$2,572.34
List Price:  C$3,674.94
You save:  C$1,102.59
रु9,329.91
List Price:  रु13,329.02
You save:  रु3,999.10
S/260.85
List Price:  S/372.66
You save:  S/111.80
K270.11
List Price:  K385.89
You save:  K115.77
SAR262.50
List Price:  SAR375.01
You save:  SAR112.51
ZK1,884.87
List Price:  ZK2,692.78
You save:  ZK807.91
L323.24
List Price:  L461.79
You save:  L138.55
Kč1,626.08
List Price:  Kč2,323.07
You save:  Kč696.99
Ft25,316.43
List Price:  Ft36,167.88
You save:  Ft10,851.45
SEK kr757.73
List Price:  SEK kr1,082.52
You save:  SEK kr324.79
ARS$61,503.14
List Price:  ARS$87,865.40
You save:  ARS$26,362.25
Bs483.90
List Price:  Bs691.31
You save:  Bs207.41
COP$271,944.94
List Price:  COP$388,509.43
You save:  COP$116,564.48
₡35,713.67
List Price:  ₡51,021.71
You save:  ₡15,308.04
L1,726.17
List Price:  L2,466.06
You save:  L739.89
₲523,116.65
List Price:  ₲747,341.53
You save:  ₲224,224.88
$U2,673.86
List Price:  $U3,819.97
You save:  $U1,146.10
zł281
List Price:  zł401.45
You save:  zł120.44
Already have an account? Log In

Transcript

Welcome back guys, Omar here from magic going. And in this video we're gonna start hooking what do I mean by that? Well, basically we have our hook, we have our fishes, how about we put some fish onto our hook. So without further ado, let's get started by opening up our hooks script. And first thing that we're going to do is to fix these comments. So here we're going to say private, so private private list.

And that is going to be a list of fish that we're going to call hooked fish, fishes hooked fishes. And now here we're gonna say hooked fishes so we can call it hook fishes equals to new list officer so we're just declaring that declaring them right now in in our our wave function. Now, I think Yep, here I think we have to do him in our clear Yep. We have to do hooked faces dot clear. That was think all about at uncomplete we have to clear them out again I think it was something like that. Now here we are here we have our integer num, which we are gonna have for for for not subtracting the How do you say plus adding up.

So summing up adding up all fishes and the prices. So this is this is what we're going to do for I mean this is what are we going to do so for then int i equals to zero. So int i equals zero semicolon, then we'll have our Where is it? I less if it is less than hooked. This is dot count plus plus I plus plus if you're not in it, but i plus plus like this, if this is the true so we are looping while this is true, we're gonna say hooked dishes, then array at i dot transform dot set parent to be now to leave them behind now saying that hooked fishes then it's AI or is it dot reset fish so we're going to reset them put them back and then we're going to say num plus equals to hooked vicious at AI dot type.

So type dot price. And then here we will say either manager total gain or total firm equals none. So what is happening here? So basically we're looping for every fish that we have hooked. Setting in It's fair to be now because we once we hook them it will be onto our hook recently we started with them with the back together so there will not be deleted from the from the scene but actually just put them one more once more in the scene but player will not know that we just know it because we can see it we are creating this game that's why now to actually have a hook hook actually to have hook to hook fishes we will have to use colliders and for that we have our void on on trigger and that too these are private on trigger enter 2d which will gonna say target so here I said target some some of you may use other work maybe collision I did not know I use target.

So if you like Target music cute. Now if target dot compare tag We have a plain text comparing time with fish. So that is true. And so and we have to check to this where is it this is for and this and this is for keep that in mind when it comes to if statements double these are ads and double these are or in this case we will use hand if this count is not equal to strength then we are actually we will hook the fish we will proceed to this block of code it will come up. So, here we're gonna say fish count. So please count plus plus increasing the fish count.

Now fish component component like this equals to target that game component on you get reported and we are getting our fish script like this Then we are saying hooked this so look bases add, add, we will add our fish or our component ID. Then we're going to say target dot set parent to target dot transform dot set parent. And we are going to set our transform. So, by transform we are saying that this hook will be the parent of our fishes once they're hooked. Then target altruism but target dot transform dot position equals to hook transform dot position. And we're going to do the same for the station.

So target dot transform dot rotation, not route but rotation with the shoe like this equals to hook transform dot rotation Then we'll have our target dot transform or transform transform but target dot transform Can I get destroyed like once just once local scale so local scale equals two vector three dot one. And we are doing this because if our fish is looking at the opposite way, it will not be same as when we hook it so we put our transfer local skills will be one, so it is normal as all other fishes and now we're going to have our our animation for it. So transform.transform.target.transform.do shake rotation. So the duration will be five. Then vector three dot forward, multiply by 45. They will have 10 Why ratio randomness will be 90 so randomization is how much it will be from zero to one any values higher than 90 times socks will be were setting to zero we'll take a one on one direction so keep that in mind.

So as you can see, this is really good because you will have explanations for everything. So here we are shading it from five, vector three will be shake trust from or local rotation so forward by 45. And then false for fake out to be false. Now with a little bit too we're going to set loop said loops and loops will be one and loop type yo yo so that yo yo like this now and then on complete, they will have delegate delegate like this. This target dot transform dot rotation equals to what turn your quad turn into identity. So once we are finished, we are setting rotation back to normal normal rotation.

So saying saying target dot transform dot position equals to pattern indict identity is same as saying 000 for the patient. Now, right below it, we're going to see if our fish count if fish carrot equals to strength. There, we're going to say stop fishing. Meaning that we have reached the limit, we have a chance and we will stop fishing immediately. So let's briefly go over all this, all of this again. So here I have nothing to explain really.

So I'm just gonna explain this in shape notation. So even if you if you were if you read a With me what was going on, you could understand, but I'm going to go one more type over it. So this new shape rotation. So this file is like how much or how for how long we're going to actually rotate the vector three dot forward is to what point are we going to rotate? How much are we going to shake the 90 was this so there is randomness. This is to for how not much so this will bration.

This actually going from right side to side, and I will have false for our fade out so we will not fade out. And now we're setting glue JoJo, so it's kind of infinitive. Then once we are finished, so once we finish we are setting back our fishes to normal, saying quaternion dot identity, as I said is same as saying 000 for the rotation. So right now we can test out Before we do that, we have to add the tag for our fishes. So click here on the tags, go to add tags and then you'll see this plus icon here. They will be for the text so click on the tag then add tag and then click here on the plus saying like fish.

And then we'll go to our prefabs adding our fish that for our fish. Now we'll test this out. So let's see click play to see if our script is actually working. Click here. And yeah, we're not even connecting with the fish. So there is one thing so this is on trigger, enter 2d.

So for on trigger enter 2d to work. We have to put our hook to be a trigger. So easy Trigger Is it true? One thing I can see here is an Africa add to my here, I forgot to add a component that hooks by this so that that that was missing. And right now we can test it out. And it should work.

And one thing I'm going to do is I'm going to click that pause it, remove the button, I mean, put it to not be activated, so we not go twice down because that's unnecessary. Let's move Yeah, we can catch fishes but they're kinda not where they're supposed to be with transform. Let me see. I just move to the right side with here, not there. Because hook we look we're hooking them this far as not on the this line or here. Let me try again.

Check the hook again. That looks better. So this is what I before before I even started ironing start fishing. So guys, that will be it for this video and I'll see you guys guys guys I love repeating guys. Listen, I will see you guys in the next episode or video call it whatever you like

Sign Up

Share

Share with friends, get 20% off
Invite your friends to LearnDesk learning marketplace. For each purchase they make, you get 20% off (upto $10) on your next purchase.