# Sprite

## Superclass

* [Object](https://enls.gitbook.io/rgss-reference-manual/standard-library/built-in-classes/object)

## Class Method

### Sprite.new(\[*viewport*])

Creates a new Sprite object. Specifies a Viewport ([Viewport](https://enls.gitbook.io/rgss-reference-manual/game-library/rgss-built-in-classes/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](https://enls.gitbook.io/rgss-reference-manual/game-library/rgss-built-in-classes/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](https://enls.gitbook.io/rgss-reference-manual/game-library/rgss-built-in-classes/bitmap)) used for the sprite's starting point.

### src\_rect

The box ([Rect](https://enls.gitbook.io/rgss-reference-manual/game-library/rgss-built-in-classes/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](https://enls.gitbook.io/rgss-reference-manual/game-library/rgss-built-in-classes/color)) to be blended with the sprite. Alpha values are used in the blending ratio.

Handled separately from the color blended into a [flash](#flash-color-duration) 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](https://enls.gitbook.io/rgss-reference-manual/game-library/rgss-built-in-classes/tone)).


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://enls.gitbook.io/rgss-reference-manual/game-library/rgss-built-in-classes/sprite.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
