Class: RubyFighter::Backdrop

Inherits:
Gosu::Image
  • Object
show all
Defined in:
lib/ruby_fighter/backdrop.rb

Instance Method Summary collapse

Constructor Details

#initialize(window, filename) ⇒ Backdrop

Returns a new instance of Backdrop.



5
6
7
8
9
10
# File 'lib/ruby_fighter/backdrop.rb', line 5

def initialize(window, filename)
  super(window, "assets/#{filename}", false)

  @scale = window.height / height
  @bg_x  = -(width * @scale - window.width) / 2
end

Instance Method Details

#drawObject



12
13
14
# File 'lib/ruby_fighter/backdrop.rb', line 12

def draw
  super @bg_x, 0, 0, @scale, @scale
end