Skip to content

bsy6766/Cocos2d-X-Shake-Action

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Cocos2d-x Shake Action

What is this?

A shaking action for Cocos2d-x. It shakes the cocos2d node.

How and what to use

I recommend you to use Simplex Noise version than Perlin Noise.
Clone the repo and copy source code to your project.

// Perline Noise
auto sprite = cocos2d::Sprite::create("HelloWorld.png");
sprite->runAction(ActionShake::create(2.0f/*Duration*/, 40.0f/*speed*/, 40.0f/*magnitude*/));
// Simplex Noise
auto sprite = cocos2d::Sprite::create("HelloWorld.png");
sprite->runAction(Shake::create(2.0f/*Duration*/, 40.0f/*speed*/, 40.0f/*magnitude*/));

Preview

Preview
i.e.) Duration = 2.0f, Magnitude = 40.0f, Speed = 40.0f

Reference

Perlin Noise.
Simplex Noise and Reference.

Note

  • Uses Perlin Noise and Simplex Noise
  • Perlin Noise shake tested on Cocos2d-x 3.10 version.
  • Simplex Noise shake tested on Cocos2d-x 3.14.1 version.
  • Can be used like other built-in actions. Read comment in code for details.
  • I did not write the core algorithm for Perlin Noise, but made it to work on Cocos2d-x 3.10 version because none of them out on the internet worked as described.
  • I followed the pdf reference linked above to implement Simplex Noise.

Releases

No releases published

Packages

No packages published

Languages