Hook Y Movement

The Fish Master The Fish Master
18 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.99
List Price:  €92.84
You save:  €27.85
£55.80
List Price:  £79.72
You save:  £23.91
CA$95.74
List Price:  CA$136.78
You save:  CA$41.04
A$105.97
List Price:  A$151.39
You save:  A$45.42
S$94.71
List Price:  S$135.31
You save:  S$40.59
HK$547.38
List Price:  HK$782
You save:  HK$234.62
CHF 63.50
List Price:  CHF 90.72
You save:  CHF 27.21
NOK kr760.18
List Price:  NOK kr1,086.02
You save:  NOK kr325.83
DKK kr484.74
List Price:  DKK kr692.51
You save:  DKK kr207.77
NZ$116.49
List Price:  NZ$166.43
You save:  NZ$49.93
د.إ257.06
List Price:  د.إ367.25
You save:  د.إ110.18
৳7,679.15
List Price:  ৳10,970.69
You save:  ৳3,291.53
₹5,844.24
List Price:  ₹8,349.28
You save:  ₹2,505.03
RM331.61
List Price:  RM473.75
You save:  RM142.14
₦86,437.65
List Price:  ₦123,487.65
You save:  ₦37,050
₨19,466.20
List Price:  ₨27,810.05
You save:  ₨8,343.85
฿2,579.91
List Price:  ฿3,685.75
You save:  ฿1,105.83
₺2,258.19
List Price:  ₺3,226.13
You save:  ₺967.93
B$355.28
List Price:  B$507.56
You save:  B$152.28
R1,291.06
List Price:  R1,844.45
You save:  R553.39
Лв127.20
List Price:  Лв181.73
You save:  Лв54.52
₩95,163.27
List Price:  ₩135,953.36
You save:  ₩40,790.08
₪260.34
List Price:  ₪371.93
You save:  ₪111.59
₱4,006.12
List Price:  ₱5,723.27
You save:  ₱1,717.15
¥10,811.89
List Price:  ¥15,446.23
You save:  ¥4,634.33
MX$1,180.56
List Price:  MX$1,686.59
You save:  MX$506.03
QR255.22
List Price:  QR364.61
You save:  QR109.39
P950.05
List Price:  P1,357.27
You save:  P407.22
KSh9,308.67
List Price:  KSh13,298.67
You save:  KSh3,990
E£3,339.92
List Price:  E£4,771.52
You save:  E£1,431.60
ብር4,017.22
List Price:  ብር5,739.13
You save:  ብር1,721.91
Kz58,559.69
List Price:  Kz83,660.29
You save:  Kz25,100.60
CLP$65,083
List Price:  CLP$92,979.70
You save:  CLP$27,896.70
CN¥496.09
List Price:  CN¥708.73
You save:  CN¥212.64
RD$4,059.13
List Price:  RD$5,799
You save:  RD$1,739.87
DA9,404.13
List Price:  DA13,435.05
You save:  DA4,030.92
FJ$157.14
List Price:  FJ$224.49
You save:  FJ$67.35
Q543.86
List Price:  Q776.98
You save:  Q233.11
GY$14,638.84
List Price:  GY$20,913.53
You save:  GY$6,274.68
ISK kr9,768.50
List Price:  ISK kr13,955.60
You save:  ISK kr4,187.10
DH701.39
List Price:  DH1,002.03
You save:  DH300.64
L1,239.86
List Price:  L1,771.31
You save:  L531.44
ден4,006.46
List Price:  ден5,723.76
You save:  ден1,717.29
MOP$563.24
List Price:  MOP$804.66
You save:  MOP$241.42
N$1,288.69
List Price:  N$1,841.06
You save:  N$552.37
C$2,575.52
List Price:  C$3,679.48
You save:  C$1,103.95
रु9,351.66
List Price:  रु13,360.08
You save:  रु4,008.42
S/260.79
List Price:  S/372.58
You save:  S/111.78
K270.67
List Price:  K386.69
You save:  K116.01
SAR262.50
List Price:  SAR375.01
You save:  SAR112.51
ZK1,901.47
List Price:  ZK2,716.50
You save:  ZK815.03
L323.43
List Price:  L462.07
You save:  L138.63
Kč1,625.98
List Price:  Kč2,322.93
You save:  Kč696.95
Ft25,280.20
List Price:  Ft36,116.11
You save:  Ft10,835.91
SEK kr759.20
List Price:  SEK kr1,084.61
You save:  SEK kr325.41
ARS$61,608.98
List Price:  ARS$88,016.60
You save:  ARS$26,407.62
Bs483.53
List Price:  Bs690.78
You save:  Bs207.25
COP$273,394.26
List Price:  COP$390,579.97
You save:  COP$117,185.71
₡35,797.53
List Price:  ₡51,141.53
You save:  ₡15,343.99
L1,728.55
List Price:  L2,469.47
You save:  L740.91
₲523,227.64
List Price:  ₲747,500.10
You save:  ₲224,272.45
$U2,673.53
List Price:  $U3,819.50
You save:  $U1,145.96
zł280.44
List Price:  zł400.65
You save:  zł120.20
Already have an account? Log In

