Post

Visualizzazione dei post con l'etichetta explosion

Working buttons

Immagine
In this post we already bound functions to the pressing of either the "Deploy mine" or"Repair" buttons. Now it's time to make them really work! First, the easier one: Repair button. In this case it's just a matter of completing the Repair() function; I want all these actions to happen only when we are in the player's turn, which means being in gameState == 0. If we're not in it, simply return. We also have a boolean variable called repairAvailable , that updates itself based on how many resources we collected; if it's false , let's return as well. In case none of the above happens, we can actually repair our ship: this means adding 1 life to the player ship, and removing 2 resources from our collection. Please note that calling the AddLives() and RemoveResources() methods, will automatically take care of updating the UI and the repairAvailable variable. (In this case the UI will be redrawn twice, but it's not a problem). Here...

Explosion effect - Camera shaking

Immagine
Every explosion has a shockwave effect, and this is usually shown in videogames with camera shaking . Unreal Engine has a built-in class that provides this kind of effect, so all we need to do is adding a new Blueprint class, and search for "Camera shake". I'll call it MyCameraShake . In the Blueprint editor we can change the parameters of the shake effect. What we need are the following: I set the duration to 0.4, so that it ends shaking just before the end of the visual explosion effect we created here . Now, in the usual EnemyBP editor, we can chain this effect to the ones already playing when we have a collision: The node to activate is "Play World Camera Shake", and we can assign it the class MyCameraShake . The location where the shake effect starts doesn't really matter, we can use the enemy location as we did for the particle system. The other 2 parameters to set are minimum radius: if the camera is placed within that radi...

Explosion effect - Particle System

Immagine
Today I'm going to add a cool effect to the destruction of an enemy ship: we'll see a stylized explosion and a shaking of the screen. The first thing I'm creating is the particle system that will simulate the explosion. Particle Systems in Unreal Engine are made of one emitter (or more than one for complex animations) that will spawn particles with different sizes and velocities. Particles can be sprites (simple 2D images that always face the camera) or meshes; I'm going to use sprites, so in Photoshop I'm creating a simple white blurred circle on black backgorund: This will be the main shape of our particles. Remember that in Unreal Materials, when we use images for opacity, white means full opacity, while black is full transparent; so in this case we'll see a circle with transparent background. After importing the texture in Unreal Engine as ExplosionTexture , we can create a new Material, called ExplosionMaterial . Let's define it a...