Skip to content

Graphic Attributes

Complete reference of all attributes available on GraphicHandle.

Core Attributes

AttributeTypeR/WDescription
idintRGraphic ID (read-only)
namestrRWInternal name
file_namestrRWSLP/SMX filename
slp_idintRWSLP file ID

Usage

python
graphic = workspace.graphic_manager.get(100)

# Read
print(f"ID: {graphic.id}")
print(f"Name: {graphic.name}")
print(f"File: {graphic.file_name}")

# Write
graphic.name = "CUSTOM_GRAPHIC"
graphic.file_name = "custom.slp"

Animation Attributes

AttributeTypeR/WDescription
frame_countintRWNumber of animation frames
angle_countintRWNumber of angles/facets
frame_durationfloatRWDuration per frame (seconds)
animation_durationfloatRWTotal animation time (auto-calculates frame_rate)
speed_multiplierfloatRWAnimation speed multiplier (use 0.0 for static)
replay_delayfloatRWDelay before replay
first_frameintRWStarting frame index
sequence_typeintRWAnimation sequence type

Aliases

Some attributes have alternate names for convenience:

AliasOriginal
frame_countnum_frames
angle_countnum_facets
frame_durationframe_rate
speed_multiplierspeed_mult

Usage

python
# Animation configuration
graphic.frame_count = 15
graphic.angle_count = 8
graphic.frame_duration = 0.08  # 80ms per frame
graphic.speed_multiplier = 0.0  # Recommended: 0.0 for static graphics

# Alternative: Set total animation time (auto-calculates frame_duration)
graphic.animation_duration = 1.2  # 1.2 seconds total
# Internally: frame_duration = 1.2 / 15 = 0.08 seconds

Rendering Attributes

AttributeTypeR/WDescription
layerintRWRendering layer
player_colorintRWForce player color ID (-1 = use default)
transparent_selectionintRWTransparent pick mode
mirroring_modeintRWAngle mirroring behavior
rainbowintRWRainbow mode (DE)
editor_flagintRWEditor mode flags

Coordinates (Bounding Box)

AttributeTypeR/WDescription
coordinatestupleRWBounding box (X1, Y1, X2, Y2)
python
# Set bounding box
graphic.coordinates = (0, 0, 64, 64)

# Read
x1, y1, x2, y2 = graphic.coordinates

Audio Attributes

AttributeTypeR/WDescription
sound_idintRWAttached sound ID
wwise_sound_idintRWWwise sound ID (DE)
angle_sounds_usedboolRWPer-angle attack sounds

Usage

python
graphic.sound_id = 50
graphic.angle_sounds_used = True

Attack Sounds

Graphics can have up to 3 attack sounds triggered at specific frames:

PropertyDescription
attack_sound_1First attack sound
attack_sound_2Second attack sound
attack_sound_3Third attack sound

Use set_attack_sounds() method to configure all at once.


Delta Attributes

Deltas are accessed via methods. See Deltas.

python
# Get all deltas
for delta in graphic.deltas:
    print(f"Delta: {delta.sprite_id}")

Common Graphic Types

LayerTypical Use
0Default
5Terrain
10Shadows
20Units
30Buildings
40Effects/Projectiles

Example: Configure Animation

python
# Get or create graphic
graphic = workspace.graphic_manager.add_graphic("hero_walk.slp")

# Animation setup
graphic.frame_count = 10
graphic.angle_count = 8
graphic.frame_duration = 0.1  # 100ms per frame
graphic.speed_multiplier = 1.0

# Rendering
graphic.layer = 20  # Unit layer
graphic.player_color = -1  # Use player's color

# Sound
graphic.sound_id = 100  # Walking sound

Example: Mirror Graphics

Mirroring reduces file size by reusing frames:

python
# Enable mirroring (uses half the angles, mirrors the rest)
graphic.mirroring_mode = 1
graphic.angle_count = 8  # Only need 5, game mirrors for 8

Version-Specific Attributes

Some attributes are only available in certain game versions:

AttributeVersion
wwise_sound_idDE only
rainbowDE only
old_sound_idPre-DE

Released under the MIT License.