Advertisement
depth1

heaps shaking

Feb 14th, 2019
3,382
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Haxe 0.32 KB | None | 0 0
  1.   function shaking(o : h2d.Object, t : Float)
  2.   {
  3.     var b = o.getBounds();
  4.  
  5.     event.waitUntil(function(dt : Float)
  6.     {
  7.         o.x = (Std.int(t / 0.01) % 2 == 0) ?  b.x + Std.random(2)*5 : b.x - Std.random(2)*5;
  8.         t -= dt;
  9.         if(t <= 0) o.x  = b.x;
  10.         return (t <= 0) ?  true : false;  
  11.     });
  12.   }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement