In this lecture, we'll implement our beginplay, tick, and shoot functions. Here they are on the UML diagram, so let's go get to work. There's a lot of new code for this lecture, so I've already typed it in and we'll talk about it instead of having you watch me type it all in as we go. I'm in the fish pawn header file. Here are the fields we declared before, I changed the WasShot variable to use a braced initializer. As we scroll down, I've added the OnOverlapBegin function that will be called when the fish overlaps with something in whatever game the fish is included in. We already looked at the getter and setter. We have MoveHorizontally, so the player will be able to move the fish horizontally, and the player will be able to shoot the fish. Now as I say that, you should recall that I typically use a structure where I have a pawn that's controlled by a player controller, and the player controller responds to all the players input and then calls functions in the pawn. I'm continuing with that approach here, so I've added a player controller as well. We'll look at the player controller before we finish the lecture, but we'll focus on the fishpawn first. In the implementation or source file for the fishpawn, in BeginPlay, recall that I said that in the past you've seen me initialize HalfCollisionWidth and HalfCollisionHeight with numbers that I got from looking at the static mesh. This is a different way to do that where you can access that information at runtime, so I have an F vector for the origin of the pawn, I have an F vector for what's called the BoxExtent for the pawn, so this is the extents of the pond, the dimensions of the pawn. Then I call the GetActorBounds function with true, the Origin, and the BoxExtent, and you can go read the documentation to see what each of those is, but we really care about BoxExtent because BoxExtent gives us half the depth which we don't care about in X, half the width and half the height in the Y and Z field. We can just set half collision width to BoxExtent.Y and a half collision height to BoxExtent.Z and that gives us the half collision width and half collision height at runtime instead of having as hard code them. You've seen a saving the static mesh component for efficiency in numerous previous lectures, and I've set up the delegate for it collisions with something else here, just like you've seen me do in the past as well. I did actually move this code inside this if statement to make sure that the StaticMeshComponent isn't null when we do that. In Tick, you've also seen me consume the pending movement input in a pawn, this time, I'm making sure that I'm taking that pending movement input that I made sure in a different function which I'll show you, is between negative one and one, and I multiply it by MoveAmountPerSecond, and I multiply it by DeltaTime, and that makes sure that our response to player input is frame rate independent. This is better than using Move amount per frame, because this will make sure it's the appropriate amount based on how much time passed for the previous frame. I do this standard stuff except I only do it in Y, we're only going to move our fish horizontally. I've left this OnOverlapBegin blank, I've included these structure for it, I've included what's often called the stub for a setting this all up so it will get called on an overlap, but the behavior that will occur when an overlap occurs will be game dependent. I've put it in here and whoever puts this into a game and then starts using it will add whatever behavior is appropriate in this function. We've already seen our getters and setters and moving the fish pawn horizontally, we clamp the move scale to be in between negative one and one, and then we add that movement input and then we consume it in the tick function as I showed above. Finally, shooting the fish, we're going to add an impulse force to our Static Mesh to shoot the fashion we've seen that before as we were adding an impulse force to Ted to make him go collect the next pickup, but I'm checking to see if the fish wasn't shot before I do this. Because if the fish was shot, we don't want the player to be able to spam, the space key. We'll use the space key to shoot the fish, and if they press the "Space Key" after they've shot the fish, it would add more impulse force to the fish so we could make the fish go faster and faster by spamming the space key. This flag will make sure that we only add an impulse to the fish if was shot is false. Then when we add this to a game, we'll actually see where we change was shot back to false again. Again, that will be game dependent, so you might change was shot back to false after a certain period of time, and bringing this ranged weapon back to the player, you might do it after the fish leaves the screen. There are different possibilities for when you'll reset way shot to false, so we leave that up to whoever is using this class in a game to handle that particular toggling of the WasShot flag. That's it for the implementation of the fish pond method, I'll show you in the Player Controller that we set up the input component, we move horizontally and we shoot the fish. Then in the implementation, we set up that movement key binding as you've seen before, and we set up that shoot key binding as you've seen before. Moving the fish horizontally is just as in the key board word processing lecture from the unreal input lesson in the previous course, and shooting the fish looks very similar as well. Over in the editor, I've taken the C++ classes, and of course I added a custom game mode as well to set the player controller and pawn, and I turned those classes into blueprint and when I run the game and get focused in the viewport, I can move left and right, and I can use a and left and it stays clamped at one for that movement, and finally, I can shoot the fish by pressing the "Space Bar." That's the implementation of the functions in the fish pond class. To recap, in this lecture, we implemented our begin play tick in shoot functions, and we realized we need a player controller to handle player input using our typical approach. It's important to note that when we're designing and implementing Unreal Engine classes, we need to understand how our C++ code interacts with the Unreal Engine.