0
有没有办法将skphysics应用到动画角色?好的,我让我的播放器在屏幕上移动时播放动画,下面是动画代码,但由于某些原因,当我想将动画应用到物理上时,出现错误,指出数据类型错误。 发送'SKSpriteNode * _strong'到不兼容类型'CGRect'(aka'struct CGRect')的参数SpriteKit动画物理
没有声望,我无法回答我自己的问题,所以我张贴在这里。
实际上没关系我不得不添加这个_Player.frame,我希望这是正确的,并将物理放在我的角色上。但是,如果我错了,请纠正我。谢谢。
- (void) Player {
_Player = [SKSpriteNode spriteNodeWithImageNamed:@"bird"];
_Player.xScale = 0.88;
_Player.yScale = 0.88;
_Player.position = CGPointMake(100, 100);
[self addChild:_Player];
// 1
NSMutableArray *PlayerCh = [NSMutableArray arrayWithCapacity:2];
// 2
for (int i = 1; i < 2; i++) {
NSString *mytextureName = [NSString stringWithFormat:@"bird%d", i];
SKTexture *ItsTexture = [SKTexture textureWithImageNamed:mytextureName];
[PlayerCh addObject:ItsTexture];
}
// 3
for (int i = 2; i > 1; i--) {
NSString *mytextureName = [NSString stringWithFormat:@"bird%d", i];
SKTexture *ItsTexture = [SKTexture textureWithImageNamed:mytextureName];
[PlayerCh addObject:ItsTexture];
}
// 4
_PlayerAnimation = [SKAction animateWithTextures:PlayerCh timePerFrame:0.1];
// SKPHYSICS FOR PLAYER
SKPhysicsBody *MYPLAYER = [SKPhysicsBody bodyWithCircleOfRadius:_Player]; // I get a error here.
}
方式的朋友感谢您的帮助,但通过我已经找到了答案,并回答了我自己的问题在原来的职位,但因为我没有足够的声誉我不能使用回答你的问题的功能,所以请不投我的问题因为这会影响我的帐户。谢谢。 – Ray
我明白了,顺便说一句,我不是那个投了票的人,作为一个友善的姿态,我会为你投票。 – rockstarr
谢谢。顺便说一句,我需要帮助与我设计的游戏,我可以问你吗? – Ray