Sha256: 4f01e846780ca367578540ffb819cf047e49a552b9a0d4c3db366d11985f1342

Contents?: true

Size: 333 Bytes

Versions: 3

Compression:

Stored size: 333 Bytes

Contents

define_behavior :positioned do
  setup do
    x = opts[:x] || 0
    y = opts[:y] || 0
    actor.has_attributes x: x, y: y
    actor.has_attributes position: vec2(actor.x, actor.y)
    actor.when(:x_changed) { actor.position = vec2(actor.x, actor.y) }
    actor.when(:y_changed) { actor.position = vec2(actor.x, actor.y) }
  end

end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
gamebox-0.4.1 lib/gamebox/behaviors/positioned.rb
gamebox-0.4.0 lib/gamebox/behaviors/positioned.rb
gamebox-0.4.0.rc11 lib/gamebox/behaviors/positioned.rb