views:

31

answers:

1

I am writing a game in which there are thumbnails of mini games displayed in a grid, CCSprites in a NSArray. One of these is then scaled and moved to create a zooming effect. Once it has zoomed in it is hidden to reveal the actual "live" minigame (a CCNode), which has been added to the scene invisibly while the zooming animation took place. This means that if the minigame looks exactly the same as the thumbnail there is a seamless transition. After a few seconds, the zoomed in thumbnail reappears covering the actual minigame and zooms out.

My question is, how can I take a snapshot of the actual minigame and use that as the thumbnail so the user cannot tell that the thumbnails are not actually real games? This would have to happen in the split second when the game has paused but the sprite has not reappeared.

I fear that my explanation is not very good, but I hope that someone will understand it!

+1  A: 

Ok... solved it. I guess I should have searched more before posting.

After a while, I came accross these two articles: http://www.bit-101.com/blog/?p=1861 and http://stackoverflow.com/questions/1563109/replacing-image-in-sprite-cocos2d-game-development-of-iphone

I used the code in the first article (after adjusting it for the retina display) to create an array containing the pixel data. This is then inverted (its upside down to start with) and then pushed into a UIImage. I then init a CCTexture2D with the image and replace the existing sprite texture with this.

I hope this helps someone else at some point.

okey666