diff options
author | Joris Guyonvarch | 2015-03-05 22:55:06 +0100 |
---|---|---|
committer | Joris Guyonvarch | 2015-03-05 22:55:11 +0100 |
commit | 716ce85464ee6d57a424a00d2535b3c2ce6ad9cb (patch) | |
tree | 01728db59af133a94855e536a25d6c5073bbfa38 /src/Physics.elm | |
parent | 2fe50fd2ebb1815a330b20e599f756fa393de81b (diff) |
Adding a wave move
Diffstat (limited to 'src/Physics.elm')
-rw-r--r-- | src/Physics.elm | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/Physics.elm b/src/Physics.elm index 2d2d627..c68ab58 100644 --- a/src/Physics.elm +++ b/src/Physics.elm @@ -22,6 +22,15 @@ getMove speed dir = , y = speed * sin angle } +getWaveMove : Float -> Vec2 -> Float -> Float -> Vec2 +getWaveMove speed dir amplitude period = + let move = getMove speed dir + perpendMove = + getMove + (amplitude * (sin ((norm move) / period))) + (clockwiseRotate90 move) + in move `add` perpendMove + getAcc : Vec2 -> Vec2 -> Vec2 getAcc move speed = (move `div` 300) `sub` (speed `div` 300) |