Difference between revisions of "EVENT ANIMATESPRITES"

From EDukeWiki
Jump to navigation Jump to search
(New page: This event can be used to manipulate sprites that are drawn on the screen. It is triggered only by drawn sprites when 16 has been added to the mdflags member of the corresponding sprite i...)
 
Line 18: Line 18:
  
 
The second block of code removes transparency from the player's tsprite, so that when the player is in F7 view mode, the player sprite will appear solid.  This effect cannot be achieved by setting the cstat of the player sprite directly.  Note that the code will only effect the player sprite, because only the player sprite has had 16 added to its mdflags member.
 
The second block of code removes transparency from the player's tsprite, so that when the player is in F7 view mode, the player sprite will appear solid.  This effect cannot be achieved by setting the cstat of the player sprite directly.  Note that the code will only effect the player sprite, because only the player sprite has had 16 added to its mdflags member.
 +
 +
See also [[gettspr]] and [[settspr]]

Revision as of 18:51, 18 October 2008

This event can be used to manipulate sprites that are drawn on the screen. It is triggered only by drawn sprites when 16 has been added to the mdflags member of the corresponding sprite in the game world. Drawn sprites are accessed through the tsprite array, which has its own members separate from the regular actor array. Members of the tsprite array are similar to members of the regular sprite array, but they begin with 'tspr' (E.g., xrepeat becomes tsprxrepeat ).

Example of how to use this event:

  gamevar TEMP 0 0
  actor APLAYER MAXPLAYERHEALTH PSTAND 0 0
  getactor[THISACTOR].mdflags TEMP
  orvar TEMP 16
  setactor[THISACTOR].mdflags TEMP
  // rest of player code

In this first block of code, we add 16 to the mdflags member of the player sprite, so that it will be processed by the ANIMATESPRITES event. Next, is the code for the event:

  onevent EVENT_ANIMATESPRITES
  gettspr[THISACTOR].tsprcstat TEMP
  subvar TEMP 2
  settspr[THISACTOR].tsprcstat TEMP
  endevent

The second block of code removes transparency from the player's tsprite, so that when the player is in F7 view mode, the player sprite will appear solid. This effect cannot be achieved by setting the cstat of the player sprite directly. Note that the code will only effect the player sprite, because only the player sprite has had 16 added to its mdflags member.

See also gettspr and settspr