Welcome back.
In this video, I would like you to add all the different models that we have created to your game.
So you can always compare it to the orange that we have created and actually to the orange prefab that
we have created.
So compare that and try to build the same thing for the watermelon, the banana, and whatever else
you have built.
All right, so post the video, try that and make it so and finish that so that you can randomly spawn
those different kind of fruits in your game.
And they all work as intended.
All right.
I hope you try to do that.
So let's go ahead and start with the watermelon.
So I'm going to drag the watermelon in there.
And as you see, it's quite big.
So I'm going to scale it down to 0.4.
So the model itself, so click on the model, scale it down and apply.
And next, the same thing with the watermelon cut.
So 0.4 and then apply that.
Now the watermelon needs several components.
For example, it needs a rigid body two DX with a collision detection, which is continuous.
And then, of course, it needs to tag interact table.
Now, next, it needs a Physics two DX Circle Collider.
And that's about the watermelon.
So of course needs to be as trigger as well because otherwise it won't trigger.
The event is trigger, which took care of slicing our watermelon.
And finally, it needs a script.
So let's go ahead and add that script called Fruit.
And the fruit script expects a sliced fruit prefab, which we, of course, will need to create in a
second.
So now let's go ahead to watermelon cut.
So our watermelon cut should get the intractable tag and those watermelon cut objects in here.
They need to get a physics, rigid body.
In this case, it's a3d rigid body, as you might know, as you might remember, about what we did for
the orange.
And it needs a physics box collider.
So I'm going to just keep it simple.
I'm going to use box colliders.
As you can see here, they are automatically created for me.
Now, those ones don't need to be triggers.
But what we can do now is we can take that watermelon cut and drag that into our prefabs folder.
So let's go to our prefabs folder and let's drag the watermelon cut.
And now let's go to our watermelon and drag that watermelon cut prefab into sliced fruit prefab.
And now we can drag the watermelon itself into our prefabs as well.
All right, so now we have the watermelon.
Let's go ahead and do the same thing with the banana.
So let's go to the objects here, to our models.
And now let's change the scale of the banana to 0.3 and apply that.
Now do the same thing with a banana cut.
So let's scale that to 0.3 as well and apply that as well.
And now.
As you might remember, we need to add a physics rigid body, which is continuous.
And in this case, I'm going to keep it simple.
I'm going to add a circle collider with the radius of 0.5.
Actually, seven should be good 0.7 with no offset.
And of course, this trigger is activated.
Now, the banana needs to get the tag intractable as well.
Now we need to add the component.
So let's add the script fruit.
And that one expects a sliced fruit prefab.
So let's create that banana cut.
Needs to get the tag intractable then it needs.
Well, actually, both banana left and banana right need to get the relevant components, which are
a rigid body and which are physics box colliders.
Now we create those two box colliders for the two different pieces.
So banana left and banana right.
Now that that is done, we can drag our banana cut into our prefabs folder.
So let's go to prefab or actually let's drag the banana just into the prefabs folder.
And in here the banana itself, not the banana cut, needs to get a sliced fruit prefab, of course.
So let's drag that in there.
And now let's drag the banana to our prefabs as well.
So if that was everything all right, we can get rid of those bananas, or actually, let's leave them
in there.
Maybe we should try to test them.
We can get rid of the cut one.
So let's delete watermelon cut and delete our banana cut.
Now, in our sponsor, we have the different objects to spawn.
And so far I only had one which was my orange.
And now I want to have two more.
So I'm going to enter three.
And as you can see, element zero is orange.
And I meant one is orange and two is orange as well.
And I would like to change that.
So I'm going to drag banana is element one and watermelon as element two.
And now if you have anything else such as whatever you come up with, then please go ahead and drag
that in there as well.
So if you have an apple or, I don't know, a peanut.
Or a coconut or something like that.
Please add that in here as well.
Okay.
So now let's see if that works.
Let's start the game.
Let's see if we get all those random objects.
And as you can see, I can.
Well, I screwed that up.
I can destroy bananas.
I can destroy my little peanut or watermelons.
Well, yeah, so I think.
It works fine and all of my objects get destroyed whenever I dash through them and if I lose the game.
So let's try that.
As soon as a bomb comes up and the we are game over, let's see all the objects at the site and restart
and all of them get destroyed.
Great.
So now we have a game which is already pretty much like fruit ninja.
There's not that much missing.
And in the next video, we are going to have a look at some preparation for Android.
So we're going to prepare the game so that it can run on an Android device.
So see you in the next video.