[ Prev | Index | Next ]
Japanese English

Controlling Sprites

This section explains how to configure and control sprites after they've been created and registered.

Setting Sprite Color

You can set the color of a sprite after creating it -- and you're free to change it at any time afterward. To set a sprite's color, use the setSpriteColor function.

- Function Format -
void setSpriteColor (
  int spriteID,
  int red, int green, int blue, int alpha
)

Arguments:

  • spriteID: The ID of the sprite.
  • red, green, blue, alpha: The color components in RGBA format, each specified in the range from 0 to 255.

What Is RGBA Format?

RGBA stands for Red, Green, Blue, and Alpha -- the three primary colors of light plus a transparency value.

The alpha value represents the opacity of the color: 0 means fully transparent, and higher values move toward full opacity.

Color blending is done using additive color mixing, which simulates how light behaves -- unlike mixing paints, which uses subtractive blending. For example:

  • (red, green, blue) = (255, 255, 255) gives white, not black.
  • (red, green, blue) = (255, 255, 0) gives yellow.
  • (red, green, blue) = (0, 255, 255) gives cyan.
  • (red, green, blue) = (255, 0, 255) gives magenta.

Setting Sprite Depth

Each sprite has a depth value.

When multiple sprites are rendered together, those with higher depth values appear behind those with lower values. To set a sprite's depth, use the "setSpriteDepth" function.

- Function Format -
void setSpriteDepth ( int spriteID, float depth )

Arguments:

  • spriteID: The ID of the sprite.
  • depth: The new top-left position for the sprite.

This function can be used with rectangle sprites, ellipse sprites, text sprites, and image sprites.

Changing Sprite Size

To change a sprite's drawing size, use the "setSpriteSize" function.

There are two variations depending on the type of sprite.

For Point Sprites:

- Function Format -
void setSpriteLocation ( int spriteID, int x, int y )

Arguments:

  • spriteID: The ID of the point sprite.
  • x, y: The radius of the point.

For Rectangle, Ellipse, Text, and Image Sprites:

- Function Format -
void setSpriteSize ( int spriteID, int width, int height )

Arguments:

  • spriteID: The ID of the sprite.
  • width, height: The new width and height of the sprite.


Sponsored Link



Japanese English
Index
News From RINEARN
* VCSSL is developed by RINEARN.

VCSSL 3.4.52 Released: Enhanced Integration with External Programs and More
2025-05-25 - This update introduces enhancements to the external program integration features (e.g., for running C-language executables). Several other improvements and fixes are also included. Details inside.

Released: Latest Version of VCSSL with Fixes for Behavioral Changes on Java 24
2025-04-22 - VCSSL 3.4.50 released with a fix for a subtle behavioral change in absolute path resolution on network drives, introduced in Java 24. Details inside.

Released the Latest Versions of RINEARN Graph and VCSSL - Now Supporting Customizable Tick Positions and Labels!
2024-11-24 - Starting with this update, a new "MANUAL" tick mode is now supported, allowing users to freely specify the positions and labels of ticks on the graph. We'll explain the details and how to use it.

Released Exevalator 2.2: Now Compatible with TypeScript and Usable in Web Browsers
2024-10-22 - The open-source expression evaluation library, Exevalator, has been updated to version 2.2. It now supports TypeScript and can be used for evaluating expressions directly in web browsers. Explains the details.

Behind the Scenes of Creating an Assistant AI (Part 1: Fundamental Knowledge)
2024-10-07 - The first part of a series on how to create an Assistant AI. In this article, we introduce the essential knowledge you need to grasp before building an Assistant AI. What exactly is an LLM-based AI? What is RAG? And more.

Launching an Assistant AI to Support Software Usage!
2024-09-20 - We've launched an Assistant AI that answers questions about how to use RINEARN software and helps with certain tasks. Anyone with a ChatGPT account can use it for free. We'll explain how to use it.

Software Updates: Command Expansion in RINEARN Graph, and English Support in VCSSL
2024-02-05 - We updated our apps. This updates include "Enhancing the Command-Line Features of RINEARN Graph" and "Adding English Support to VCSSL." Dives into each of them!

Inside the Repetitive Execution Speedup Impremented in Vnano Ver.1.1
2024-01-17 - Delves into the update in Vnano 1.1 from a developer's viewpoint, providing detailed insights into the specific improvements made to the internal structure of the script engine.