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
Polish
Portuguese (Brazil)
Portuguese (Portugal)
Punjabi
Quechua
Romanian
Romansh
Runyakitara
Russian
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 that our projectile is working, it disappears.
If we hit the wall, we want to show the explosion flipbook.
So in the paper assets FX, we have the player shot hit.
Right.
So this one we want to play this.
If we hit the wall.
And the way we're going to implement this is we're going to create a separate blueprint that just plays
a flipbook.
And if the flipbook is done playing, the blueprint is just going to despawn.
And this is a very common way of handling these.
So go back to the content drawer.
And in blueprints, we're gonna create a new one new folder called VFX.
And open it up.
And here create a new blueprint class.
It's going to be very simple.
So just an actor and call it BP VFX base.
In caps.
And again here we're going to use inheritance.
But this is extremely simple.
So I didn't create a graph.
We're just going to have the base with all the setups.
And then just have a different child for each effect where we only change the flipbook.
But let's start with this one first the Pvpve base as the baseline.
So here we just add a flipbook.
Paper flip book.
And here for the sauce flip book, we want to use the we want to use the hit loop.
The player shot hit loop.
And now it just keeps on looping.
But what we want is to just play it a single time and then have the entire blueprint be destroyed again.
First, we want to set the paper flip book to No Collision because this should just be in effect, no
collision.
We don't want anything to collide with this.
Again to demonstrate how this works, we're just going to drag it into the level.
Just drag an instance in here and you can see that it just keeps on playing like this.
But what we want is to just play the one time and then destroy it.
So even though we have Paper XRD setup and we could have these animation trees and all of that, this
is something so simple, it is actually easier to just do all of this in the blueprint using the base
paper 2D toolset.
If we click on the flipbook, we can scroll down to the events.
And here you see the on finished playing event.
And this is something that comes from paper 2D on Flipbooks.
And we can just add the event.
And it's just going to tell us when the flipbook is done playing.
So we can just print string here.
For now and just say done.
And if we start now, you're going to see that this is actually not enough, right?
It's not showing up.
It keeps on playing because we need to make sure that this flipbook is set to not looping, because
this event will never trigger on a looping flipbook.
And we can get rid of the actor, begin overlap and the tick and just want to go to begin play.
And here we drag from the paper flipbook and set looping.
And set this to false.
New looping to false.
So when we spawn this in we're just going to set it to not looping.
And then this event is going to trigger if the animation is done playing one time.
Compile and save and let's check it out.
And you can see it says done.
And then it simply stops playing.
It's still visible but it stopped playing.
And we can then just go here and instead of saying done well we can simply destroy actor.
Just like this.
And this is all there is to it.
This is super simple.
We just set the flipbook.
We set it to not looping.
Once it's done playing one repetition of the animation, we just destroy the actor.
And let's check this out.
Now I simulate and it plays once.
It's gone.
And this is exactly what we need.
But with things like this, you got to be a little bit careful, because spawning an actor and destroying
an actor actually uses up quite a bit of resources on your computer and memory, because we have to
instantiate things and destroy them.
So in an ideal scenario, you would set up a pooling method.
But this is a very advanced topic we're not going to get into.
And you don't really have to worry about it too much.
But that is just one way you could optimize things like this.
And like we said, this is only the base.
So this is the pvf base.
We don't actually want to use this in our levels.
So let's just create a child blueprint class and just call BP underscore VFX.
Shot.
Hit, shot.
Hit.
And in here, we're not going to change anything because this is just going to use the default values
we set here.
But it is a blueprint we actually want to use in the level instead of the default, because the default
could possibly change.
Now, instead of just dragging this into the level, we want to actually spawn this from the BP projectile
base, and we want to spawn this when we hit the wall.
And there are multiple ways we could go about this, we could simply spawn actor from class.
And spawn it here.
Right.
Go here and connect this.
If we hit something and here we now need to select our BP VFX shot hit.
So let's look for shot hit.
PVCs charted.
And we then need to give it a spawn transform so we can just right click split the struct pin.
We don't want to set a transform scale.
Usually you just want to keep this as 111 for the location.
Well, we can just get actor location off the projectile.
So where the projectile is destroyed.
And for the rotation, we can also just get actor rotation of the projectile that spawns this.
And this one is a little bit tricky.
The collision handling override in case something is blocking the position.
Here we just want to select always spawn ignore collision.
So even if there is something that should block us, we're just going to ignore it because well there
is no collision in our shotted and this is just a safety.
And we can then just compile and save and play this.
And you can see we hit the wall.
And we play the flipbook.
The projectile disappears, the flipbook disappears.
And this is a simple way of playing this.
However, I prefer a slightly different way of doing this.
Instead of doing this from the hit event, I want to use the override for the Ondestroy event.
So here in the functions there's override labels, and these come from the actor class.
So here we have the on destroyed or actually destroyed event which we can use.
And this is going to trigger when we call destroy actor.
And it's going to execute it before the actor is deleted.
So we can just select all of this.
We can hold alt and left click to disconnect the lines and drag this down here and connect it here like
this.
And then go here connect this again.
And this is just personal preference right.
We could use this here as well.
But then we also need to make sure that on other events where we want this to explode we also have to
call it manually.
But I think most of the time when we destroy this we actually want to call this.
So this is just this just creates a nice funnel that we're always sure this is going to play.
When we destroy the projectile.
Now we can just compile and save and just see that it works the same way.
Right?
It just disappears and everything still works the same way it did when we had it up here.
But this is just my personal preference to do it here.
And now we can just close all of this down.
And just return to our map.
And make sure to save everything.
File save all.
And this is pretty much it for playing a particle effect.
And we can later on reuse our pvpve base to play other particle effects very easily.
In the next lesson, we're actually going to enable the player to shoot these projectiles instead of
just dragging them into the map.
Can't find what you're looking for?
Get subtitles in any language from opensubtitles.com, and translate them here.