Latest 1.0.1
Homepage https://github.com/SteveBarnegren/DynamicWaterNode
License MIT
Platforms ios 8.0, requires ARC
Frameworks SpriteKit
Authors

DynamicWaterNode

2D physical water simulation for SpriteKit

GIF

How to use

Add DynamicWaterNode.h, DynamicWaterNode.m, Droplet.png and Droplets.fsh to your project

Add to your scene:

- (void)didMoveToView:(SKView *)view {
     self.waterNode = [[DynamicWaterNode alloc]initWithWidth:self.size.width
                                                  numJoints:100
                                              surfaceHeight:kSurfaceHeight
                                                 fillColour:[UIColor colorWithRed:0 green:0 blue:1 alpha:0.5]];
    self.waterNode.position = CGPointMake(self.size.width/2, 0);
    [self addChild:self.waterNode];

}

Step the simulation in your scene’s update method. See demo project for an example of a fixed time step implementation

[self.waterNode update:dt];

Call render: after the simulation has been updated. Only call render once each frame.

[self.waterNode render];

Making splashes:

[self.waterNode splashAtX:100 force:20 width:20];

Various properties of DynamicWaterNode can be changed to control the feel of the water. The demo project includes a settings screen where you can alter these to see their effect.

Latest podspec

{
    "name": "SBDynamicWaterNode",
    "version": "1.0.1",
    "summary": "Physical water simulation for SpriteKit",
    "description": "Physical water simulation for SpriteKit with demo application",
    "homepage": "https://github.com/SteveBarnegren/DynamicWaterNode",
    "license": "MIT",
    "authors": {
        "Steve Barnegren": "[email protected]"
    },
    "source": {
        "git": "https://github.com/SteveBarnegren/SBDynamicWaterNode.git",
        "tag": "1.0.1"
    },
    "social_media_url": "https://twitter.com/stevebarnegren",
    "platforms": {
        "ios": "8.0"
    },
    "requires_arc": true,
    "source_files": "SBDynamicWaterNode/**/*.{h,m}",
    "resources": "SBDynamicWaterNode/**/*.{png,fsh}",
    "frameworks": "SpriteKit"
}

Pin It on Pinterest

Share This