Sha256: 5ea54b7ab5d8f86a4051fbab010bb463c0b1251bafe80158d7d7cf400dded8aa

Contents?: true

Size: 609 Bytes

Versions: 1

Compression:

Stored size: 609 Bytes

Contents

class Background
  attr_accessor :scale, :color, :visible, :position, :layer

  def initialize(image_name:)
    @image = Image.new(image_name)
    @name = image_name
    @position = Coordinates.zero
    @scale = 1
    @visible = true
    @draggable_on_debug = true
    @dragging = false
    @layer = -100

    Global.backgrounds.push(self)
  end

  def width
    @image.width() * @scale
  end

  def height
    @image.height() * @scale
  end

  def draw
    if visible
      @image.draw(x: @position.x, y: @position.y, scale: @scale)
    end
  end

  def destroy
    Global.backgrounds.delete(self)
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
fantasy-0.1.3 lib/fantasy/background.rb