Game Development Reference
In-Depth Information
Getting ready
Open your IDE and start by creating a new class called ExplosiveBarrel and have it extend
from DynamicSMActor .
Because our barrel is an item that will probably be heavily used by a level designer, let's hide
many of the properties from the editor, as it will just clutter up the screen. Hide Movement ,
Attachment , Debug , Advanced , Mobile , and Physics .
We also want to make our barrel placeable within a level.
class ExplosiveBarrel extends DynamicSMActor
HideCategories(Movement, Attachment, Debug, Advanced, Mobile,
How to do it...
For this recipe, we'll be creating a new class, unlike any we've encountered yet. We'll be using
timers to call specific functions at set intervals, detonating and respawning explosives, and
triggering particle effects. And best of all, this is done by creating only one class!
It's time to add our variables. We have quite a few here, but they are commented
pretty clearly, so don't worry.
/** Explodes when damaged. */
var() bool bDestroyOnDmg;
/** Explodes when a player walks over it */
var() bool bDestroyOnPlayerTouch;
/** Explodes when a vehicle drives over it */
var() bool bDestroyOnVehicleTouch;
/** Mesh to swap in when destroyed. */
var() StaticMesh MeshOnDestroy;
/** How long the spawned physics object should last. */
var() float SpawnPhysMeshLifeSpan;
/** Initial linear velocity for spawned phys obj. */
var() vector SpawnPhysMeshLinearVel;
/** initial angular velocity for spawned physics object.
var() vector SpawnPhysMeshAngVel;
/** Sound to play when destroyed. */
Search Nedrilad ::

Custom Search