Afrikaans
Akan
Albanian
Amharic
Arabic
Armenian
Azerbaijani
Basque
Belarusian
Bemba
Bengali
Bihari
Bosnian
Breton
Bulgarian
Cambodian
Catalan
Cebuano
Cherokee
Chichewa
Chinese (Simplified)
Chinese (Traditional)
Corsican
Croatian
Czech
Danish
Dutch
English
Esperanto
Estonian
Ewe
Faroese
Filipino
Finnish
French
Frisian
Ga
Galician
Georgian
German
Greek
Guarani
Gujarati
Haitian Creole
Hausa
Hawaiian
Hebrew
Hindi
Hmong
Hungarian
Icelandic
Igbo
Indonesian
Interlingua
Irish
Italian
Japanese
Javanese
Kannada
Kazakh
Kinyarwanda
Kirundi
Kongo
Korean
Krio (Sierra Leone)
Kurdish
Kurdish (Soranรฎ)
Kyrgyz
Laothian
Latin
Latvian
Lingala
Lithuanian
Lozi
Luganda
Luo
Luxembourgish
Macedonian
Malagasy
Malay
Malayalam
Maltese
Maori
Marathi
Mauritian Creole
Moldavian
Mongolian
Myanmar (Burmese)
Montenegrin
Nepali
Nigerian Pidgin
Northern Sotho
Norwegian
Norwegian (Nynorsk)
Occitan
Oriya
Oromo
Pashto
Persian
Polish
Portuguese (Brazil)
Portuguese (Portugal)
Punjabi
Quechua
Romanian
Romansh
Runyakitara
Samoan
Scots Gaelic
Serbian
Serbo-Croatian
Sesotho
Setswana
Seychellois Creole
Shona
Sindhi
Sinhalese
Slovak
Slovenian
Somali
Spanish
Spanish (Latin American)
Sundanese
Swahili
Swedish
Tajik
Tamil
Tatar
Telugu
Thai
Tigrinya
Tonga
Tshiluba
Tumbuka
Turkish
Turkmen
Twi
Uighur
Ukrainian
Urdu
Uzbek
Vietnamese
Welsh
Wolof
Xhosa
Yiddish
Yoruba
Zulu
Now, in this video, we want the ability to be able to shoot these enemies in order to destroy them.
So the first thing that we need is crosshairs for a gun so that we know exactly where we're pointing.
So in the mobile game resources, you'll find that I've given you the crosshairs.
When the place is on the canvas.
So if you're just right, click on the canvas Jujuy and a new image, then we're going to drag the crosshairs
into the source image.
OK, and then clicks that native size.
So that's our crosshairs.
It doesn't need to be a rakas target.
Rakas target effectively means something that you can interact with the torch or press.
All right.
This is just a simple graphic that sits in the middle of the screen and not image will always stay in
the middle of the screen.
So as you move your going around, you basically have to rotate your camera in order to position the
crosshairs to line up with one of these enemies.
So let's call it crosshairs.
OK.
And it's default material is UI default, which I think should actually be fine.
And.
Yeah, it's a specific material that's designed specifically for YUAI, so it should be fine.
OK.
And.
Now, we also need a sound that when we fired the gun, we can hear the sound of the gunfire, so in
the sound effects of got a sound file called gunshot.
All right.
With this, just make sure that you click on the Android icon and click override for Android.
All right.
So really small file and it is a dot wav file.
So I whv.
OK.
This one means it's uncompressed.
Sometimes when you bring some files into the MP three, they're already compressed.
What happens is the mobile just decompress the file to turn it into something like a wave or something.
And then there's the re compress it into Vorbis.
OK.
Which is quite effective for mobiles and belief.
Or you could even just choose an PS3 is entirely up to you.
And whereas if you've got a wave file, basically it doesn't have to decompress it.
It only has to it only has to compress it.
So you actually save in time.
And that works for small sound files.
If you've got like a really big sound, like a background music, don't don't import that as a way.
It's going to be absolutely massive and it's going to increase your file size.
You would obviously have as an MP three, and you would just instead of decompress and load on that
one, you would simply stream a really, really large file.
OK.
So on the.
Oh, yeah.
Apply that to the sound.
So now it's changed.
And I think what they'll do is actually apply this to the parent.
I think I'm going to click add component and choose audio.
So you've got audio source and then basically drag this gunshot sound directly into the audio clip file.
Don't play it on the way and don't loop could have to the sound.
So I don't often mess around with any of these settings.
And then basically we can then call out inside of the script.
OK, so let's let's actually get into the script then.
So under the name, let's just open this and we'll place into this one.
And first of all, I'm just going to comment this.
So this is shooting.
OK, so the first thing I need is the actual Processo public type game objects.
Well, call for us.
OK.
And then I need the animator of the arm so I can get it to effectively fire.
So then I'm going to say pablic oxide animator will call arms and the.
OK, and then obviously audio source that we've just added, so public oxide audio source will call
gunshot sound.
All right, there we go.
So I'm just going to save that.
Let's wait for that to compile, obviously.
Script is on the ground, so we need, first of all, the crosshairs.
So let's just drag that into that slot.
The arms and then we'll actually be on the arms is basically going to get this on the meter, which
is then going to be able to talk to these animations.
It's going to be able to run these parameters.
And so let's just drag arms around him and he automatically finds down the meter and then the gunshots
sound is sound effects.
Rag in the gun shop.
Oh, sorry, not on that one.
It's on the parent, isn't it?
The audio source.
And so we'll just drag.
Oh, I'm on the canvas.
Control.
See you, the parent at the top, there should be no ground.
Just drag parent into that and it finds the audio source.
All right, excellent.
It's safe.
So now what we need is an actual button allows us then to fire.
OK.
I'm actually going to use something very similar to this.
So on the canvas, I'm going to right click.
I'm going to choose 3D object, sort of UI and button.
All right.
That gives me this little button here.
And I want to change the graphic instead of UI Sprite.
I actually want to go with that joystick pack sprites and handle.
All right.
Now I actually want this one, but without the arrows.
OK, so if I go to a button, I can then drag this handle, react directly into the source image, and
I get this.
All right.
Now, what I need to do is basically just change my width to make it a little bit smaller and then change
the height.
Now, technically, the button should be roughly about the same.
So let's say 100 on the height and 100 on the width.
We only got perfect circle.
So now I'm just going to write this down and over to the right.
Now we have to be careful about this one because it's over on the right hand side.
My match up with this device.
But then if I change to a different device, let's say, like the Apple iPod.
Notice it's off screen.
All right.
Just just be careful.
You set this one up and it's perfectly fine there.
So you might have to go through a few of those to actually line it up.
So what I'm going to do, I'm going to actually bring it over here a little bit.
All right.
So it's more in line with this.
And I want it to anchor to be the bottom.
Right.
OK, so it's going to try and stick to those bottom right section.
Since this is the smallest screen, I can get it lined up on this one and just make sure.
Everything is fine.
Yeah.
Now on this, what we need to do here is safe area, and what we can see is that the Botten is outside
of the safe area.
Always make sure if you've got an intractable item, that does it within the safe area.
Yeah.
OK.
Switch off the safe area now and yeah.
All right, that's looking good.
Yeah, it's looking fine on all of these, isn't it?
So once again, just safe area up so perfectly fine.
OK, and.
Yeah.
All right.
That's the good thing about this simulator, it allows you to make sure it's going to work on all the
different devices.
OK.
It does need to be a recast target because we do need to push it.
All right.
It's going to be a simple image and we're going to apply a color to this.
So it's normal color.
I actually want this to be a red color.
Now, when you press it or highlight it, I actually want it to sort of turn to an orange.
When you pressed it, I want it to be pretty much the same orange selected color.
Also the orange.
OK, so it just it just shows you that you pressed it basically.
And now the text itself, I want this to say, shoot all uppercase the text color to be white.
So it stands out against that red background.
The font size would increase to about 20.
So you can definitely see that.
And I want the font to be bold.
All right.
So it really stands out.
Excellent.
Now, I'm just simply going to rename this as shoot button.
There we go, and then we can access that.
And in the script, so on the button we get an on click event whereby we can actually call a custom
function.
So back into the main script, what we're going to do is we're going to.
And first of all, call our own function.
So below the update, make sure it's definitely not inside of either the start or the update or any
other function.
It's got to say outside of it, but inside of the class.
So it has to be inside of this element, definitely not below this final curly bracket.
And so I'll say public service available from outside voit.
Now, call it shoot.
So give it a name that's going to make sense because it's probably going to be a lot of functions to
choose from.
You want instantly know exactly what it's doing.
OK, so the first thing is we need to access the arms and get those to animate.
So arms and then don't set trigger.
And the trigger name that you have to put inside of quotation marks is whatever that variable was on
arms.
It was called fire.
OK, so let's do that.
That's to be spelled exactly the same way.
So if it's got capital B capital, if it's a lowercase F lowercase, otherwise it definitely won't work.
OK, and then we simply want this gunshot sound to play.
Gunshots sound.
Play don't that will simply just play that sound.
Save that.
And I just want to test it at the moment to make sure that it does work.
So in a simulator with our shoot button, just want to click the plus on the long click drag in the
ground, and that will access the script on background, which is the main script.
And then we simply call this shoot function.
So every time you press it button, it will basically run all of those commands.
There's only two at the moment.
So it should animate and play a gunshot sound.
So let me change back to game.
Make sure I don't check my new audio so we can actually hear this.
And then.
C.
OK, there we go.
Oh, and that's now yellow, actually, so I want that to return back to red.
So selective color.
I'm going to have it as that same red eye, if you want, in the exact same.
Right.
You can just click on this.
You can take this code, the extra decimal control and see to paste into this one control and V to paste,
and you'll end up with the exact same color.
She's trying again to make sure that works.
All right, does it does work for some reason, it was just showing me as selected, OK, and we can
hear the gunshot sound as well.
All right.
So we definitely know that's working.
So what we'll do in the next video is we'll sort out a recasting system whereby we'll shoot away from
the gun towards the game world and we'll hit whatever character there is there and basically kill the
anime characters.
Can't find what you're looking for?
Get subtitles in any language from opensubtitles.com, and translate them here.