Class cc.Timer

Class Summary
Constructor Attributes Constructor Name and Description
 
Light weight timer

Method Summary

Class Detail

cc.Timer()
Light weight timer

Method Detail

  • ctor()
    cc.Timer's Constructor Constructor
  • {Number} getInterval()
    returns interval of timer
    Returns:
    {Number}
  • {String|function} getSelector()
    returns selector
    Returns:
    {String|function}
  • {Boolean} initWithTarget(target, selector, seconds, repeat, delay)
    Initializes a timer with a target, a selector and an interval in seconds.
    Parameters:
    {cc.Class} target
    target
    {String|function} selector
    Selector
    {Number} seconds Optional, Default: 0
    second
    {Number} repeat Optional, Default: cc.REPEAT_FOREVER
    repeat times
    {Number} delay Optional, Default: 0
    delay
    Returns:
    {Boolean} true if initialized *
  • setInterval(interval)
    set interval in seconds
    Parameters:
    {Number} interval
  • <static> {cc.Timer} cc.Timer.timerWithTarget(target, selector, seconds)
    Allocates a timer with a target, a selector and an interval in seconds.
    Parameters:
    {cc.Class} target
    {String|function} selector
    Selector
    {Number} seconds
    Returns:
    {cc.Timer} a cc.Timer instance
  • update(dt)
    triggers the timer
    Parameters:
    {Number} dt
    delta time