cpinan
#1
Hello, well this is my first contribution with the community.
I’ll find this https://github.com/Ntran013/SneakyInput and work with Cocos2dx older versions
I did some changes and now work with cocos2dx 2.0.2 and 2.0.3 (Just I tested in that version)
I’ll wait this can help you, all code is in:
Greetings.
I tried it but it always crashes:
fireButton = new SneakyButton();
fireButton~~>initWithRect;
fireButton~~>setIsHoldable(true);
It crashes when I setIsHoldable (actually it crashes when I call any set function)
cpinan
#4
Hello, sorry for the delay.
I don’t test the holdable option but I’ll check that and fix it.
Thanks =D
Actually it crashes on any set functions. Thanks
So what does it actually do?
cpinan
#7
Hello, sorry for the delay I’ll attach some code I used in one of my projects tested in cocos2dx 2.0.2 and 2.0.3
// ###########################################################################
SneakyJoystickSkinnedBase joystickBase =
SneakyJoystickSkinnedBase::create;
SneakyJoysticktmpJoystick = new SneakyJoystick();
tmpJoystick~~>initWithRect;
joystickBase~~>setBackgroundSprite(CCSprite::create(“dpadDown.png”));
joystickBase~~>setThumbSprite);
joystickBase~~>setJoystick(tmpJoystick);
joystickBase~~>setPosition;
leftJoystick = joystickBase~~>getJoystick();
this~~>addChild;
// ###########################################################################
SneakyButton tmpButton = new SneakyButton;
SneakyButtonSkinnedBaseaccelButtonBase =
SneakyButtonSkinnedBase::create;
tmpButton = new SneakyButton;
tmpButton~~>initWithRect(accelButtonDimensions);
accelButtonBase~~>setDefaultSprite);
accelButtonBase~~>setActivatedSprite(CCSprite::create(“accelDown.png”));
accelButtonBase~~>setPressSprite);
accelButtonBase~~>setButton(tmpButton);
accelButtonBase~~>setPosition;
accelButton = accelButtonBase~~>getButton();
accelButton~~>setIsToggleable;
this~~>addChild(accelButtonBase);
// ###########################################################################
And my vars in .h are:
SneakyJoystick leftJoystick;
SneakyButtonaccelButton;
Currently I’m finding one project that I converto from obj-c to cpp and I’ll uploaded.
Thanks for your reply. I’ll try your code.
Hi,
I am new to cocos2dx. I am trying your wonderful code but getting an error in scheduleUpdate:
@ CCPoint scaleVelocit = ccpMult(leftJoyStick~~>velocity,240); //// error : velocity is protected member of SneakyJoystick
CCPoint newPosition = CCPoint;
airFighter~~>setPosition(newPosition);@
how can I get the velocity then? Please reply.
oops…
I was accessing velocity as leftJoyStick~~>velocity but it should be leftJoyStick~~>getVelocity() .
It solved the problem.