animationcocos2d-iphone

Animate sprite programmatically


I'm trying to think of a method to 'sort of programmatically' animate sprites in a game. The purpose of this is to avoid creating ~20-50 frames of each sprite (very time consuming), then running a loop to sequence the frames, thus producing the desired animation. Below is one example of a sprite I would like to animate. The desired animation should give 'waves' to the image, originating in the center and expanding outward. This will make the water color look alive, or as if it's still wet and shimmering. I'm using Cocos2D so each sprite has these methods available already: move, rotate, scale. My initial thought is to use Cocos2D's particle system to try and create this effect, but I worry about the efficiency of running the system for perhaps 50 or so sprites. Is there a better way?

'play game button'


Solution

  • What you want to achieve is probably best done with custom vertex/fragment shader. Unfortunately not many examples floating around, so you have to look. But to get you started, look here, there might be one there close to your desires. Beware, shaders can be tricky and are hardly the kind of 'drop from open source repository' to your codebase type of software. Some tweaking required, your mileage will vary.

    for a crash 'intro' on openGL , shaders and stuff, if you are inclined, this blog was very helpful to me. Follow the links.