motion/joybox/core/node.rb in joybox-1.0.0 vs motion/joybox/core/node.rb in joybox-1.1.0

- old
+ new

@@ -1,26 +1,36 @@ class CCNode alias_method :add_child, :addChild + alias_method :run_action, :runAction + alias_method :stop_action, :stopAction + alias_method :stop_all_actions, :stopAllActions + alias_method :number_of_running_actions, :numberOfRunningActions def << (node) - self.addChild(node) end def self.inherited(base) - base.send(:include, Joybox) end - #TODO: Revisar el nombre de este metodo - def add_childs(*nodes) - + def add_children(*nodes) nodes.each do |node| - self.addChild(node) - end - end + + def schedule_update(&block) + @schedule_update_block = block if block_given? + scheduleUpdate + end + + def update(dt) + @schedule_update_block.call(dt) if @schedule_update_block + end + + def running_actions? + self.number_of_running_actions > 0 + end end \ No newline at end of file