Making a sprite move randomly across the screen
问题 I'm making a 2d Game, in which I need instances of a sprite to fly randomly across the screen. They will spawn in randomly just beyond the boundaries of the iPhone screen, then move within the screen. When they hit the edges, they will appear back on the other side. All I need to know is how to get the sprite to move randomly. 回答1: Add this method to your layer class - it takes in a sprite and then moves it randomly around the screen for ever: -(void)moveRandom:(CCSprite*)s { CGPoint