Action: Difference between revisions

From EDukeWiki
Jump to navigation Jump to search
mNo edit summary
No edit summary
Line 16: Line 16:
* <span {{code}}><viewtype></span>: Defines the number of sides drawn for the actor.  Prior to 3D models, this method was used to simulate a 3D appearance for sprites.  Valid values are:  
* <span {{code}}><viewtype></span>: Defines the number of sides drawn for the actor.  Prior to 3D models, this method was used to simulate a 3D appearance for sprites.  Valid values are:  
:'''1''' - The sprite will appear the same regardless of the angle at which it is viewed.
:'''1''' - The sprite will appear the same regardless of the angle at which it is viewed.
:'''3''' - The sprite will have 16 angles built from only 4 art tiles. A new frame is drawn every 22.5 degrees in a clockwise pattern beginning with the front of the sprite.
:'''2''' - The sprite will have 8 angles built from only 2 art tiles.  A new frame is drawn every 45 degrees in a clockwise pattern beginning with the front of the sprite.
::In this case it uses a simple pattern: <span {{code}}>1, 2, 1, 2, 1, 2, 1, 2
:'''3''' or '''4''' - The sprite will have 16 angles built from only 4 art tiles. A new frame is drawn every 22.5 degrees in a clockwise pattern beginning with the front of the sprite.
::The pattern is as follows, with 1, 2, 3, and 4 being the order of the four tiles used, and M denoting that the tile is mirrored: <span {{code}}>1M, 2M, 3M, 4M, 4, 3, 2, 1, 1M, 2M, 3M, 4M, 4, 3, 2, 1 </span>
::The pattern is as follows, with 1, 2, 3, and 4 being the order of the four tiles used, and M denoting that the tile is mirrored: <span {{code}}>1M, 2M, 3M, 4M, 4, 3, 2, 1, 1M, 2M, 3M, 4M, 4, 3, 2, 1 </span>
:'''5''' - The sprite will have 8 angles constructed from 5 art tiles, three of which are mirrored.  A new frame is drawn every 45 degrees in a clockwise pattern beginning with the front of the sprite.
:'''5''' - The sprite will have 8 angles constructed from 5 art tiles, three of which are mirrored.  A new frame is drawn every 45 degrees in a clockwise pattern beginning with the front of the sprite.
Line 23: Line 25:
::The pattern is as follows: <span {{code}}>1, 2, 3, 4, 5, 6, 7, 6M, 5M, 4M, 3M, 2M</span>
::The pattern is as follows: <span {{code}}>1, 2, 3, 4, 5, 6, 7, 6M, 5M, 4M, 3M, 2M</span>
:'''8''' - The sprite will have 8 angles constructed from 8 art tiles.  A new frame is drawn every 45 degrees in a clockwise pattern beginning with the front of the sprite.  
:'''8''' - The sprite will have 8 angles constructed from 8 art tiles.  A new frame is drawn every 45 degrees in a clockwise pattern beginning with the front of the sprite.  
::In this case it uses a simple pattern: <span {{code}}>1, 2, 3, 4, 5, 6, 7, 8</span>
::In this case it uses a simple pattern: <span {{code}}>1, 2, 3, 4, 5, 6, 7, 8
 
:'''9''' - The sprite will have 16 angles constructed from 9 art tiles, seven of which are mirrored.  A new frame is drawn every 22.5 degrees in a clockwise pattern beginning with the front of the sprite.
::The pattern is as follows: <span {{code}}>1, 2, 3, 4, 5, 6, 7, 8, 9, 8M, 7M 6M, 5M, 4M, 3M, 2M</span></span>
:'''12''' - The sprite will have 12 angles constructed from 12 art tiles.  A new frame is drawn every 30 degrees in a clockwise pattern beginning with the front of the sprite.
::The simple pattern: <span {{code}}>1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12
:'''16''' - The sprite will have 16 angles constructed from 16 art tiles.  A new frame is drawn every 22.5 degrees in a clockwise pattern beginning with the front of the sprite.
::The simple pattern: <span {{code}}>1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16
,
:View type 1 is generally used for pickups and environmental objects like fire hydrants.  
:View type 1 is generally used for pickups and environmental objects like fire hydrants.  
:View type 3 is useful only for very symmetrical actors but it does give the most angles.
:View type 3 is useful only for very symmetrical actors but it does give the most angles.

