Post

Visualizzazione dei post con l'etichetta enemy

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...

Class Inheritance

Immagine
Space exploration can be very boring when you're alone, I think it's time to add some action by spawning enemies around the map. While thinking about the functionalities needed by the enemy ships, I noted that many of them are the same of the player ship. For instance, both need the arrays for directions, the same functions to move and rotate, etc. This is the typical case where class inheritance comes in handy. Class inheritance is one of the core concepts of many OOP (Object Oriented Programming) languages. It basically lets you create a base class where all the common behaviours and properties are stored; you can extend that class to other more specialized classes, where you can write methods and store variables that affect that particular subclass only. We already used this concept in the project, but Unreal Engine managed it for us behind the scenes: all our classes extend the Actor class, so all the basic methods like drawing the mesh, etc. are already writte...