From 1d7122740319df528e444d6543d2b39d5520908b Mon Sep 17 00:00:00 2001 From: Colin Okay Date: Wed, 17 Feb 2021 10:23:26 -0600 Subject: varying spin speeds --- Source/Main.hx | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) (limited to 'Source/Main.hx') 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(); } -- cgit v1.2.3