jdnichollsc Posted June 27, 2016 Share Posted June 27, 2016 Hi guys, Is possible create a water wave effect with Phaser? Exist any plugin? What do you think about to integrate with Phaser physics? Thanks in advance, Nicholls Link to comment Share on other sites More sharing options...
Cudabear Posted June 28, 2016 Share Posted June 28, 2016 I achieved this in my Ludum Dare 35 game by using a series of tiny sprites connected by springs and P2 physics. Then, I "draw" the water on a custom bitmap data sprite using those points and bounding box of the water as a polygon. Here's the code: https://github.com/Cudabear/ld35/blob/master/src/entity/Water.js It worked pretty well, though not perfect. Ideally, the collision would only be one way (the water "points" respond to the player sprite, but not vice versa) because right now the player sprite can get stuck on them. Couldn't figure out how to do that. Also, sometimes the water gets way out of control, other times it hardly moves when colliding. You can play with the elasticity of the springs to make it look as wavy as you want. Oh, I also use water droplet particles on collision to make things look more natural. Sir_G, jdnichollsc and samme 2 1 Link to comment Share on other sites More sharing options...
Umz Posted August 2, 2017 Share Posted August 2, 2017 On 28/06/2016 at 4:16 PM, Cudabear said: I achieved this in my Ludum Dare 35 game by using a series of tiny sprites connected by springs and P2 physics. Then, I "draw" the water on a custom bitmap data sprite using those points and bounding box of the water as a polygon. Here's the code: https://github.com/Cudabear/ld35/blob/master/src/entity/Water.js It worked pretty well, though not perfect. Ideally, the collision would only be one way (the water "points" respond to the player sprite, but not vice versa) because right now the player sprite can get stuck on them. Couldn't figure out how to do that. Also, sometimes the water gets way out of control, other times it hardly moves when colliding. You can play with the elasticity of the springs to make it look as wavy as you want. Oh, I also use water droplet particles on collision to make things look more natural. This game is f****** great haha! I love that character. I love that it bends and moulds to the environment, that's awesome. Best one yet! jdnichollsc and Cudabear 1 1 Link to comment Share on other sites More sharing options...
jdnichollsc Posted August 4, 2017 Author Share Posted August 4, 2017 Beautiful! Can you create an example on Codepen to share your code? It's really amazing! Link to comment Share on other sites More sharing options...
Cudabear Posted September 29, 2017 Share Posted September 29, 2017 I linked the github in the post. It was made for a gamejam so it's all open source. Feel free to take, use, and refactor anything. jdnichollsc 1 Link to comment Share on other sites More sharing options...
jdnichollsc Posted October 9, 2017 Author Share Posted October 9, 2017 @Cudabear thanks, let me check! Link to comment Share on other sites More sharing options...
Recommended Posts