Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>If I were to rephrase your question I would put it like this. I have a set of walls, each wall needs to have a velocity based on difficulty. At a given time, each wall's position needs to be updated based on its velocity. </p> <p>In general you wouldn't want to vary the time at which this update takes place, as the movement could begin to look choppy, think frame rate. If you have a look at the book "Learn iPhone and iPad cocos2d Game Development" Steffen Itterheim even goes so far as to recommend always assuming a constant frame rate. The argument being, that during normal game play you really want a constant frame rate. In cases where the frame rate may drop (for example there is an incoming email and the iPhone has to do extra processing) you don't want any movement to jump too far. That being said, it would be better that for this short amount of time things move slowly and then resume where the user was before the disruption.</p> <p>So rather than changing the interval of your NSTimer, it may be better to change the distance moved. Set up a variable that holds the velocity of the wall(s). Set up your timer with a sane value (1/60 is a good choice). Then in your callback from your timer update the position of the wall(s) based on the velocity.</p> <p>Of course this is just if you are rolling your own game engine. If you are using cocos2d then you should really use the CCDirector's scheduler as using your own NSTimer will cause problems when the director is paused/resumed, etc... And if you aren't using cocos2d I'd recommend looking into it, as it takes care of this sort of thing for you.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload