Creating non-interactive decorations (ZScript)
Non-interactive decorations are the simplest form of actor that can be defined. They usually consist of a single sprite with one frame or a looping animation and only use the Spawn state sequence, but they can utilize more states as well.
You may set any property and flag as needed.
Note, for your decorations to appear in the map editor, you will to give them DoomEdNums through MAPINFO.
This is an example of a simple decoration:
class CEye : Actor { Default { Height 40; // Height for collision checks Radius 20; // Radius for collision checks +SOLID // Other actors can't pass through this object (but hitscan attacks can) } States { Spawn: HAW6 A 10; HAW6 B 10 Bright; HAW6 C 10; Loop; } }
Decorations can utilize functions just like any other actor. For example, this decoration will play a sound every second:
class CEye1 : Actor { States { Spawn: HAW6 A 35 A_StartSound("ceye/alert"); {{comment|Notice the duration of this state is 35 tics, which equals one second. Loop; } }
Notice, the example above won't play the sound as soon as it spawns, because functions attached to the first frame of the Spawn state sequence are not executed until the state sequence has looped once. If you want the sound to play immediately, use the NoDelay keyword:
HAW6 A 35 NoDelay A_StartSound("ceye/alert");
Creating interactive decorations is also possible.