Game Development Reference
In-Depth Information
Now we want to display that Kevin now has that weapon, and how to switch to
it. We need to create two game-wide Boolean attributes for each of the weapons or
items we want in the game—an unfortunate work-around, because as of the time of
writing you cannot use a rule to check conditions of a table. Oh well, we aren't going
to create one for the gravity gun because we already created one that detects it was
collected! So there's one down. For now, I created two new Boolean attributes, and
named them accordingly. For the flame thrower inside the merchant actor, under the
accepted with enough coins option, we need to change the Flame Thrower attribute
to True , so just drag in a Change Attribute behavior and edit it accordingly:
Now that we have turned the attribute on, let's go into our weapon actor. We will
be re-working almost all of the behaviors and rules within the actor. So I'll just skim
quickly over it to let you know what needs to be changed.
You will need to create three new Booleans within the weapon actor, or however
many weapons you want, including the gravity gun, which will be true from the
beginning; name them all accordingly. In each shooting rule, you will need to add
another condition to detect which gun is being used. For example, Attribute |
gravgun | is | true . The great thing about this is you can do a whole bunch of guns
within the one actor without having to create multiple actors for each gun. So what
you can do is, create a new rule. If the player presses the 1 button in the numeric
keypad, it will turn on the gravgun Boolean and switch all the others off, change the
image back to gravgun . Then at the time of programming the shooting, you can detect
whether, let's say the flame thrower is selected, you can have it detect if the Boolean is
on, and when the player is holding the shoot button, have the gun emit flames.
 
Search WWH ::




Custom Search