Sprite
The sprite class. Sprites are the basic concept used to display characters, etc. on the game screen.
Superclass
Class Method
Sprite.new([viewport])
Creates a new Sprite object. Specifies a Viewport (Viewport) when necessary.
Methods
dispose
Frees the sprite. If the sprite has already been freed, does nothing.
disposed?
Returns TRUE if the sprite has been freed.
viewport
Gets the Viewport (Viewport) specified when the tilemap was created.
flash(color, duration)
Begins flashing the sprite. duration specifies the number of frames the flash will last.
If color is set to nil, the sprite will disappear while flashing.
update
Refreshes the sprite flash. As a rule, this method is called once per frame.
It is not necessary to call this method if no flash effect is needed.
Properties
bitmap
Refers to the bitmap (Bitmap) used for the sprite's starting point.
src_rect
The box (Rect) taken from a bitmap.
visible
The sprite's visibility. If TRUE, the sprite is visible.
x
The sprite's X-coordinate.
y
The sprite's Y-coordinate.
z
The viewport's Z-coordinate. The larger this value, the closer to the player the viewport will be displayed. If multiple objects share the same Z-coordinate, the more recently created object will be displayed closest to the player.
ox
The X-coordinate of the sprite's starting point.
oy
The Y-coordinate of the sprite's starting point.
zoom_x
The sprite's X-axis zoom level. 1.0 denotes actual pixel size.
zoom_y
The sprite's Y-axis zoom level. 1.0 denotes actual pixel size.
angle
The sprite's angle of rotation. Specifies up to 360 degrees of counterclockwise rotation. However, drawing a rotated sprite is time-consuming, so avoid overuse.
mirror
Flag denoting the sprite has been flipped horizontally. If TRUE, the sprite will be drawn flipped.
bush_depth
The Bush depth for that sprite. This is a pixel value denoting how much of the sprite's lower portion will be displayed as semitransparent. A simple way to convey a sense of a character's feet being obscured by foliage and the like.
opacity
The sprite's opacity (0-255). Values out of range are automatically corrected.
blend_type
The sprite's blending mode (0: normal, 1: addition, 2: subtraction).
color
The color (Color) to be blended with the sprite. Alpha values are used in the blending ratio.
Handled separately from the color blended into a flash effect. However, the color with the higher alpha value when displayed will have the higher priority when blended.
tone
The sprite's color tone (Tone).
Last updated