1
因此,在IOS游戏教程之后,它的IO7并不多于8。物理边缘IOS8,雪碧套件
下面的代码应该是一球蹦跳着,但只有反弹在屏幕的顶部和底部,如果它击中侧边球进入屏幕
#import "GameScene.h"
@implementation GameScene
-(void)didMoveToView:(SKView *)view {
/* Setup your scene here */
self.backgroundColor =[SKColor whiteColor];
self.physicsBody = [SKPhysicsBody bodyWithEdgeLoopFromRect:self.frame];
self.physicsWorld.gravity = CGVectorMake(0, 0);
SKSpriteNode *ball = [SKSpriteNode spriteNodeWithImageNamed:@"ball"];
ball.position = CGPointMake(CGRectGetMidX(self.frame),CGRectGetMidY(self.frame));
ball.physicsBody = [SKPhysicsBody bodyWithCircleOfRadius:ball.frame.size.width/2];
//ball.physicsBody.friction = 0;
ball.physicsBody.linearDamping = 0;
ball.physicsBody.restitution = 1;
[self addChild:ball];
CGVector myVector = CGVectorMake(0, 5);
[ball.physicsBody applyImpulse:myVector];
}
-(void)update:(CFTimeInterval)currentTime {
/* Called before each frame is rendered */
}
@end
必须有东西简单的在这里,但我似乎无法找到在堆栈溢出
非常感谢! – user2389087 2014-10-20 08:08:04
没问题,祝你好运! – Andriko13 2014-10-26 01:42:16