Transcript

What's up guys? Omar here and I'm back with another video. So I did my homework and I was trying to say in previous video initialisation because I was explaining what awake I mean, what is the difference between awake and the star? And I said somewhere in half of the video halfway through seven minutes, I think that they are both used for initialization. So I did my homework, hopefully you understand what I want to say. And without further ado, let's start scripting our hook because I'm pretty excited to do that.

Oh, I mean, I pretty much like a leak. So first, we are going to have our function for it. And function is going to be called public void start fishing like this. And before we actually do anything, I'm gonna put the camera To be false, because probably somewhere around here we'll have it to be true. So we can know when can we actually fish. So first we're going to have our length to have our length, we will have to use our idle manager, which will store all of our it will store all of our, of all of our not variables, the integers, I mean that that is variable, it will hold out all of our data for length for strength for all client earnings, and so on.

So for now, I'm just going to for testing purposes, I'm going to put negative like 50. But here, I'm going to comment idle, it'll manage it like this. And just so we know, man, man, this time you say, manager like this. Yeah, I did correctly. So So we actually keep men and jet like this. So actually we know something is not is not right but something is missing.

And I'm going to do same for the strength. So let's say it's not there but below strength. Drag like this equals to, let's say three because that will be default and I'm going to say idle manager like this. Now as for the fish count, it will be zero because we will reset it. Then we'll have our float time which is going to be equal to negative length. So negative length multiplied by 0.1.

Like this 0.1. And one thing I want to mention you will see that length is always going to be negative. Why? Well because when you want to hook you will not go up but down and for our hook to go down. It has to go The negative side so keep that in mind so if I want to hook fishers are there then who could go down not upwards but downwards and for that we'll have our our hook our length be negative, so you do not get confused you know what I mean? So right now it comes time to use this tweener or camera tween.

So let's start it first we're gonna say camera, we need a separate camera, camera 20 equals to main camera dot transform that do move Why? So this is one of the scripts that in between. So if you actually read Come on the move right? If you actually read what it says it tweens a transient y position to a given value also stores the transform as the tween target so it can be used for filtering operations. What do we have here? We have our trees attracts from wide position to given value.

So we want to try to animate or tween our hook going downwards. So to do that we're going to say length length. I mean we are going to, we n value is going to be length. The duration for it will be our one plus. Oh, like that. Last Words are more plus Come on.

Okay, I'm gonna live this out. Because I have four I have my print screen on plus, so plus time, multiplied by zero point 25. As for the snapping is going to be false. So it's going to be smooth new snapping involved. Then that on update on update. So set on update callback for the team clearing I mean, any previous on update callback was set called it each time between it.

So this update is same as update here inside of our unity. So this will be on as the main camera is moving so, okay we'll reach the length, I mean the end of it, this update will go on. So updates update we're gonna have our almost deleted hopefully not hopefully but thankfully we have we are blessed with Angular. So here we have our delegate and we are using our delegate if you do not know what it is for, basically delegate, I can talk about it like in a separate video like 10 minutes long. But in, in this case, delegate can be used for a value that can be changed out to the game or like you can use delegate for two different functions like unity showed in the example like you have print num that prints down 50 And print double mom which, which doubles that up and then makes like 200 and we delegate that is possible, you can use the same delegate, which let's say 50.

But when you use it within the different functions, you will have like different outcomes. And you can always have multitask in it so you can include more functions in it and by adding plus or minus, you can always delete it. Hopefully you understand what I met meant. I mean, if you did not just go go up delegates and you will have unity on video, like it's four to five minutes long where they explain what it is. Or you can even go back to C sharp and see what W is right there. Then add these curly brackets like this.

And then inside we're gonna check if our main camera so main camera, that transfer dot position dot y is less than or equals to negative 11. If that is the case, we're gonna say transform dot set parent and we are going to set our parent for the hook to be main camera dot transform like this. And of course add these has not so much I think it's called semi column can remember for update, next off, we will never have a Nana you do not add here at here actually.on complete so this was on update and that now this is on complete, so the gate and gate. Let's see where is in here even delegate Oh my bed so it's complete then not curly bracket, but actually parentheses, then delegate The gate. Now our delegate is going to be checked if our delegate command what has happened here, okay?

