Game Development Reference
In-Depth Information
How it works...
We extend our barrel from DynamicSMActor , because we want players to be able to
interact with it. Dynamic, or kinematic actors, allow for movement and manipulation at
runtime. From there we simply create a placeable dynamic static mesh, which can be
destroyed when touched.
The Touched() function is key here, because it allows detonation to occur either when a
pawn or vehicle touches it, or when it takes damage. You may have also noticed that this
function is used pretty frequently within UDK, especially for taking damage.
Finally, we make it easy for our level designers to alter the properties of the barrel by
exposing ones such as particles, sound cue, and static mesh within the editor.
Creating a landmine
The explosive barrel is a nice touch in any environment, but let's build something for a
more specific application. What if we were to set a trap and have it spring when a character
comes within a close enough proximity? Even better, a landmine in an open environment like
a battlefield.
With that in mind, let's get to building a landmine that detonates when touched.
Getting ready
Open your IDE and start by creating a new class called Landmine and have it extend from
ExplosiveBarrel .
Because our mine is an item that will probably be heavily used by a level designer, let's
again 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 Landmine placeable within a level.
class Landmine extends DynamicSMActor
HideCategories(Movement, Attachment, Debug, Advanced, Mobile,
Physics)
placeable;
How to do it...
Our class was made with modularity in mind, so we really only need to change a few default
properties to really get a new, albeit similar, object.
 
Search Nedrilad ::




Custom Search