For digging and water I'd use multiple small circles. It would be much better with render to texture, because you could blur the circles out and apply some threshold to get a final look for dug hole or water.
This way it would allow to use much more approximate physics (like using larger radius for circles, thus decreases the amount of circular bodies and increasing performance).
Predefine all the possible shapes around the hole seem applicable to me. I will test it performance and report later. => tested, it works but too slow, I will investigate more
@thanhquan1512: As far as I can remember of the game Where's my water? The only way to achieve the effect you're looking for would be render to texture and that feature is in the works.
I think @atilim might have hinted that it would be in the next major release (but don't quote me on that ).
Even with render to texture you would still have your work cut out as the water (or other medium) would have to fall down the newly created hole.
To achieve this effect I think you would probably also have to modify your collision maps (and / or more likely the physics object) representing your floor.
If I was going to code a game to use this idea I'd actually use the circle particles (as in the liquid demo) for the game logic etc and then use the render to texture, blur, threshold thing to actually render the game view.
WhiteTree Games - Home, home on the web, where the bits and bytes they do play! #MakeABetterGame! "Never give up, Never NEVER give up!" - Winston Churchill
Without render to texture it would be much harder. As you'd basically have to predefine all the possible shapes that you could have around the holes.
I guess you can do it much simpler. Just make your circle radius 15% bigger than physical body fixtures so the circles will overlap and fill the gaps. A bit more and smaller circles will do the job me thinks :-) Well it will looks a slightly rough but still will be much CPU cheaper. In fact he uses same method with the rectangle under the circles. Ah and probably a mix of 2-3 different sizes will be interesting.
Comments
This way it would allow to use much more approximate physics (like using larger radius for circles, thus decreases the amount of circular bodies and increasing performance).
Here is an interesting example:
http://www.patrickmatte.com/stuff/physicsLiquid/
Without render to texture it would be much harder. As you'd basically have to predefine all the possible shapes that you could have around the holes.
Likes: phongtt, thanhquan1512, techdojo
I've read some article about using mask or BlendMode with AS3 but I still don't undestand :P
http://www.actionscript.org/forums/showthread.php3?p=965632
Predefine all the possible shapes around the hole seem applicable to me. I will test it performance and report later. => tested, it works but too slow, I will investigate more
Ultimate Games on Appstore
Ultimate Games on Google Play
I think @atilim might have hinted that it would be in the next major release (but don't quote me on that ).
Even with render to texture you would still have your work cut out as the water (or other medium) would have to fall down the newly created hole.
To achieve this effect I think you would probably also have to modify your collision maps (and / or more likely the physics object) representing your floor.
Website: http://www.castlegateinteractive.com
https://play.google.com/store/apps/developer?id=Castlegate+Interactive
#MakeABetterGame! "Never give up, Never NEVER give up!" - Winston Churchill