Class: UI::Hall_of_Fame::Pokemon_Text_Box

Inherits:
SpriteStack show all
Defined in:
scripts/01300 UI/02000 Hall_Of_Fame/00004 Pokemon_Text_Box.rb

Overview

Class that define the Pokemon 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) ⇒ Pokemon_Text_Box

Initialize the SpriteStack

Parameters:



9
10
11
12
13
14
15
16
17
18
19
20
# File 'scripts/01300 UI/02000 Hall_Of_Fame/00004 Pokemon_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.mirror = true
  @box.sy = pkm.type1
  @name_text = add_text(*name_text_coordinates, pkm.given_name)
  @name_text.fill_color = WHITE_COLOR
  @name_text.draw_shadow = false
  @lvl_text = add_text(*lvl_text_coordinates, parse_text(27, 29) + " #{pkm.level}", 2)
  @lvl_text.fill_color = WHITE_COLOR
  @lvl_text.draw_shadow = false
end

Instance Method Details

#bmp_filenameString

The base filename of the window

Returns:



24
25
26
# File 'scripts/01300 UI/02000 Hall_Of_Fame/00004 Pokemon_Text_Box.rb', line 24

def bmp_filename
  'hall_of_fame/type_window'
end

#lvl_text_coordinatesArray<Integer>

The base coordinates of the level text

Returns:

  • (Array<Integer>)

    the coordinates



36
37
38
# File 'scripts/01300 UI/02000 Hall_Of_Fame/00004 Pokemon_Text_Box.rb', line 36

def lvl_text_coordinates
  return 121, 5, 35, 16
end

#name_text_coordinatesArray<Integer>

The base coordinates of the name text

Returns:

  • (Array<Integer>)

    the coordinates



30
31
32
# File 'scripts/01300 UI/02000 Hall_Of_Fame/00004 Pokemon_Text_Box.rb', line 30

def name_text_coordinates
  return 8, 5, 98, 16
end

#number_of_typesInteger

Check how many types the game has

Returns:

  • (Integer)

    the number of types



48
49
50
# File 'scripts/01300 UI/02000 Hall_Of_Fame/00004 Pokemon_Text_Box.rb', line 48

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

#spritesheet_coordinatesArray<Integer>

The SpriteStack initial coordinates

Returns:

  • (Array<Integer>)

    the coordinates



54
55
56
# File 'scripts/01300 UI/02000 Hall_Of_Fame/00004 Pokemon_Text_Box.rb', line 54

def spritesheet_coordinates
  return 320, 200
end

#widthInteger

Get the width of the box

Returns:

  • (Integer)

    the width of the box sprite



42
43
44
# File 'scripts/01300 UI/02000 Hall_Of_Fame/00004 Pokemon_Text_Box.rb', line 42

def width
  @box.width
end