Control the speed in my game?

How can I control the speed of my player? I use the method didSimulatePhysics()to move:

   if(([self childNodeWithName:@"hero"].position.x >= 180)
   &&
   (self.touchedHero == YES)
    && _canMove ==YES){

    [[self childNodeWithName:@"hero"]setPosition:CGPointMake(180, [self childNodeWithName:@"hero"].position.y)];

    [self.world setPosition:CGPointMake(self.world.position.x-5, self.world.position.y)];

But this method depends on the performance of the device, and when I launch my application on the iOs device, the speed is very unstable, sometimes it goes very fast and sometimes it slows down, how can I control this speed ???

+4
source share
1 answer

( ) . , , ... "" , :

  • ? , , ?
  • ( )?
  • ? ? - , ?
  • ?
  • ? , ?
  • ? , , , , .
  • Objective-C, C ? ( C 2 , Objective-C ARC 9 - , , . 4.5x , " , ".

learn-cocos2d.com FPS iOS.

gafferongames.com timestep. , , .

0

Source: https://habr.com/ru/post/1526755/


All Articles