diff options
author | Colin Okay <okay@toyful.space> | 2021-02-17 10:23:26 -0600 |
---|---|---|
committer | Colin Okay <okay@toyful.space> | 2021-02-17 10:23:26 -0600 |
commit | 1d7122740319df528e444d6543d2b39d5520908b (patch) | |
tree | c7327e3f91fbe803f40d67f9e7d1caa41a58b319 | |
parent | c9f7104a2d8b9738c90580730bf177c2e8175b0f (diff) |
varying spin speeds
-rw-r--r-- | Source/Main.hx | 22 |
1 files changed, 10 insertions, 12 deletions
diff --git a/Source/Main.hx b/Source/Main.hx index a17c25b..23a16c4 100644 --- a/Source/Main.hx +++ b/Source/Main.hx @@ -156,16 +156,13 @@ class Wiggler extends Sprite Wiggler.allWigglers.push(this); // destroy wigglers with no bones, but let them show up for a second first. - Actuate.timer(0.45).onComplete(() -> { - var bonecount = 0; - for (v in bones) bonecount += 1; - if (bonecount == 0) - { - destroyInitiated = true; - destroy(); - } - }); - + var bonecount = 0; + for (v in bones) bonecount += 1; + if (bonecount == 0) + { + destroyInitiated = true; + Actuate.timer(0.5).onComplete( destroy ); + } } // some reusable variables for intersection @@ -407,8 +404,8 @@ class Wiggler extends Sprite startAngle: startAngle, stopAngle: stopAngle, currentAngle: currentAngle, - spin: ONE_DEGREE * if (Util.cointoss()) -1 else 1 - } : SkeletonNode); + spin: Math.random() * 2 * ONE_DEGREE * if (Util.cointoss()) -1 else 1 + } : SkeletonNode); }); } @@ -561,6 +558,7 @@ function perFrame (e) collisionsLeft -= 1; destroyCheck(); + other.collisionsLeft -= 1; other.destroyCheck(); } |