LEARN CODING WITH GAME

**Adding Interactive Elements to a Game**

Now that we have set up our game with fish and sharks, it's time to add some interactive elements to make it more engaging. We will start by adding a broadcast message repeat feature. This will allow us to change the color of the shark at regular intervals. To do this, we need to use the "weight" setting in the control panel. So, in the control panel, we will select the weight option and set it to 25 seconds. This means that every 25 seconds, the shark's color will change.

**Color Changing Effect**

Now that we have added the broadcast message repeat feature, let's see how it works. We move back to the big screen and watch as the shark changes color every 25 seconds. This is a simple but effective way to add some visual interest to our game. We can also use different values for this setting to change the frequency of the color change effect.

**Adding a New Character: The Crab**

Next, we want to add a new character to our game - the crab. The crab should be able to move around the screen and bounce off the edges. To do this, we need to use the "forever" setting in the motion control panel. So, we select the foreverse option and set it to 5 steps. This means that the crab will move in a zig-zag pattern across the screen.

**Crab Movement and Bouncing Off Edges**

Now that we have added the crab's movement to our game, let's see how it works. We start the game by clicking on the play button. The crab starts moving across the screen, bouncing off the edges as it goes. This is a fun and challenging element to add to our game.

**Changing the Crab's Direction**

Next, we want to change the direction of the crab's movement. To do this, we need to use the "rotation" setting in the motion control panel. So, we select the rotation option and set it to 40 degrees. This means that the crab will move in a curved path across the screen.

**Crab Movement in All Directions**

Now that we have changed the crab's direction, let's see how it works. We open up the game again and watch as the crab moves across the screen in a curved path. The crab is now moving in all directions - left, right, up, and down.

**Adding Fish Movement**

Next, we want to add movement to our fish. To do this, we need to use the "weight" setting in the motion control panel. So, we select the weight option and set it to 50%. This means that the fish will move at half speed across the screen.

**Fish Movement with Finger Input**

Now that we have added movement to our fish, let's see how it works. We click on the play button again and watch as the fish moves across the screen in response to our finger input. The fish is now moving along with our finger, creating a fun and interactive element to our game.

**Adding Difficulty to the Game**

Next, we want to add difficulty to our game by introducing new challenges for the player. One way to do this is to make the crab more difficult to catch. To do this, we need to use the "forever" setting in the motion control panel and set it to 5 steps. This means that the crab will move in a zig-zag pattern across the screen, making it harder for the player to catch.

**Crab Movement with Random Positions**

Now that we have added difficulty to our game, let's see how it works. We start the game again by clicking on the play button. The crab starts moving across the screen in a zig-zag pattern, but now its position is also random. This adds an extra level of challenge to the game.

**Shark Movement and Catching Fish**

Next, we want to add movement to our shark. To do this, we need to use the "weight" setting in the motion control panel. So, we select the weight option and set it to 25 seconds. This means that every 25 seconds, the shark's color will change.

**Shark Movement with Finger Input**

Now that we have added movement to our shark, let's see how it works. We click on the play button again and watch as the shark moves across the screen in response to our finger input. The shark is now moving along with our finger, creating a fun and interactive element to our game.

**Shark Catching Fish**

Now that we have added movement to our shark, let's see how it works. We click on the play button again and watch as the shark moves across the screen in response to our finger input. The shark is now moving along with our finger, creating a fun and interactive element to our game. When the shark touches the crab, the score resets to zero.

**Final Touches**

Finally, we want to add some final touches to our game. We will use the "rotation" setting in the motion control panel to change the direction of the crab's movement. We select the rotation option and set it to 40 degrees. This means that the crab will move in a curved path across the screen.

**Game Testing**

Now that we have added all the interactive elements to our game, let's test it out. We start the game again by clicking on the play button. The shark moves across the screen in response to our finger input, while the crab bounces off the edges and changes direction randomly. This is a fun and challenging game that will keep players entertained for hours.

**Conclusion**

In this tutorial, we have learned how to add interactive elements to a game using our control panel. We added a broadcast message repeat feature to change the color of the shark at regular intervals, and introduced new challenges by making the crab more difficult to catch. We also added movement to both the fish and shark, and created a fun and interactive element to our game. With these interactive elements in place, we have created a fun and challenging game that will keep players entertained for hours.

