Class: RoadToRubykaigi::Sprite::Bonuses

Inherits:
Object
  • Object
show all
Extended by:
Forwardable
Defined in:
lib/road_to_rubykaigi/sprite/bonus.rb

Constant Summary collapse

BONUSES_DATA =
{
  2025 => {
    Basic: [
      { x: 39, y: 22, character: :ruby },
      { x: 46, y: 22, character: :ruby },
      { x: 53, y: 22, character: :ruby },
      { x: 107, y: 23, character: :coffee },
      { x: 110, y: 23, character: :book },
      { x: 142, y: 16, character: :ruby },
      { x: 146, y: 16, character: :ruby },
      { x: 205, y: 19, character: :money },
      { x: 212, y: 19, character: :money },
      { x: 205, y: 19, character: :money },
      { x: 212, y: 19, character: :money },
      { x: 223, y: 17, character: :money },
      { x: 231, y: 17, character: :money },
      { x: 243, y: 13, character: :money },
      { x: 250, y: 13, character: :money },
      { x: 260, y: 10, character: :sushi },
      { x: 265, y: 10, character: :meat },
      { x: 270, y: 10, character: :fish },
      { x: 260, y: 10, character: :sushi },
      { x: 265, y: 10, character: :meat },
      { x: 270, y: 10, character: :fish },
      { x: 275, y: 10, character: :sushi },
      { x: 280, y: 10, character: :meat },
      { x: 285, y: 10, character: :fish },
      { x: 290, y: 10, character: :sushi },
      { x: 295, y: 10, character: :meat },
      { x: 300, y: 10, character: :fish },
      { x: 358, y: 15, character: :money },
      { x: 363, y: 13, character: :money },
      { x: 368, y: 15, character: :money },
      { x: 373, y: 13, character: :money },
      { x: 378, y: 15, character: :money },
      { x: 383, y: 13, character: :money },
      { x: 388, y: 15, character: :money },
    ],
    Alcohol: [
      { x: 217, y: 28, character: :beer },
      { x: 220, y: 28, character: :beer },
      { x: 223, y: 28, character: :beer },
    ],
    Laptop: [
      { x: 298, y: 23, character: :laptop },
    ],
  },
  2026 => {
    Basic: [
      { x: 60, y: 25, character: :ruby },
      { x: 67, y: 25, character: :ruby },
      { x: 74, y: 25, character: :ruby },
      { x: 107, y: 23, character: :coffee },
      { x: 110, y: 23, character: :book },
      { x: 140, y: 13, character: :ruby },
      { x: 167, y: 13, character: :ruby },
      { x: 182, y: 13, character: :ruby },

      { x: 240, y: 20, character: :money },
      { x: 260, y: 18, character: :money },
      { x: 279, y: 16, character: :money },

      { x: 315, y: 18, character: :sushi },
      { x: 320, y: 18, character: :meat },
      { x: 325, y: 18, character: :fish },
      { x: 330, y: 18, character: :sushi },
      { x: 335, y: 18, character: :meat },

      { x: 390, y: 13, character: :money },
      { x: 399, y: 14, character: :money },
      { x: 406, y: 14, character: :money },
      { x: 415, y: 14, character: :money },

      { x: 600, y: 15, character: :sakura },
      { x: 613, y: 13, character: :sakura },
      { x: 626, y: 11, character: :sakura },
      { x: 713, y: 11, character: :sakura },

    ],
    Alcohol: [],
    Laptop: [],
  },
}

Instance Method Summary collapse

Instance Method Details

#build_buffer(offset_x:) ⇒ Object



92
93
94
95
96
97
98
99
100
101
102
103
104
105
# File 'lib/road_to_rubykaigi/sprite/bonus.rb', line 92

def build_buffer(offset_x:)
  buffer = Array.new(Map::VIEWPORT_HEIGHT) { Array.new(Map::VIEWPORT_WIDTH) { "" } }
  @bonuses.each do |bonus|
    bounding_box = bonus.bounding_box
    relative_x = bounding_box[:x] - offset_x - 1
    relative_y = bounding_box[:y] - 1
    next if relative_x < 1
    bonus.characters.each_with_index do |character, j|
      next if relative_x + j >= Map::VIEWPORT_WIDTH - 1
      buffer[relative_y][relative_x+j] = character
    end
  end
  buffer
end

#updateObject



107
108
# File 'lib/road_to_rubykaigi/sprite/bonus.rb', line 107

def update
end