Revision as of 19:52, 26 August 2025

The command action refers to both the declaration that defines the animation for an actor, and to the command that changes the animation of an actor at runtime.

Declaration

action <name> <startframe> <frames> <viewtype> <incvalue> <delay>

This statement must be placed outside of any code blocks.

Arguments

  • <name>: Defines the name of the action, to be used with the runtime statement.
  • <startframe>: Defines the starting frame number (relative to the main sprite of the actor).
  • <frames>: Defines the total number of frames in the animation, after which it will loop. Must be at least 1.
  • <viewtype>: Defines the number of sides drawn for the actor. Prior to 3D models, this method was used to simulate a 3D appearance for sprites. Valid values are:
1 - The sprite will appear the same regardless of the angle at which it is viewed.
2 - The sprite will have 8 angles built from only 2 art tiles. A new frame is drawn every 45 degrees in a clockwise pattern beginning with the front of the sprite.
In this case it uses a simple pattern: 1, 2, 1, 2, 1, 2, 1, 2
3 or 4 - The sprite will have 16 angles built from only 4 art tiles. A new frame is drawn every 22.5 degrees in a clockwise pattern beginning with the front of the sprite.
The pattern is as follows, with 1, 2, 3, and 4 being the order of the four tiles used, and M denoting that the tile is mirrored: 1M, 2M, 3M, 4M, 4, 3, 2, 1, 1M, 2M, 3M, 4M, 4, 3, 2, 1
5 - The sprite will have 8 angles constructed from 5 art tiles, three of which are mirrored. A new frame is drawn every 45 degrees in a clockwise pattern beginning with the front of the sprite.
The pattern is as follows: 1, 2, 3, 4, 5, 4M, 3M, 2M
7 - The sprite will have 12 angles constructed from 7 art tiles, five of which are mirrored. A new frame is drawn every 30 degrees in a clockwise pattern beginning with the front of the sprite.
The pattern is as follows: 1, 2, 3, 4, 5, 6, 7, 6M, 5M, 4M, 3M, 2M
8 - The sprite will have 8 angles constructed from 8 art tiles. A new frame is drawn every 45 degrees in a clockwise pattern beginning with the front of the sprite.
In this case it uses a simple pattern: 1, 2, 3, 4, 5, 6, 7, 8
9 - The sprite will have 16 angles constructed from 9 art tiles, seven of which are mirrored. A new frame is drawn every 22.5 degrees in a clockwise pattern beginning with the front of the sprite.
The pattern is as follows: 1, 2, 3, 4, 5, 6, 7, 8, 9, 8M, 7M 6M, 5M, 4M, 3M, 2M
12 - The sprite will have 12 angles constructed from 12 art tiles. A new frame is drawn every 30 degrees in a clockwise pattern beginning with the front of the sprite.
The simple pattern: 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12
16 - The sprite will have 16 angles constructed from 16 art tiles. A new frame is drawn every 22.5 degrees in a clockwise pattern beginning with the front of the sprite.
The simple pattern: 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16

,

View type 1 is generally used for pickups and environmental objects like fire hydrants.
View type 3 is useful only for very symmetrical actors but it does give the most angles.
View types 5 and 7 are for actors which have a single axis of symmetry and which need to face directions other than directly towards the player.
View type 8 is for objects with little in the way of symmetry.
  • <incvalue>: Defines by how many frames the animation should advance in each step. If negative, the animation will play in reverse.
Note that it is possible to define increments greater than 1 or smaller than -1.
  • <delay> : Defines the delay between frames, where the value needs to be a multiple of 4. Any values inbetween result in the same delay as the nearest multiple rounded down.
The delay is not proportional to the value, i.e. a delay of 16 does not result in double the time between frames as a delay of 8.
Much rather, the calculation is as follows:
  • [0,3] is the minimum delay, equal to the tic counter.
  • [4,7] is 1/2 of the tic counter delay
  • [8,11] is 1/3 of the tic counter delay
  • [12,15] is 1/4; [16,19] is 1/5; etc.

Runtime Command

action <name>

Changes the actor's current action when called from within the actor code. Note that calling this statement from within an event has no effect.

Note: Every frame advance adds 1 to actioncount. To reset an animation, either call the action again or use resetactioncount. Starting a new animation will also reset actioncount to 0.