"WEBVTTKind: captionsLanguage: engood morning students today we are here to learn the coding with scratch so first of all what is scratch scratch is the programming language through which you can program but the scratch is a visual programming language that allow the students to create their own ideas they can create a stories they can create a beautiful games using the this programming language that is scratch so today here we are going to develop a game in scratch that name is hungry shark game so let's start with the scratch okay students so now you have to open a google chrome or any web browser to open this programming so first of all you have to search for scratch in your google chrome or in google search engine so here this is the first website page of scratch so first of all you have to login with your account so on this i have already login with my account so first you have to create your account on this website after that you have to click on create button so before going to create an animation or create a game first i'll display the games that i have developed using this website so open so this is the game that i have already designed so after this session you all are also able to design a game in this website or using the scratch programming language click on this button to start playing so here is a shark that is moving along with my finger and catch the fish and you can also check here is school so i'll just open it in large screen so there are so many fishes on the see and there is shark that is eating the fishes and then it's touch this crab and the score is zero so after this session you all are able to develop the game like this using the scratch programming lab students so now we will learn how to create that game that is hungry shark that is eat the fish is in the sea so first of all you have to click on create button and then you will navigate to this window so here on the right hand side we have all the controls so which we can use in our programming so here this one area is for the stage area there we will write the code for our sprite so this cat is named as a sprite in this scratch so for these animations for these animations we will write the code on this stage and when we click on this play button so that code will execute so today we are going to develop a game hungry shark so for that we need a shop but here is a cat so first we have to delete it to delete this cat we have to click on this delete button to delete it now we have to add the shark sprite on this stage so far click on that button search for shark so this is the sprite area from where you can search for the difference price which you can add in your programming so first of all we have to search for shark so click on search button and type sha so this is the shark 2 which we are going to add in our programming so as you can see that it's added after adding the shark so here this shark is added into this stage so now we are going to code for this shark so first of all we have to go to the code control event so means when we click on this play button so this shock will start work so you can check that click on motion so we add this with this so we have added the code when we click on this shark so it moves 10 steps so when we click so it moves 10 steps so this is our shock so when we click on this play button so this shot will move 10 steps so every time when you click on play button it moves 10 steps to the right hand side so you can increase the steps for example 100 and now when you click on this button so it's move 100 steps okay now we will write the code for this shock so when we move our mouse pointer around this shark so the same this will also move around our finger or around along with our mouse pointer so first of all we have added this code when clicked it started playing so i'll reduce the size of this shark to 50 now we have to write the code means whenever we move our finger or when we touch the screen so it's move around with touch so that is the again and again means the repetition of code so for that we will use this forever code so we this shock will move as along with our finger again and again so now it will move towards our pointer that is a mouse pointer so here we will look for sensing motion so points towards mouse then when we click somewhere so this shock will move a five step for that we have to use if condition so that we will find in controls if we touch somewhere then this shock will also moves a five step or ten steps for that we have to get the operator the value that is 5 click on this and enter the value 5 steps so now this will shock will move as per our finger touch so this sharp will touch nearby the mouse pointer so for that we have to find the control to add it so that is in motion so this will distance to the mouse pointer if the distance from mouse pointer i'll just move this on left hand side so it's clearly visible to all of you so means when we click on this play button so this will set the size of this shark to 50 percent so it's reduced and make it small size so then in forever loop so this will whenever we point with the mouse pointer so this shark will also moves the five steps so for that we have to go for motion and take five steps click on the steps and enter the value 5 so now we will click on play button to check whether this is working or not for this we will first of all open the full screen mode so here is a sharp so i'll click on play button so let's move to top side so when i click here so it's move click on so as i click with my finger on the screen so or you can touch with your mouse pointer though fish will move along with that direction so as you touch so this shock will move as the direction given by u so now this is the first stage for our game so this is the shock now we have to add the fish we have to click on stop and go back to our coding panel now we want the fishes in this c for that we have to add the fish sprite click on this button and search for fish click on search button and type fish so here we have fish so now you can see that fish is added into our game so now here we have to write the code for this fish okay students so now we will write the code for our second fish so first of all when we click on play button so we will add that control so when we clicked on it so this fish is sizes also we want to reduce so then first of all we will go into the looks and from here we will add the control to decrease the size of second fish so change the size or set the size to 50 percent set size to 50. next is that so first of all if in this c only one fish is that it's not possible so we will add the control for to create the clone of this fish in this c so for that we have to take forever loop forever this fish will create its own clones for that we will click on this and then move to create cologne so event then here we have added forever loop then this fish will create their clone again and again after every one seconds so now we will check the code click on play button so this fish size is also reduced this is our shark and it will create their clone again and again so here we have another fishes so that are creating their clone but they are creating create their clone at the same location so we have to move the clone to the next position for that we will add the code for move statement so now when we click on this play button so this fish will create their clone but they are creating their clone at the same place so now we have to add the controls for that so for that you can click on control panel and search for when i start as a clone so when new fish clone is there so it will move the three steps for that we have added this forever loop and the move three steps so now click on play button to check this so this is our shock which is moving along with our finger and this fish is creating their clone and they are moving to the other side but they are going out from the frame for that we will add the control when we touch the stage or when we touch the edges so it's move back or rotate the directions so we will click on stop button and now we will add the control for that click on the second fish so forever it's move three steps but when it's touch the edge so it rotate in other direction okay so here we have added from the motion if on edges so it's bounce back click on play button to check this code so this is our shark and this fish is creating their clone and they are moving three steps and then when they touch the edges it bounce to the back rotation so in this way they are creating the number of other fishes in c so here we will add some more code so this fish is creating all the fishes from same place so it will also change their place from anywhere when we click on this play button and you can also see that all the fishes are going in same direction okay so we will change their direction when they bounce so for that first of all we have to take this point in direction when i start clone so it's start point in direction then we have to change the location of this so for that we will click here turn the angle but that angle we are going to choose a random angle by default it is at the 50 degree so for that you can go for the operator value and from there you can choose a value pick the random number from 1 2 15 or 1 to 10. so turn pick a random angle from 1 to 10 degree or 1 to 15. so this fish will start moving and create their clone at the different directions so we will click on this play button again to check whether our code is working or not click on this play button so you can check that these fishes are start bouncing and they are creating their clone and they are moving in this c at the different locations okay so we have designed the game with the shark and fish now you can see that the background is completely white color so we can change the background of this game for that we have to click on background and then click on search button so here you can see that underwater click on this here you will get the beautiful pictures or beautiful design the animations for the background of your game or any other animation which you are going to create so from here i am just select this underwater two so you can see that this is our game i just open in large screen so this is our game sr fish this is shark so when i click on play button so it's creating the other clothes and the shark is moving along with the touches so when this shark touch any fish it the fish are going on so they are just creating the other fishes so now we have to write the code for this shark when this shark will touch any other fish it eats them for that we have to move again back to the coding part so for that here we have to get the if condition if this shark touch this fish for that is showing that we have to add the effect like it's eating them for that we have get if condition if this shark now we have to take the operator so now here we have to write the code for this if this shark touch this fish so then it will eat that shark eat that fish and this shark will get a point for that first we have to add the code here for scoring for that click on my block and click on variable and make a variable type the name here for your variable name like we want to add this co for that we will write the variable name as score and click on ok so here is our score but now we have to write the code for this means when this shark touch the fish it will add the one point in our school so for that means we have to change the value of this score by one for that we will click on here change my variable by one if this shark touch any fish so from here we will select score by one now we will check this code is working or not for that we will click on play button i'll just open it in large screen so here the fish is and here we have sha so as we move our finger so it touched the fishes and our score is increasing but after that the same fishes are same in our underwater or in our sea so means we have to change the code means when the shark touch any other fish so it eats them so we will write the code for that for that it means we have to hide that fish so when anisha this shark will eat any fish so it's hide them for that we have to add the code here so i'll stop this code and click on motion looks so it will hide them click on this and add here hide and add the show control so when it's cloned it's show them so now we will check it again start in large screen click on play button so its initial score is 8 43 so it's not showing them means we need to do some correction in our code stop it and come back to our code again so here we have added show here we have added height but this height comes in the this section if this touch or shark this will hide them so now click on play so it's creating the shark so this fishes are there and this shark is moving on the top area so when it's touch any fish so it's height so now our shock is start eating fishes so you can also check that it's also increase our score so we have to add the difficulty uh now these fish is all our fish is in same color so we have to add the code for that so first we move back to the coding panel stop this game when you click on this costume you can check that this fish has four costumes so now we will write the code for that so when this will clone a new fish it will clone in new costume for that we have to go for looks switch to new costume or you can select here the different color okay so now we have to add the new costume when this will clone a new fish so here we will add when it's create a new clone so it's added the new costume so now check the code open in full screen click on play button so you can see that when it's cloning it's creating a new costume so here are shark come and start eating the fish the yellow fish blue fish other fishes so let's start eating them and you can see there is a score is 875 it means it store the previous result also so means we have to change the code means when we start this program it's initially set the value of score to 0. move back to the variable and change set my variable at 0 when it's start select the variable name scope click on again click on play button so initial score is zero and here the new fish is so now our shark will come again and start eating the fishes so eat one fish once go second fish two scoop three score and our score is it keep increasing so as we move our finger as we move the mouse pointer it start increasing the score as it ate the fishes so now we will add some more control in this okay so now we have added the costume to this fish so when this fish create a new clone now we will click on this play button so so we will touch in the middle we will move this shock so just say yes it will touch the other fishes catch the other fishes and our score is increasing so you can see that our score is again increasing to 42 and it's still increasing when this shark touch the fish now you can see that these all fishes are creating from one point so if the player moves this shark at this initial position then it will eat all the clones and you can see that the pattern of these fishes is same so now we will change the code so that we can show that this fish make its clone randomly on the this side so it will generate the new fish clone at the random location in this sea and then this shark need to be move to find the exact location of new fishes and you can see that there is a pattern also changed for the other fishes in our sea so let's change the code for the fish that create its clone at the new location so we will move back to the small one position so now you can see here that so when i start a clone so this fish will show point in direction at 90 degree so this is a forever loop turn from the random position uh at the degree one to ten move three steps so if it edges the bounce then it's if the shark touch so we have complete this code so now we will change the code for this fish so this fish will create a new clone at the different location on our x-axis and in y-axis okay so now we will add the code in this when we click so it start creating its clone okay so now we have to change the location of this fish that creates its clone so we will choose the location means we will take this go to and in forever loop go to x and y so this is the initial position of this fish on this c okay so we will make all the fishes are created randomly from anywhere in location so then we have to use random function along with the x and also from the y but first we will make x as a static means we want to enter all the faces from this side means from the left hand side or from the y axis into the c so we will use the random function with y so random function that is available in operator so we will pick a random value for y and that random value is from minus 180 to 180 okay so as you know that in x-axis and y-axis so between the middle point next side is the minus value and on the right hand side we have a positive value so we will choose a pick the value of y axis from minus 180 to 180 as a positive value so now let's see the change so we will play this again in the full screen mode okay and we will when we click on this play button so it start initial value is zero so now you can see that this fish is creating a clone from the random positions so one is this one is this one is this so they are creating their clone at the different locations so we can also change one more thing in this we will back to the code so now in this when it's turned at the random size is 1 to 10 degree so you can increase this point value also like 15 you can change this value and do the experiment and check how these values are changing from one to another okay so we have changed the value so now we will check in on this screen at this time so it's create a random and you can also increase the angle greater than this value for example i just make it 44 stop and to play to see the new change so they are creating the new fish at the different locations and so it will create a new picture so in this way you can change these values as per your requirement so you can check okay so we will change it again back to 10. so in this way you can change the angle you can change these values as per your requirement and see how this looks next is that we want to make it more difficult means this fish this shark is keep eating the fishes and increasing the score now we want to make it more interesting like we want to add the difficult level so for example we want to add one more type of a fish okay so now you can see that we have changed the angle of the fish movement so it's a turning angle is changed from minus 10 to 10 so you can see that it's create a beautiful picture so this animation is created in a very good way so it will produce a sound so now we will move back to our coding part so stop this game and move to coding one so now here we have to add the code means when this shark catch any fish it also generate a sound for that we will use the sound code so we will use the code for sound for example we want to produce the sound like from here we can take a sound and here we will add means given it when a shark touch then it change the score and also play a sound so here we have ocean wave sound but we want to use some other sound then you can choose that sound so first of all we will add that sound in this profile so here we have only two sound one is bubble sound you can check and play second sound is the wave sound for that we will click on this button this icon to add the sound like we want to add pop sound so we will open this sound gallery that is already available in your scratch software on this website this is already available so you can play any sound and check you can play any other way so now we want to search for a sound like a pop type so here we will type the word pop so here we have two type of a pop sound one is this second is so i'll just use this one sound this pop sound in our picture so we will check this sound again so this is a sound so now we will move back to our code part and here we will select the sound pops out now you can see that here we have three sound bubble wave and pop song so we will choose pop sound okay so play the pop until done now we will play this game again so now this is our shark is a fish and now when we move our point so it when this shark catch any fish it play a sound pop um so now i'll stop this game foreign so here we have you can check which are the other costume which are available for our shop this is the one foreign so we will add the code first in this fish and then we will write the code for shock to change its cost oh here we will add the code means so it will create a broadcast message and then that broadcast message we will use in shock to change its costume so here we will choose a broadcast message here the first this shark will touch the fish and then is change the score to 1 then play the pop sound means when that fish touch any other fish then a shark will touch any fish it produce a pop sound then it will broadcast a message so now what is the broadcast message that we will add here the new message so here we have to type that so this is a new message window so here we will type the message that we want to generate or broadcast for r shark to change its costume so here we will type that so after typing the message we will click on ok so broadcast will generate a message a shark touching fish so now we will select our shark and now we will add the code here when how this shark will change its costume for that here we will get that broadcast message from that way from here we will check this one code so when i receive shark touching a fish so this will change its cost so now this shark will change its costume like first is change the costume to the second then it move back to the costume again back to the this one costume that is means a costume so this will do it in a repeat so here we will select this control from here we will look for repeat so here we will pick this repeat block and add with this so we will change this to three so now here we will add the look change panel so it will change its look back to the costume so it will change its costume from here we will select change costume so first this will switch the costume to b a1 this one b that is with open mouth and c is that in sleeping mode so we will change its costume to b now we will add a weight means for one second or for a two second how much time we want to change its costume when it's we want to create the animation like this shark is eating the fish skeleton so repeat this step three time switch costume to shock b and then it waits for one second now this will change its costume back to the first one so we will change switch the costume to a okay so now we will check how our code is working so this is the initial position we will click on this play so now you can see that this is our shark and when it touch any fish it opens its mouth and then after one second it change back to the foreign now we will add more controls like first we will stop this game and back to the coding part now here we have add the broadcast message repeat changes costume back switch to the a position now we will add more like this shark is only with one color that is with blue color now we want to create its color with the other one methods like is change its color to any other color so we will use the first of all we will use the weight so in control panel we will use this waiting so let's wait for one second and then that change color effect by 25 so we will also you can use another value for this now let's see how this code is working so move back to the big screen so now this is the new color of fish so we will click on play button to see how is work so every time when this fish eat when this shark eat a fish it changes color so when the fish come to our shark okay so after adding these things so now is our score is 260. set the size of fish to 50 percent so we have added this so now we will add the difficulty for this so we will add one more thing so we will add this so now we will add the code for this crap so first of all so when i click play so means so when event start when we click on this start button so again we will do the some settings like it will reduce the size of this crab so this crab is too much large and also we will add the code to change its position from one to another and also when our shark will touch this crab so let's change the score back to zero so now let's do that code for our crab here so now we will select the code for our cap so first of all we have set the size to 50 percent now when this crab touch this fish so we have to add the code means it do again and again means when this grab touch the shock or shock touch this grab it set the score to zero so this is the repetition mode so we will go in controls and use foref so forever first we will add these steps for movement of this scrap so we will use again in the motion control so this grab will start moving five steps so move a five step secondly if this crab touch the bounce is this crap touches the edges is bounce back in our code so we will add that so if on edge it's bounce so now we will check our code again open in large screen start play button so initial score is zero so this grab is moving and strike with the edge and bounce so you can see that this is doing it again and again only at the center part so we will change the rotation of this crab from one to another method so we will stop the code and move to the coding one so here we will add or change the direction of this crab so point in direction we will change back to the 40. so i'll just change to the 45 degree so this will change its position so now this is moving all over the screen i'll just open it in so now this grab is moving from one to another location in all direction so it's covering the entire area on the c so this is done for the crab so crab is moving in all direction our fish is moving along with our finger point when we touch somewhere it's move along with our mouse pointer okay and our fish is greatest clone and that is moving all over the sea so now when this shark touch the crab then it set the score to zero so we will add for that code in this forward loop so here we will move in if events so from here we will take if so here if this sharp touch so here we will take sensing from here so from here we will use set score 0 so now let's check the code whether it's working or not so this is our shock so it's initial at zero so now shark is moving along with our finger and catch the fish score one two three four five six and then it's this strike with the crab and you can see that score is again starting from zero so we will strike again with the crab check the score so we have to catch this crap so you can see that it's zero again so now we have added the difficulty for our shock so it's set the score again 0. so now we will add more things in our code for this shock so now you can see that when this sharp touch with this grab it set the score zero and it's take we have to add the waiting time for the shark means it move away from that crack so we will use a weight control so from here we will use weight for one second so in this way we will add a timing for this so now you can see that this is our game at the initial position we will stop this and play it again so now initial score is zero and this fish is creating the random positions thank you have a nice daygood morning students today we are here to learn the coding with scratch so first of all what is scratch scratch is the programming language through which you can program but the scratch is a visual programming language that allow the students to create their own ideas they can create a stories they can create a beautiful games using the this programming language that is scratch so today here we are going to develop a game in scratch that name is hungry shark game so let's start with the scratch okay students so now you have to open a google chrome or any web browser to open this programming so first of all you have to search for scratch in your google chrome or in google search engine so here this is the first website page of scratch so first of all you have to login with your account so on this i have already login with my account so first you have to create your account on this website after that you have to click on create button so before going to create an animation or create a game first i'll display the games that i have developed using this website so open so this is the game that i have already designed so after this session you all are also able to design a game in this website or using the scratch programming language click on this button to start playing so here is a shark that is moving along with my finger and catch the fish and you can also check here is school so i'll just open it in large screen so there are so many fishes on the see and there is shark that is eating the fishes and then it's touch this crab and the score is zero so after this session you all are able to develop the game like this using the scratch programming lab students so now we will learn how to create that game that is hungry shark that is eat the fish is in the sea so first of all you have to click on create button and then you will navigate to this window so here on the right hand side we have all the controls so which we can use in our programming so here this one area is for the stage area there we will write the code for our sprite so this cat is named as a sprite in this scratch so for these animations for these animations we will write the code on this stage and when we click on this play button so that code will execute so today we are going to develop a game hungry shark so for that we need a shop but here is a cat so first we have to delete it to delete this cat we have to click on this delete button to delete it now we have to add the shark sprite on this stage so far click on that button search for shark so this is the sprite area from where you can search for the difference price which you can add in your programming so first of all we have to search for shark so click on search button and type sha so this is the shark 2 which we are going to add in our programming so as you can see that it's added after adding the shark so here this shark is added into this stage so now we are going to code for this shark so first of all we have to go to the code control event so means when we click on this play button so this shock will start work so you can check that click on motion so we add this with this so we have added the code when we click on this shark so it moves 10 steps so when we click so it moves 10 steps so this is our shock so when we click on this play button so this shot will move 10 steps so every time when you click on play button it moves 10 steps to the right hand side so you can increase the steps for example 100 and now when you click on this button so it's move 100 steps okay now we will write the code for this shock so when we move our mouse pointer around this shark so the same this will also move around our finger or around along with our mouse pointer so first of all we have added this code when clicked it started playing so i'll reduce the size of this shark to 50 now we have to write the code means whenever we move our finger or when we touch the screen so it's move around with touch so that is the again and again means the repetition of code so for that we will use this forever code so we this shock will move as along with our finger again and again so now it will move towards our pointer that is a mouse pointer so here we will look for sensing motion so points towards mouse then when we click somewhere so this shock will move a five step for that we have to use if condition so that we will find in controls if we touch somewhere then this shock will also moves a five step or ten steps for that we have to get the operator the value that is 5 click on this and enter the value 5 steps so now this will shock will move as per our finger touch so this sharp will touch nearby the mouse pointer so for that we have to find the control to add it so that is in motion so this will distance to the mouse pointer if the distance from mouse pointer i'll just move this on left hand side so it's clearly visible to all of you so means when we click on this play button so this will set the size of this shark to 50 percent so it's reduced and make it small size so then in forever loop so this will whenever we point with the mouse pointer so this shark will also moves the five steps so for that we have to go for motion and take five steps click on the steps and enter the value 5 so now we will click on play button to check whether this is working or not for this we will first of all open the full screen mode so here is a sharp so i'll click on play button so let's move to top side so when i click here so it's move click on so as i click with my finger on the screen so or you can touch with your mouse pointer though fish will move along with that direction so as you touch so this shock will move as the direction given by u so now this is the first stage for our game so this is the shock now we have to add the fish we have to click on stop and go back to our coding panel now we want the fishes in this c for that we have to add the fish sprite click on this button and search for fish click on search button and type fish so here we have fish so now you can see that fish is added into our game so now here we have to write the code for this fish okay students so now we will write the code for our second fish so first of all when we click on play button so we will add that control so when we clicked on it so this fish is sizes also we want to reduce so then first of all we will go into the looks and from here we will add the control to decrease the size of second fish so change the size or set the size to 50 percent set size to 50. next is that so first of all if in this c only one fish is that it's not possible so we will add the control for to create the clone of this fish in this c so for that we have to take forever loop forever this fish will create its own clones for that we will click on this and then move to create cologne so event then here we have added forever loop then this fish will create their clone again and again after every one seconds so now we will check the code click on play button so this fish size is also reduced this is our shark and it will create their clone again and again so here we have another fishes so that are creating their clone but they are creating create their clone at the same location so we have to move the clone to the next position for that we will add the code for move statement so now when we click on this play button so this fish will create their clone but they are creating their clone at the same place so now we have to add the controls for that so for that you can click on control panel and search for when i start as a clone so when new fish clone is there so it will move the three steps for that we have added this forever loop and the move three steps so now click on play button to check this so this is our shock which is moving along with our finger and this fish is creating their clone and they are moving to the other side but they are going out from the frame for that we will add the control when we touch the stage or when we touch the edges so it's move back or rotate the directions so we will click on stop button and now we will add the control for that click on the second fish so forever it's move three steps but when it's touch the edge so it rotate in other direction okay so here we have added from the motion if on edges so it's bounce back click on play button to check this code so this is our shark and this fish is creating their clone and they are moving three steps and then when they touch the edges it bounce to the back rotation so in this way they are creating the number of other fishes in c so here we will add some more code so this fish is creating all the fishes from same place so it will also change their place from anywhere when we click on this play button and you can also see that all the fishes are going in same direction okay so we will change their direction when they bounce so for that first of all we have to take this point in direction when i start clone so it's start point in direction then we have to change the location of this so for that we will click here turn the angle but that angle we are going to choose a random angle by default it is at the 50 degree so for that you can go for the operator value and from there you can choose a value pick the random number from 1 2 15 or 1 to 10. so turn pick a random angle from 1 to 10 degree or 1 to 15. so this fish will start moving and create their clone at the different directions so we will click on this play button again to check whether our code is working or not click on this play button so you can check that these fishes are start bouncing and they are creating their clone and they are moving in this c at the different locations okay so we have designed the game with the shark and fish now you can see that the background is completely white color so we can change the background of this game for that we have to click on background and then click on search button so here you can see that underwater click on this here you will get the beautiful pictures or beautiful design the animations for the background of your game or any other animation which you are going to create so from here i am just select this underwater two so you can see that this is our game i just open in large screen so this is our game sr fish this is shark so when i click on play button so it's creating the other clothes and the shark is moving along with the touches so when this shark touch any fish it the fish are going on so they are just creating the other fishes so now we have to write the code for this shark when this shark will touch any other fish it eats them for that we have to move again back to the coding part so for that here we have to get the if condition if this shark touch this fish for that is showing that we have to add the effect like it's eating them for that we have get if condition if this shark now we have to take the operator so now here we have to write the code for this if this shark touch this fish so then it will eat that shark eat that fish and this shark will get a point for that first we have to add the code here for scoring for that click on my block and click on variable and make a variable type the name here for your variable name like we want to add this co for that we will write the variable name as score and click on ok so here is our score but now we have to write the code for this means when this shark touch the fish it will add the one point in our school so for that means we have to change the value of this score by one for that we will click on here change my variable by one if this shark touch any fish so from here we will select score by one now we will check this code is working or not for that we will click on play button i'll just open it in large screen so here the fish is and here we have sha so as we move our finger so it touched the fishes and our score is increasing but after that the same fishes are same in our underwater or in our sea so means we have to change the code means when the shark touch any other fish so it eats them so we will write the code for that for that it means we have to hide that fish so when anisha this shark will eat any fish so it's hide them for that we have to add the code here so i'll stop this code and click on motion looks so it will hide them click on this and add here hide and add the show control so when it's cloned it's show them so now we will check it again start in large screen click on play button so its initial score is 8 43 so it's not showing them means we need to do some correction in our code stop it and come back to our code again so here we have added show here we have added height but this height comes in the this section if this touch or shark this will hide them so now click on play so it's creating the shark so this fishes are there and this shark is moving on the top area so when it's touch any fish so it's height so now our shock is start eating fishes so you can also check that it's also increase our score so we have to add the difficulty uh now these fish is all our fish is in same color so we have to add the code for that so first we move back to the coding panel stop this game when you click on this costume you can check that this fish has four costumes so now we will write the code for that so when this will clone a new fish it will clone in new costume for that we have to go for looks switch to new costume or you can select here the different color okay so now we have to add the new costume when this will clone a new fish so here we will add when it's create a new clone so it's added the new costume so now check the code open in full screen click on play button so you can see that when it's cloning it's creating a new costume so here are shark come and start eating the fish the yellow fish blue fish other fishes so let's start eating them and you can see there is a score is 875 it means it store the previous result also so means we have to change the code means when we start this program it's initially set the value of score to 0. move back to the variable and change set my variable at 0 when it's start select the variable name scope click on again click on play button so initial score is zero and here the new fish is so now our shark will come again and start eating the fishes so eat one fish once go second fish two scoop three score and our score is it keep increasing so as we move our finger as we move the mouse pointer it start increasing the score as it ate the fishes so now we will add some more control in this okay so now we have added the costume to this fish so when this fish create a new clone now we will click on this play button so so we will touch in the middle we will move this shock so just say yes it will touch the other fishes catch the other fishes and our score is increasing so you can see that our score is again increasing to 42 and it's still increasing when this shark touch the fish now you can see that these all fishes are creating from one point so if the player moves this shark at this initial position then it will eat all the clones and you can see that the pattern of these fishes is same so now we will change the code so that we can show that this fish make its clone randomly on the this side so it will generate the new fish clone at the random location in this sea and then this shark need to be move to find the exact location of new fishes and you can see that there is a pattern also changed for the other fishes in our sea so let's change the code for the fish that create its clone at the new location so we will move back to the small one position so now you can see here that so when i start a clone so this fish will show point in direction at 90 degree so this is a forever loop turn from the random position uh at the degree one to ten move three steps so if it edges the bounce then it's if the shark touch so we have complete this code so now we will change the code for this fish so this fish will create a new clone at the different location on our x-axis and in y-axis okay so now we will add the code in this when we click so it start creating its clone okay so now we have to change the location of this fish that creates its clone so we will choose the location means we will take this go to and in forever loop go to x and y so this is the initial position of this fish on this c okay so we will make all the fishes are created randomly from anywhere in location so then we have to use random function along with the x and also from the y but first we will make x as a static means we want to enter all the faces from this side means from the left hand side or from the y axis into the c so we will use the random function with y so random function that is available in operator so we will pick a random value for y and that random value is from minus 180 to 180 okay so as you know that in x-axis and y-axis so between the middle point next side is the minus value and on the right hand side we have a positive value so we will choose a pick the value of y axis from minus 180 to 180 as a positive value so now let's see the change so we will play this again in the full screen mode okay and we will when we click on this play button so it start initial value is zero so now you can see that this fish is creating a clone from the random positions so one is this one is this one is this so they are creating their clone at the different locations so we can also change one more thing in this we will back to the code so now in this when it's turned at the random size is 1 to 10 degree so you can increase this point value also like 15 you can change this value and do the experiment and check how these values are changing from one to another okay so we have changed the value so now we will check in on this screen at this time so it's create a random and you can also increase the angle greater than this value for example i just make it 44 stop and to play to see the new change so they are creating the new fish at the different locations and so it will create a new picture so in this way you can change these values as per your requirement so you can check okay so we will change it again back to 10. so in this way you can change the angle you can change these values as per your requirement and see how this looks next is that we want to make it more difficult means this fish this shark is keep eating the fishes and increasing the score now we want to make it more interesting like we want to add the difficult level so for example we want to add one more type of a fish okay so now you can see that we have changed the angle of the fish movement so it's a turning angle is changed from minus 10 to 10 so you can see that it's create a beautiful picture so this animation is created in a very good way so it will produce a sound so now we will move back to our coding part so stop this game and move to coding one so now here we have to add the code means when this shark catch any fish it also generate a sound for that we will use the sound code so we will use the code for sound for example we want to produce the sound like from here we can take a sound and here we will add means given it when a shark touch then it change the score and also play a sound so here we have ocean wave sound but we want to use some other sound then you can choose that sound so first of all we will add that sound in this profile so here we have only two sound one is bubble sound you can check and play second sound is the wave sound for that we will click on this button this icon to add the sound like we want to add pop sound so we will open this sound gallery that is already available in your scratch software on this website this is already available so you can play any sound and check you can play any other way so now we want to search for a sound like a pop type so here we will type the word pop so here we have two type of a pop sound one is this second is so i'll just use this one sound this pop sound in our picture so we will check this sound again so this is a sound so now we will move back to our code part and here we will select the sound pops out now you can see that here we have three sound bubble wave and pop song so we will choose pop sound okay so play the pop until done now we will play this game again so now this is our shark is a fish and now when we move our point so it when this shark catch any fish it play a sound pop um so now i'll stop this game foreign so here we have you can check which are the other costume which are available for our shop this is the one foreign so we will add the code first in this fish and then we will write the code for shock to change its cost oh here we will add the code means so it will create a broadcast message and then that broadcast message we will use in shock to change its costume so here we will choose a broadcast message here the first this shark will touch the fish and then is change the score to 1 then play the pop sound means when that fish touch any other fish then a shark will touch any fish it produce a pop sound then it will broadcast a message so now what is the broadcast message that we will add here the new message so here we have to type that so this is a new message window so here we will type the message that we want to generate or broadcast for r shark to change its costume so here we will type that so after typing the message we will click on ok so broadcast will generate a message a shark touching fish so now we will select our shark and now we will add the code here when how this shark will change its costume for that here we will get that broadcast message from that way from here we will check this one code so when i receive shark touching a fish so this will change its cost so now this shark will change its costume like first is change the costume to the second then it move back to the costume again back to the this one costume that is means a costume so this will do it in a repeat so here we will select this control from here we will look for repeat so here we will pick this repeat block and add with this so we will change this to three so now here we will add the look change panel so it will change its look back to the costume so it will change its costume from here we will select change costume so first this will switch the costume to b a1 this one b that is with open mouth and c is that in sleeping mode so we will change its costume to b now we will add a weight means for one second or for a two second how much time we want to change its costume when it's we want to create the animation like this shark is eating the fish skeleton so repeat this step three time switch costume to shock b and then it waits for one second now this will change its costume back to the first one so we will change switch the costume to a okay so now we will check how our code is working so this is the initial position we will click on this play so now you can see that this is our shark and when it touch any fish it opens its mouth and then after one second it change back to the foreign now we will add more controls like first we will stop this game and back to the coding part now here we have add the broadcast message repeat changes costume back switch to the a position now we will add more like this shark is only with one color that is with blue color now we want to create its color with the other one methods like is change its color to any other color so we will use the first of all we will use the weight so in control panel we will use this waiting so let's wait for one second and then that change color effect by 25 so we will also you can use another value for this now let's see how this code is working so move back to the big screen so now this is the new color of fish so we will click on play button to see how is work so every time when this fish eat when this shark eat a fish it changes color so when the fish come to our shark okay so after adding these things so now is our score is 260. set the size of fish to 50 percent so we have added this so now we will add the difficulty for this so we will add one more thing so we will add this so now we will add the code for this crap so first of all so when i click play so means so when event start when we click on this start button so again we will do the some settings like it will reduce the size of this crab so this crab is too much large and also we will add the code to change its position from one to another and also when our shark will touch this crab so let's change the score back to zero so now let's do that code for our crab here so now we will select the code for our cap so first of all we have set the size to 50 percent now when this crab touch this fish so we have to add the code means it do again and again means when this grab touch the shock or shock touch this grab it set the score to zero so this is the repetition mode so we will go in controls and use foref so forever first we will add these steps for movement of this scrap so we will use again in the motion control so this grab will start moving five steps so move a five step secondly if this crab touch the bounce is this crap touches the edges is bounce back in our code so we will add that so if on edge it's bounce so now we will check our code again open in large screen start play button so initial score is zero so this grab is moving and strike with the edge and bounce so you can see that this is doing it again and again only at the center part so we will change the rotation of this crab from one to another method so we will stop the code and move to the coding one so here we will add or change the direction of this crab so point in direction we will change back to the 40. so i'll just change to the 45 degree so this will change its position so now this is moving all over the screen i'll just open it in so now this grab is moving from one to another location in all direction so it's covering the entire area on the c so this is done for the crab so crab is moving in all direction our fish is moving along with our finger point when we touch somewhere it's move along with our mouse pointer okay and our fish is greatest clone and that is moving all over the sea so now when this shark touch the crab then it set the score to zero so we will add for that code in this forward loop so here we will move in if events so from here we will take if so here if this sharp touch so here we will take sensing from here so from here we will use set score 0 so now let's check the code whether it's working or not so this is our shock so it's initial at zero so now shark is moving along with our finger and catch the fish score one two three four five six and then it's this strike with the crab and you can see that score is again starting from zero so we will strike again with the crab check the score so we have to catch this crap so you can see that it's zero again so now we have added the difficulty for our shock so it's set the score again 0. so now we will add more things in our code for this shock so now you can see that when this sharp touch with this grab it set the score zero and it's take we have to add the waiting time for the shark means it move away from that crack so we will use a weight control so from here we will use weight for one second so in this way we will add a timing for this so now you can see that this is our game at the initial position we will stop this and play it again so now initial score is zero and this fish is creating the random positions thank you have a nice day\n"