lib/gamebox/behaviors/layered.rb in gamebox-0.1.1 vs lib/gamebox/behaviors/layered.rb in gamebox-0.2.1
- old
+ new
@@ -14,29 +14,15 @@
end
@layer ||= 0
@parallax ||= 1
- layered_obj = self
- @actor.instance_eval do
- (class << self; self; end).class_eval do
- define_method :layer= do |new_layer|
- layered_obj.layer = new_layer
- end
- define_method :parallax= do |new_parallax|
- layered_obj.parallax = new_parallax
- end
- define_method :layer do
- layered_obj.layer
- end
- define_method :parallax do
- layered_obj.parallax
- end
- define_method :layered do
- layered_obj
- end
- end
- end
+ relegates :layer=, :layer, :parallax=, :parallax,
+ :layered
+ end
+
+ def layered
+ self
end
def parallax=(new_parallax)
@parallax = new_parallax
end