Language Reference Guide : System Classes : SpriteDescriptor Class : WhichSprite Method
 
Share this page          
WhichSprite Method
The WhichSprite method populates the host sprite descriptor (curobject) with details about the sprite identified by the passed index or x,y location.
This method has the following syntax:
integer = SpriteDescriptor.WhichSprite(displayfield = ActiveField
          [, spriteindex = integer][, x = integer, y = integer])
This method has the following parameters:
displayfield
(Required) Specifies the field on which the sprite is displayed.
spriteindex
Specifies the index of the sprite in the field BgBitmap’s spritemap.
If x and y are specified, this value is treated as a limit index, and the first sprite with a lower index at the x,y location is used to populate the host sprite descriptor.
Because the sprite index is also a Z-order index for the sprites, successive calls to WhichSprite, passing the location and the index of the previous “hit,” identify any underlying sprites, one by one.
x
Specifies the x-location of the sprite relative to the field, (n pixels)
y
Specifies the y-location of the sprite relative to the field, (n pixels)
The method returns ER_OK if a sprite is found.