CCProgressNode Class Reference

Inherits from CCNode : CCResponder : NSObject
Declared in CCProgressNode.h

Overview

CCProgressNode uses a CCSprite whose texture can be revealed progressively.

  • Progress type can currently be Radial, Horizontal or vertical.
  • Midpoint is used to modify the start position:

    • Radial type: the mid point changes the center point.
    • Bar type: the midpoint changes the bar growth, it expands from the center but clamps to the sprites edge:
      • Left -> Right use (0,0)
      • Right -> Left use (1,y)
      • Bottom -> Top use (x,0)
      • Top -> Bottom use (x,1)
  • Progress percentage is in the range 0 -> 100.

  • Bar change rate allows the bar type to move the component at a specific rate.
    • Set the rate to zero to make sure it stays at 100%
    • Example: If you want a Left -> Right bar and also have the height grow set the rate to (0, 1) and modpoint to (0, 0.5)

Creating a Progress Node

+ progressWithSprite:

Creates and returns a progress node object using the specified sprite value.

+ (instancetype)progressWithSprite:(CCSprite *)sprite

Parameters

sprite

The CCSprite to use.

Return Value

The CCProgressNode Object.

See Also

Declared In

CCProgressNode.h

– initWithSprite:

Initializes and returns a progress node object using the specified sprite value.

- (id)initWithSprite:(CCSprite *)sprite

Parameters

sprite

The CCSprite to use.

Return Value

An initialized CCProgressNode Object.

See Also

Declared In

CCProgressNode.h

Changing Progress Behavior

  type

Determines how the sprite’s texture is revealed.

@property (nonatomic, readwrite) CCProgressNodeType type

Declared In

CCProgressNode.h

  reverseDirection

Reverse the direction of the progressive reveal.

@property (nonatomic, readwrite) BOOL reverseDirection

Declared In

CCProgressNode.h

  midpoint

Progress start position.

@property (nonatomic, readwrite) CGPoint midpoint

Declared In

CCProgressNode.h

Animating the Progress Node

  percentage

Progress percentage. Changing this will effectively animate the progress node.

@property (nonatomic, readwrite) float percentage

Declared In

CCProgressNode.h

  barChangeRate

Rate at which the bar changes.

@property (nonatomic, readwrite) CGPoint barChangeRate

Declared In

CCProgressNode.h

Accessing the Progress Sprite

  sprite

The CCSprite used by the progress node.

@property (nonatomic, readwrite, strong) CCSprite *sprite

See Also

Declared In

CCProgressNode.h