Currently I am trying to make a CCSlider with the two programs called Xcode(v6.1.1) & SpriteBuilder(v1.3.6) but I am still new and learning about them.
I would like some help to make a CCSlider that will give a value in the log depended on where the is standing.
Currently I've already got this:
-(void)weightSlider:(CCSlider *)slider
{
WSValue = MIN(WSValue, 1.0f);
WSValue = MAX(WSValue, 0.0f);
CCLOG(@"%f", WSValue);
}
Select the Slider in SpriteBuilder and on the Code Connections tab enter the name of the selector (with trailing colon since your implementation takes a parameter - it would also work with a parameterless method):
Be sure to have the method implemented in the document root node. The document root node is the root node of the CCB file containing the CCSlider instance. It has to have a custom class with that method in it, otherwise you'll receive a runtime error (most likely "unrecognized selector") when moving the slider.
Note that it is bad practice to prefix variable names or begin them with uppercase characters, because
WSValue
is easily confused as the name of a class (as inCCSprite
orNSString
). It should be refactored towsValue
or better yet, something more descriptive (What is "ws" supposed to be? Write it out!).