Class: UI::MiningGame::Hit_Counter_Sprite

Inherits:
SpriteSheet show all
Defined in:
scripts/01450 Systems/08001 Mining Game/00030 UI_Mining_Game/00004 Hit_Counter_Sprite.rb

Overview

Class that describes the Hit_Counter_Sprite

Instance Attribute Summary collapse

Attributes inherited from SpriteSheet

#nb_x, #nb_y, #sx, #sy

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 SpriteSheet

#bitmap=, #select

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, reason) ⇒ Hit_Counter_Sprite

Create the Hit_Counter_Sprite

Parameters:

  • viewport (Viewport)

    the viewport of the scene

  • reason (Symbol)

    the symbol corresponding to the Hit_Counter_Sprite number



13
14
15
16
17
18
19
# File 'scripts/01450 Systems/08001 Mining Game/00030 UI_Mining_Game/00004 Hit_Counter_Sprite.rb', line 13

def initialize(viewport, reason)
  @reason = reason
  super(viewport, number_of_image_x, number_of_image_y)
  set_bitmap(bitmap_filename, :interface)
  @state = -1
  set_visible
end

Instance Attribute Details

#reasonSymbol

Returns the symbol corresponding to the Hit_Counter_Sprite number (:first or :not_first).

Returns:

  • (Symbol)

    the symbol corresponding to the Hit_Counter_Sprite number (:first or :not_first)



8
9
10
# File 'scripts/01450 Systems/08001 Mining Game/00030 UI_Mining_Game/00004 Hit_Counter_Sprite.rb', line 8

def reason
  @reason
end

#stateInteger

Returns the current state.

Returns:



6
7
8
# File 'scripts/01450 Systems/08001 Mining Game/00030 UI_Mining_Game/00004 Hit_Counter_Sprite.rb', line 6

def state
  @state
end

Instance Method Details

#change_state

Change the state of the Hit_Counter_Sprite



22
23
24
25
26
# File 'scripts/01450 Systems/08001 Mining Game/00030 UI_Mining_Game/00004 Hit_Counter_Sprite.rb', line 22

def change_state
  @state += 1
  update_sheet
  set_visible unless @state > 0
end

#number_of_image_yInteger

Return the number of images on a same column

Returns:



30
31
32
33
34
35
36
# File 'scripts/01450 Systems/08001 Mining Game/00030 UI_Mining_Game/00004 Hit_Counter_Sprite.rb', line 30

def number_of_image_y
  if @reason == :first
    return 9
  else
    return 7
  end
end