Class: SpriteSheet

Overview

SpriteSheet is a class that helps the maker to display a sprite from a Sprite Sheet on the screen

Instance Attribute Summary collapse

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 Sprite

#load, #mouse_in?, #set_origin_div, #set_rect, #set_rect_div, #set_z, #simple_mouse_in?, #translate_mouse_coords, #update

Methods inherited from LiteRGSS::Sprite

new, #set_origin, #set_position

Methods inherited from LiteRGSS::Disposable

#dispose, #disposed?

Constructor Details

#initialize(viewport, nb_x, nb_y) ⇒ SpriteSheet

Create a new SpriteSheet

Parameters:

  • viewport (Viewport, nil)

    where to display the sprite

  • nb_x (Integer)

    the number of sprites on the x axis in the sheet

  • nb_y (Integer)

    the number of sprites on the y axis in the sheet



478
479
# File 'docs/00700_Ajout_PSDK.rb', line 478

def initialize(viewport, nb_x, nb_y)
end

Instance Attribute Details

#nb_xInteger

Return the number of sprite on the x axis of the sheet

Returns:

  • (Integer)


464
465
466
# File 'docs/00700_Ajout_PSDK.rb', line 464

def nb_x
  @nb_x
end

#nb_yInteger

Return the number of sprite on the y axis of the sheet

Returns:

  • (Integer)


467
468
469
# File 'docs/00700_Ajout_PSDK.rb', line 467

def nb_y
  @nb_y
end

#sxInteger

Return the x sprite index of the sheet

Returns:

  • (Integer)


470
471
472
# File 'docs/00700_Ajout_PSDK.rb', line 470

def sx
  @sx
end

#syInteger

Return the y sprite index of the sheet

Returns:

  • (Integer)


473
474
475
# File 'docs/00700_Ajout_PSDK.rb', line 473

def sy
  @sy
end

Instance Method Details

#bitmap=(value)

Change the bitmap of the sprite

Parameters:



482
483
# File 'docs/00700_Ajout_PSDK.rb', line 482

def bitmap=(value)
end

#resize(nb_x, nb_y)

Redefine the number of cells the sheet supports on both axis

Parameters:

  • nb_x (Integer)

    number of cell on the x axis

  • nb_y (Integer)

    number of cell on the y axis



495
496
# File 'docs/00700_Ajout_PSDK.rb', line 495

def resize(nb_x, nb_y)
end

#select(sx, sy) ⇒ self

Select a sprite on the sheet according to its x and y index

Parameters:

  • sx (Integer)

    the x sprite index of the sheet

  • sy (Integer)

    the y sprite index of the sheet

Returns:

  • (self)


509
510
# File 'docs/00700_Ajout_PSDK.rb', line 509

def select(sx, sy)
end