Game Development Reference
In-Depth Information
First, create a new actor attribute of type real and name it ''InitialY.''
Next, drag and drop a Change Attribute behavior and change Door.InitialY to
Door.Position.Y as per Figure 8-10.
Figure 8-10. Storing the initial Y position value
Then, create a new rule and name it ''OpenDoor is True.'' This rule will be used
to open the door. Apply ''All'' to the following conditions:
''Attribute'' ''game.OpenDoor'' is ''True''
''Attribute'' ''Door.Position.Y'' ''='' ''Door.InitialY''
The second condition will check that the door is closed.
Drag and drop an Interpolate behavior and change the settings to
''Door.Position.Y'' ''Door.InitialY -- Door.Size.Height'' ''0.5'' ''Linear.''
The complete rule is shown in Figure 8-11.
Figure 8-11. OpenDoor is True rule
Last, create a new rule and name it ''OpenDoor is False.'' This rule will be used
to close the door. Apply ''All'' to the following conditions:
''Attribute'' ''game.OpenDoor'' is ''False''
 
Search WWH ::




Custom Search