Class: UI::Hall_of_Fame::Congratulation_Text_Box

Inherits:
SpriteStack show all
Defined in:
scripts/01300 UI/02000 Hall_Of_Fame/00005 Congratulation_Text_Box.rb

Overview

Class that define the Congratulation text box stack

Constant Summary collapse

WHITE_COLOR =
Color.new(255, 255, 255)

Constants inherited from SpriteStack

SpriteStack::NO_INITIAL_IMAGE

Instance Attribute Summary

Attributes inherited from SpriteStack

#animated, #data, #moving, #stack, #viewport, #x, #y

Instance Method Summary collapse

Methods inherited from SpriteStack

#[], #add_background, #add_line, #add_text, #anime, #anime_delta_set, #dispose, #each, #execute_anime, #move, #move_to, #opacity, #opacity=, #push, #push_sprite, #set_origin, #set_position, #simple_mouse_in?, #size, #stop_animation, #translate_mouse_coords, #update, #update_animation, #update_position, #visible, #visible=, #with_cache, #with_font, #with_surface, #z, #z=

Constructor Details

#initialize(viewport, pkm) ⇒ Congratulation_Text_Box

Initialize the SpriteStack

Parameters:



9
10
11
12
13
14
15
16
# File 'scripts/01300 UI/02000 Hall_Of_Fame/00005 Congratulation_Text_Box.rb', line 9

def initialize(viewport, pkm)
  super(viewport, *spritesheet_coordinates)
  @box = add_sprite(0, 0, bmp_filename, 1, number_of_types, type: SpriteSheet)
  @box.sy = pkm.type1
  @text = add_text(*text_coordinates, parse_text(32, 109))
  @text.fill_color = WHITE_COLOR
  @text.draw_shadow = false
end

Instance Method Details

#bmp_filenameString

The base filename of the window

Returns:



20
21
22
# File 'scripts/01300 UI/02000 Hall_Of_Fame/00005 Congratulation_Text_Box.rb', line 20

def bmp_filename
  'hall_of_fame/type_window'
end

#number_of_typesInteger

Check how many types the game has

Returns:

  • (Integer)

    the number of types



32
33
34
# File 'scripts/01300 UI/02000 Hall_Of_Fame/00005 Congratulation_Text_Box.rb', line 32

def number_of_types
  return GameData::Type.all.size
end

#spritesheet_coordinatesArray<Integer>

The SpriteStack initial coordinates

Returns:

  • (Array<Integer>)

    the coordinates



44
45
46
# File 'scripts/01300 UI/02000 Hall_Of_Fame/00005 Congratulation_Text_Box.rb', line 44

def spritesheet_coordinates
  return -184, 20
end

#text_coordinatesArray<Integer>

The base coordinates of the text

Returns:

  • (Array<Integer>)

    the coordinates



26
27
28
# File 'scripts/01300 UI/02000 Hall_Of_Fame/00005 Congratulation_Text_Box.rb', line 26

def text_coordinates
  return 28, 5, 152, 16
end

#widthInteger

Get the width of the box

Returns:

  • (Integer)

    the width of the box sprite



38
39
40
# File 'scripts/01300 UI/02000 Hall_Of_Fame/00005 Congratulation_Text_Box.rb', line 38

def width
  @box.width
end