相关疑难解决方法(0)

在cocos2d中捏时如何缩放精灵?

我正在开发一个应用程序,我必须显示50到70个图像(精灵).我已经制作了一个滚动滚动所有这些图像,但我也想缩放这些图像我也一直在关注" http:// ganbarugames .com/2010/12/detected-touch-events-in-cocos2d-iphone / "这个教程.我想要完全相同的东西,但是那个教程只为一个精灵做了缩放的东西,但我想在每个精灵上做什么我该怎么办?请帮帮我?

-(void)ccTouchMoved:(UITouch *)touch withEvent:(UIEvent *)event
  {
    CGPoint touchPoint = [touch locationInView:[touch view]];

    touchPoint = [[CCDirector sharedDirector]convertToGL:touchPoint];
   self.position = ccp((-(currentScreen-1)*scrollWidth)+(touchPoint.x-startSwipe),0);

--> NSArray *touchArray = [touches allObjects];
if([touchArray count] > 1)
{
    UITouch *fingerOne = [touchArray objectAtIndex:0];
    UITouch *fingerTwo = [touchArray objectAtIndex:1];

    CGPoint pointOne = [fingerOne locationInView:[fingerOne view]];
    CGPoint pointTwo = [fingerTwo locationInView:[fingerTwo view]];

pointOne = [[CCDirector sharedDirector] convertToGL:pointOne];
    pointTwo = [[CCDirector sharedDirector] convertToGL:pointTwo];

    float distance = sqrt(pow(pointOne.x - pointTwo.x, 2.0) + pow(pointOne.y - pointTwo.y, …
Run Code Online (Sandbox Code Playgroud)

cocos2d-iphone

3
推荐指数
1
解决办法
4887
查看次数

标签 统计

cocos2d-iphone ×1