Class: GamesAndRpgParadise::Graphics::Score::Placeholder

Inherits:
Sprite
  • Object
show all
Defined in:
lib/games_and_rpg_paradise/games/flappy_bird/ruby2d/graphics/score/placeholder.rb

Constant Summary collapse

NUMBER =
#

NUMBER

#
{
  '0' => { x: 992, y: 120 },
  '1' => { x: 271, y: 910 },
  '2' => { x: 584, y: 320 },
  '3' => { x: 612, y: 320 },
  '4' => { x: 640, y: 320 },
  '5' => { x: 668, y: 320 },
  '6' => { x: 584, y: 368 },
  '7' => { x: 612, y: 368 },
  '8' => { x: 640, y: 368 },
  '9' => { x: 668, y: 368 }
}.freeze

Instance Method Summary collapse

Constructor Details

#initializePlaceholder

initialize



36
37
38
39
40
41
42
43
44
45
46
47
48
# File 'lib/games_and_rpg_paradise/games/flappy_bird/ruby2d/graphics/score/placeholder.rb', line 36

def initialize
  super(
    GamesParadise::FlappyBird::FILE_IMAGE_GAME_SPRITE,
    width: 24,
    height: 36,
    y: 40,
    x: 132, z: -9999,
    clip_width: 24,
    clip_height: 36,
    clip_x: NUMBER['0'][:x],
    clip_y: NUMBER['0'][:y]
  )
end

Instance Method Details

#update!(number) ⇒ Object

update!



51
52
53
54
55
# File 'lib/games_and_rpg_paradise/games/flappy_bird/ruby2d/graphics/score/placeholder.rb', line 51

def update!(number)
  key = number.to_s
  self.clip_x = NUMBER[key][:x]
  self.clip_y = NUMBER[key][:y]
end