Class: Graphics::Bird

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

Constant Summary collapse

FILE_IMAGE_GAME_SPRITE =
#

FILE_IMAGE_GAME_SPRITE

#
GamesParadise::FlappyBird::FILE_IMAGE_GAME_SPRITE

Instance Method Summary collapse

Constructor Details

#initializeBird

#

initialize

#


21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
# File 'lib/games_and_rpg_paradise/games/flappy_bird/ruby2d/graphics/bird.rb', line 21

def initialize
  super(
    FILE_IMAGE_GAME_SPRITE,
    width: 34,
    height: 24,
    z: 2,
    clip_width: 34,
    clip_height: 24,
    animations: {
      floating: [
        { x: 6, y: 982, width: 34, height: 24, time: 300 },
        { x: 62, y: 982, width: 34, height: 24, time: 300 },
        { x: 118, y: 982, width: 34, height: 24, time: 300 }
      ]
    }
  )
  play(animation: :floating, loop: true)
end

Instance Method Details

#update!(logic) ⇒ Object



40
41
42
43
# File 'lib/games_and_rpg_paradise/games/flappy_bird/ruby2d/graphics/bird.rb', line 40

def update!(logic)
  self.x = logic.x
  self.y = logic.y
end