CCSprite Move

CCSprite Move
0.0 0


Im have Sprite , how is it possible to do, pressing on him?


You have to write a function in the Layer to handle touch events

In that function you have to check if the touch position is within the bounds of the sprite.

CCRect r= sprite->boundingBox();
if(r. containsPoint(touchPoint)){
CCLog(“Clicked on sprite”);



im have:
CCSprite* mps = CCSprite::create(“mps.png”);

this~~>addChild(mps, 1);

I want to get going MPS:

if(click.mps == true){
mps->setPosition(ccp(size.width/4, 3*size.height/4));


ah my bad… thought you were asking about how to detect if sprite was touched… sry