Reputation: 143
I would like to know how do you remove part of an image in games like Where's my water. Is there any open classes that handle such things like CCblade or would anyone shed some light and provide me some guidance.
Thanks
Upvotes: 0
Views: 438
Reputation:
Based on the screenshots for that game, it looks like they might be using GCPaths to cut out pieces of the image dynamically.
Here is the reference material for Paths and Quartz 2D: https://developer.apple.com/library/mac/#documentation/GraphicsImaging/Conceptual/drawingwithquartz2d/dq_paths/dq_paths.html#//apple_ref/doc/uid/TP30001066-CH211-TPXREF101
Basically you would do something like:
1) take your source image
2) draw it into a CGContext
3) create a path in the shape of the area you want to remove
3) set the blend mode of the context to kCGBlendModeClear
4) fill your path
5) export the image and replace the current image
Upvotes: 2