Class: UI::MiningGame::Tiles
- Inherits:
-
SpriteSheet
- Object
- LiteRGSS::Disposable
- LiteRGSS::Drawable
- LiteRGSS::Sprite
- LiteRGSS::ShaderedSprite
- Sprite
- ShaderedSprite
- SpriteSheet
- UI::MiningGame::Tiles
- Defined in:
- scripts/01450 Systems/08001 Mining Game/00030 UI_Mining_Game/00006 Tiles.rb
Overview
Class that describes the Tiles sprite
Instance Attribute Summary collapse
-
#state ⇒ Integer
State of the tile.
Attributes inherited from SpriteSheet
Attributes inherited from LiteRGSS::ShaderedSprite
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
-
#initialize(viewport, state) ⇒ Tiles
constructor
Create the Tiles.
-
#lower_state(reason)
Lower the state and update the image in consequence.
-
#update_sx
Update the state of the sheet.
Methods inherited from SpriteSheet
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
Constructor Details
#initialize(viewport, state) ⇒ Tiles
Create the Tiles
11 12 13 14 15 |
# File 'scripts/01450 Systems/08001 Mining Game/00030 UI_Mining_Game/00006 Tiles.rb', line 11 def initialize(, state) super(, possible_state_number, number_of_y_images) @state = state update_sx end |
Instance Attribute Details
#state ⇒ Integer
Returns state of the tile.
6 7 8 |
# File 'scripts/01450 Systems/08001 Mining Game/00030 UI_Mining_Game/00006 Tiles.rb', line 6 def state @state end |
Instance Method Details
#lower_state(reason)
Lower the state and update the image in consequence
24 25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'scripts/01450 Systems/08001 Mining Game/00030 UI_Mining_Game/00006 Tiles.rb', line 24 def lower_state(reason) if %i[pickaxe mace].include? reason @state -= 2 elsif reason == :side_pickaxe @state -= 1 elsif reason == :side_dynamite @state -= 4 elsif reason == :dynamite @state -= 6 end @state = 0 if @state < 0 update_sx end |
#update_sx
Update the state of the sheet
18 19 20 |
# File 'scripts/01450 Systems/08001 Mining Game/00030 UI_Mining_Game/00006 Tiles.rb', line 18 def update_sx self.sx = @state end |