Sha256: 1e09e2eb666a67658aab2603829b64af06da86332cea95faaa33c28712b3f3e1

Contents?: true

Size: 721 Bytes

Versions: 2

Compression:

Stored size: 721 Bytes

Contents

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

  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

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
joybox-1.1.1 motion/joybox/core/node.rb
joybox-1.1.0 motion/joybox/core/node.rb