游戏循环的bug

时间:2013-08-20 02:10:44

标签: cocoa-touch nstimer

我在xcode 5上制作游戏。 我正在使用一个nstimer,它有我的游戏循环错误。你能帮我吗。所有帮助都很棒。

@implementation ViewController
@synthesize bg, rock, platform1, platform2, platform3, platform4, platform5, platform6, platform7;
@synthesize gameState;
@synthesize rockVelocity, gravity;


// Implement viewDidLoad to do additional setup after loading the view, typically from a nib.

- (void)viewDidLoad {
    [super viewDidLoad];
    gameState = kStateRunning;
    rockVelocity = CGpointMake (0, 0);
    gravity = CGpointMake (0, kGravity);

    [NSTimer scheduledTimerWithTimeInterval: 1.0/60 target:self selector:@selector(gameLoop) userInfo:nil repeats:YES];

    - (void)gameLoop {
       if (gameState == kStateRunning)
       {

       }
        else if (gameState == kStateGameOver)
        {

        }
    }

    -(void)gameStatePlayNormal {
        rockVelocity.y += gravity.y;

        rock.center = CGPoint(rock.center.x + ballVelocity.x,rock.center.y + rockVelocity.y);



    }

1 个答案:

答案 0 :(得分:0)

我正在运行ios7 gm并且我正在尝试通过iphone配置实用程序安装配置文件,并且它一直说这个配置文件无法添加到此设备,并且它说明了每个配置文件。