Skip to content

A ready-to-go cocos2dx (3.9) Node to simulate 2d water effect with splash capabilities

License

Notifications You must be signed in to change notification settings

davidejones88/cocos2dx-waternode

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 

Repository files navigation

cocos2dx-waternode

A ready-to-go cocos2dx (3.9) Node to simulate 2d water effect with splash capabilities

Example

cocos2dx-WaterNode

How to use

To create the WaterNode, simply import "WaterNode.hpp" and create it using

WaterNode *water = WaterNode::create();
addChild(water);

In order to make the water move you need to call the splash method, for example in the cocos2dx onTouchEnded method

water->splash(touch->getLocation().x, -300);

You can customize the behaviour of the water surface tweaking the following values in WaterNode.hpp

static const int kColumnCount = 80;
static const int kWaterHeight = 500;
static const float kTension = 0.025;
static const float kDampening = 0.025;
static const float kSpread = 0.25;
static cocos2d::Color4B topColor = cocos2d::Color4B(0, 50, 200, 255);
static cocos2d::Color4B bottomColor = cocos2d::Color4B(0, 50, 100, 100);

Built with

cocos2dx 3.9

Authors

License

This project is licensed under the MIT License - see the LICENSE file for details

About

A ready-to-go cocos2dx (3.9) Node to simulate 2d water effect with splash capabilities

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages