Class: Sprite

Overview

Class that describe a sprite shown on the screen or inside a viewport

Defined Under Namespace

Classes: WithColor

Instance Attribute Summary

Attributes inherited from LiteRGSS::ShaderedSprite

#blendmode, #shader

Attributes inherited from LiteRGSS::Sprite

#__index__, #angle, #bitmap, #height, #mirror, #opacity, #ox, #oy, #src_rect, #viewport, #visible, #width, #x, #y, #z, #zoom, #zoom_x, #zoom_y

Instance Method Summary collapse

Methods inherited from LiteRGSS::Sprite

new, #set_origin, #set_position

Methods inherited from LiteRGSS::Disposable

#dispose, #disposed?

Instance Method Details

#load(filename, cache_symbol) ⇒ self #load(bmp) ⇒ self Also known as: set_bitmap

Set the texture show on the screen surface

Overloads:

  • #load(filename, cache_symbol) ⇒ self

    Parameters:

    • filename (String)

      the name of the image

    • cache_symbol (Symbol)

      the symbol method to call with filename argument in RPG::Cache

    • auto_rect (Boolean)

      if the rect should be automatically set

  • #load(bmp) ⇒ self

    Parameters:

    • texture (Texture, nil)

      the bitmap to show

Returns:

  • (self)


1331
1332
# File 'docs/0_Dependencies.rb', line 1331

def load(texture, cache = nil, auto_rect = false)
end

#mouse_in?(mouse_x = Mouse.x, mouse_y = Mouse.y) ⇒ Boolean

Detect if the mouse is in the sprite (without rotation)

Parameters:

  • mouse_x (Integer) (defaults to: Mouse.x)

    the mouse x position on the screen

  • mouse_y (Integer) (defaults to: Mouse.y)

    the mouse y position on the screen

Returns:

  • (Boolean)

Author:

  • Nuri Yuri



1359
1360
# File 'docs/0_Dependencies.rb', line 1359

def mouse_in?(mouse_x = Mouse.x, mouse_y = Mouse.y)
end

#set_origin_div(ox, oy) ⇒ self

define the pixel of the bitmap that is shown at the coordinate of the sprite. The width and the height is divided by ox and oy to determine the pixel

Parameters:

  • ox (Numeric)

    factor of division of width to get the origin x

  • oy (Numeric)

    factor of division of height to get the origin y

Returns:

  • (self)


1305
1306
# File 'docs/0_Dependencies.rb', line 1305

def set_origin_div(ox, oy)
end

#set_rect(x, y, width, height) ⇒ self

Define the surface of the bitmap that is shown on the screen surface

Parameters:

  • x (Integer)

    x coordinate on the bitmap

  • y (Integer)

    y coordinate on the bitmap

  • width (Integer)

    width of the surface

  • height (Integer)

    height of the surface

Returns:

  • (self)


1313
1314
# File 'docs/0_Dependencies.rb', line 1313

def set_rect(x, y, width, height)
end

#set_rect_div(x, y, width, height) ⇒ self

Define the surface of the bitmap that is shown with division of it

Parameters:

  • x (Integer)

    the division index to show on x

  • y (Integer)

    the division index to show on y

  • width (Integer)

    the division of width of the bitmap to show

  • height (Integer)

    the division of height of the bitmap to show

Returns:

  • (self)


1321
1322
# File 'docs/0_Dependencies.rb', line 1321

def set_rect_div(x, y, width, height)
end

#set_z(z) ⇒ self

define the superiority of the sprite

Parameters:

  • z (Integer)

    superiority

Returns:

  • (self)


1298
1299
# File 'docs/0_Dependencies.rb', line 1298

def set_z(z)
end

#simple_mouse_in?(mouse_x = Mouse.x, mouse_y = Mouse.y) ⇒ Boolean

Detect if the mouse is in the sprite (without rotation and stuff like that)

Parameters:

  • mouse_x (Integer) (defaults to: Mouse.x)

    the mouse x position on the screen

  • mouse_y (Integer) (defaults to: Mouse.y)

    the mouse y position on the screen

Returns:

  • (Boolean)

Author:

  • Nuri Yuri



1352
1353
# File 'docs/0_Dependencies.rb', line 1352

def simple_mouse_in?(mouse_x = Mouse.x, mouse_y = Mouse.y)
end

#translate_mouse_coords(mouse_x = Mouse.x, mouse_y = Mouse.y) ⇒ Array(Integer, Integer)

Convert mouse coordinate on the screen to mouse coordinates on the sprite

Parameters:

  • mouse_x (Integer) (defaults to: Mouse.x)

    the mouse x position on the screen

  • mouse_y (Integer) (defaults to: Mouse.y)

    the mouse y position on the screen

Returns:

  • (Array(Integer, Integer))

    the mouse coordinates on the sprite

Author:

  • Nuri Yuri



1366
1367
# File 'docs/0_Dependencies.rb', line 1366

def translate_mouse_coords(mouse_x = Mouse.x, mouse_y = Mouse.y)
end

#update

RGSS Compatibility “update” the sprite



1293
1294
# File 'docs/0_Dependencies.rb', line 1293

def update
end