I have mouse I mean on the laptop and I have mouse and I accidentally, I guess click somewhere without knowing as I would say uncomplete. We're gonna say that our collider collider dot enabled equals to true. It is only enabled when you're when we are finished. Then we're gonna say camera to we equals to main camera, me gamma dot transform dot u, u y, and we are going back to zero, so we're going back up. So this is the line which let's say for now minus 50. And now our n value is zero.

We're going back to the beginning in our time flies by fire. So right now we are going faster, and our snapping will be false like this false. Now, while that do more miles is going on, we're going to say.on update. So it is another update delegate. And we will have another delegate which will check here are what's called if our main camera dot transform dot position dot y is greater or equals to negative 25 left so when we reach some point, we are gonna stop fishing we're gonna have actually that function, but not now but later so let me just add it so we do not have like no errors, void Stop, stop fishing like this. As you can see, so right now I am going to briefly explain What is going on here?

So right now we have our camera tween. We are trying our camera and our camera tween equals to main camera dot transform that do move y and we are moving our camera tween on the move y to the length. And keep in mind that our main camera is or it is going to be our inside of the home so we are moving it to the length. So depending on how much we score and so on our we haven't even begun did that in this time. So one plus time multiplied by zero point 25. So this testing, you can change it if it's not like it and snap it will be false.

While that function is going, we are actually setting up our camera to be I mean I have to be a parent of our camera. So it follows it around. Now when that is complete, so when we finish, we go To the length when we finish that, we're going to enable our collider so we can catch fishes. And we are going back with our camera upwards so we can actually stop fishing. So we're going to stop fishing when we get to minus 20 minus 25. Or we catch enough fishes, as you can see right here.

So yeah, that will be it. Now below it. We're going to have another function which is going to be our for our game screen. So screen games leave it like this. So we know something is missing. Then when that is done, so what this is for this, I think, I'm not sure.

Let me check. Yep. So this has to be when it's completed, and I'd like this. I can I'm not 100% sure but I'm going to go with low so let me check yep so yeah all right so skin game here then collider that enabled will be false when we start and our can mall can move will be true and we are gonna clear our hook. So this suppose that suppose this is when we are done through salvation we are setting this up going to this code and when everything is done, we are setting up this again. So, I think we can test it right now.

It probably should work. Let me see. I click lay. Our hooks should go down and nothing is happening actually. Go bird right now even my Okay, I know why. My bed.

First we have to add this. So actually this is going to be a button. So I'm just going to create a new AI or is it button which is going to be called start star. start fishing like this. And inside we're gonna tap on click which which will be hook and functional beat start big sheet. So right now I actually I'm not going to display anything just briefly because I will do that in another video when we do when we do UI, click off and then put it like this, delete the text and just put our start fishing to be to be not visible so it's like this.

It's there but it's not visible right now. Oh, I just I just came up with a way that I could do it. Without this now we click as you can see our fish goes down. And now right now we will go back and when we hit minus 25 we are going to stop fishing or we should have started fishing but we don't have our stop fishing the script. So we are actually just going to be looped through until we hit the point which is right here. And then again, we will be able to fish and so on and so forth.

So right now it is working so we can actually hook we start fishing, but we cannot stop. So let's do our stop real fast. So for the start, we're going to say can move equals false like this camera tween that kill equals false. Then we're going to say camera when equals to Main camera.transform.do move y y Moving by to the zero duration to only queue and then false like this false. That dot Come on dot point update, update, and I will have our delegate delegate. The lead gave this.

We're checking here if our main camera that transform dot position, dot y is greater or equals to minus 11. If that is true, we're going to say transform dot set parent is no such parent is now we're going back to normal. And we're saying transform dot position equals new vector do you actually not three and that is transform dot position dot x, and then negative six. So this is where our hook will end up. So bad beginning. Now on complete so this is an update on complete gate.

When our, when our, what's called our hook is done when we start fishing we're gonna say transform dot position equals to vector dude down multiplied by six so meaning they're just point pointing it to the negative six. Then we're going to say collider dot enabled equals to true. Once again, int num equals to zero. So for and that here will have hearing out the hook from the fish is good we cannot do right now. Have our idle, idle idle manager, manager total gain to be equal to num. So we're going to do this all then and then we're gonna have I mean we're gonna display it on scene manager.

And screen like this. So do not get confused by these what call these comments this is just so with I once at idle mentor or I can go back to the hook and know what is missing. So I know what can I add one more once more me. So yeah, right now when I start we should have start and finish for our hook. So we click we start fishing, we catch the fishes or actually do not catch anything. Once that is done, we should go back.

So that is only the real problem that we have now. And it's still a problem we're still not going back. Oh yeah we are. As you can see, when we hit the we hit the what's called the ah the point where we should finish We are finished. So he will stop fishing like this everything seems to work fine. I mean, it does to you it may does not look like it but you will see once we have added the fishes and so on.

So guys that will be it for this video and I will see you guys in the next one

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.