Sha256: 8233e36d9128373662bac242995c84960be17b3f67784d33a5019fe705fc4c04

Contents?: true

Size: 603 Bytes

Versions: 3

Compression:

Stored size: 603 Bytes

Contents

# Keeps track of the layer that something is to be drawn on.
# By default it sets everything to layer 0 and parallax layer of
# 1.
class Layered < Behavior

  attr_accessor :layer, :parallax
  def setup
    if @opts.is_a? Hash
      @layer = @opts[:layer]
      @parallax = @opts[:parallax]
    else
      @layer = @opts
    end
    
    @layer ||= 0
    @parallax ||= 1

    relegates :layer=, :layer, :parallax=, :parallax, 
      :layered
  end

  def layered
    self
  end

  def parallax=(new_parallax)
    @parallax = new_parallax
  end

  def layer=(new_layer)
    @layer = new_layer
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
gamebox-0.3.4 lib/gamebox/behaviors/layered.rb
gamebox-0.3.3 lib/gamebox/behaviors/layered.rb
gamebox-0.3.2 lib/gamebox/behaviors/layered.rb