From 716ce85464ee6d57a424a00d2535b3c2ce6ad9cb Mon Sep 17 00:00:00 2001 From: Joris Guyonvarch Date: Thu, 5 Mar 2015 22:55:06 +0100 Subject: Adding a wave move --- src/Physics.elm | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'src/Physics.elm') 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) -- cgit v1.2.3