Class: UI::MiningGame::Tool_Sprite
- Inherits:
-
SpriteSheet
- Object
- LiteRGSS::Disposable
- LiteRGSS::Drawable
- LiteRGSS::Sprite
- LiteRGSS::ShaderedSprite
- Sprite
- ShaderedSprite
- SpriteSheet
- UI::MiningGame::Tool_Sprite
- Defined in:
- scripts/01450 Systems/08001 Mining Game/00030 UI_Mining_Game/00008 Tool_Sprite.rb
Overview
Class describing the Tool_Sprite object
Direct Known Subclasses
Instance Attribute Summary collapse
-
#tool ⇒ Symbol
The symbol of the currently used tool.
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
-
#add_to_x(nb)
Increase x attribute by nb.
-
#add_to_y(nb)
Increase y attribute by nb.
-
#change_tool(sym_tool)
Change the tool image.
-
#initialize(viewport) ⇒ Tool_Sprite
constructor
Create the Tool_Sprite.
-
#new_frame
Set the next frame of the sheet.
-
#sub_to_x(nb)
Decrease x attribute by nb.
-
#sub_to_y(nb)
Decrease y attribute by nb.
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) ⇒ Tool_Sprite
Create the Tool_Sprite
8 9 10 11 12 |
# File 'scripts/01450 Systems/08001 Mining Game/00030 UI_Mining_Game/00008 Tool_Sprite.rb', line 8 def initialize() super(, number_image_x, number_image_y) change_tool(GamePlay::MiningGame::TOOLS[0]) self.visible = false end |
Instance Attribute Details
#tool ⇒ Symbol
Returns the symbol of the currently used tool.
6 7 8 |
# File 'scripts/01450 Systems/08001 Mining Game/00030 UI_Mining_Game/00008 Tool_Sprite.rb', line 6 def tool @tool end |
Instance Method Details
#add_to_x(nb)
Increase x attribute by nb
16 17 18 |
# File 'scripts/01450 Systems/08001 Mining Game/00030 UI_Mining_Game/00008 Tool_Sprite.rb', line 16 def add_to_x(nb) self.x = x + nb end |
#add_to_y(nb)
Increase y attribute by nb
28 29 30 |
# File 'scripts/01450 Systems/08001 Mining Game/00030 UI_Mining_Game/00008 Tool_Sprite.rb', line 28 def add_to_y(nb) self.y = y + nb end |
#change_tool(sym_tool)
Change the tool image
50 51 52 53 |
# File 'scripts/01450 Systems/08001 Mining Game/00030 UI_Mining_Game/00008 Tool_Sprite.rb', line 50 def change_tool(sym_tool) self.tool = sym_tool change_image end |
#new_frame
Set the next frame of the sheet
39 40 41 42 43 44 45 46 |
# File 'scripts/01450 Systems/08001 Mining Game/00030 UI_Mining_Game/00008 Tool_Sprite.rb', line 39 def new_frame if sx + 1 == nb_x self.sx = 0 else self.sx += 1 end update end |
#sub_to_x(nb)
Decrease x attribute by nb
22 23 24 |
# File 'scripts/01450 Systems/08001 Mining Game/00030 UI_Mining_Game/00008 Tool_Sprite.rb', line 22 def sub_to_x(nb) self.x = x - nb end |
#sub_to_y(nb)
Decrease y attribute by nb
34 35 36 |
# File 'scripts/01450 Systems/08001 Mining Game/00030 UI_Mining_Game/00008 Tool_Sprite.rb', line 34 def sub_to_y(nb) self.y = y - nb end |