Game Development Reference
In-Depth Information
The projectile item class
It is time for our final item class, which is the projectile item class. These kinds of
items could be bullets, arrows, thrown items, and so on. The projectile item class will
be similar to the melee item class, except this one will have functions that will al-
low it to move in the game world. We'll start by creating a new script and naming it
itemRanged .
Adding our variables
As we did in the previous two classes, we'll need to first add a few enums to our script.
Add these variables to our script:
public enum RangedAction {BuffDebuff, ChangeHP,
ActivateEnv, None};
public enum RangedType {Weapon, None};
public enum MovementType {Basic, Drop, None};
You can see that we have a couple of familiar variables that we will use for the action
and type of the item. We also have a new enum; this one will be used to determ-
ine how the object will move when it's created. The basic type will move the object
through the air with simple movement. The drop type is similar to the basic type, but
will allow the object to drop in the air as if gravity was acting on it.
Now, let's add the rest of our variables:
public int Amount, Value;
public float Weight, Speed, DropSpeed;
public string Name, Stat;
public RangedAction rangedAction =
RangedAction.None;
public RangedType rangedType = RangedType.None;
public MovementType moveType = MovementType.None;
Search WWH ::




Custom Search