0
CGRect rect = CGRectMake(sprites.boundingBox.origin.x, sprites.boundingBox.origin.y, sprites.boundingBox.size.width, scale);

如何将此 CGRect 分配给 CCSprite?

    float scale = sprites.boundingBox.size.height * 1.2;
    CGPoint point = CGPointMake(sprites.position.x,sprites.position.y + ((scale -   sprites.boundingBox.size.height) / 2));
    sprites.position = point;
    [self resizeSprite:sprites toWidth:sprites.boundingBox.size.width toHeight:scale];
    -(void)resizeSprite:(CCSprite*)sprite toWidth:(float)width toHeight:(float)height
    {
        sprite.scaleX = width / sprite.contentSize.width;
        sprite.scaleY = height / sprite.contentSize.height;
    }

如何为向上缩放的高度设置动画

4

1 回答 1

0

您可以更改比例属性。scaleX将改变宽度,scaleY将改变高度,并scale同时改变:

sprite.scaleX = 1.1f;
sprite.scaleY = 0.5f;
于 2013-06-24T15:50:11.390 回答