diff options
author | Colin Okay <okay@toyful.space> | 2021-02-17 09:55:16 -0600 |
---|---|---|
committer | Colin Okay <okay@toyful.space> | 2021-02-17 09:55:16 -0600 |
commit | fc451600120a665b447af39dd0b85cf432741f93 (patch) | |
tree | a002660b105466ed2a2d6914b2a351e0365ee53d | |
parent | 81d4afa2f84e8ec97e7eba40a40e37db63318845 (diff) |
random collision count per wiggler
-rw-r--r-- | Source/Main.hx | 13 | ||||
-rw-r--r-- | project.xml | 2 |
2 files changed, 8 insertions, 7 deletions
diff --git a/Source/Main.hx b/Source/Main.hx index d0af196..2736bc0 100644 --- a/Source/Main.hx +++ b/Source/Main.hx @@ -136,7 +136,7 @@ class Wiggler extends Sprite var offset:Float = Math.random() * 5; var fadeSpeed:Float = Math.random() * 6; - var collisionsLeft = 10; + var collisionsLeft = 10 + Std.int(50 * Math.random()); public function new (path:Array<Point>) { @@ -437,6 +437,7 @@ class Wiggler extends Sprite var fade1 = 0.5 * (1 + Math.cos(this.fadeSpeed * stamp)); var fade2 = 0.5 * (1 + Math.sin(this.fadeSpeed * stamp)); var slowfade1 = 0.5 * (1 + Math.cos(this.fadeSpeed * 0.25 * stamp)); + var slowfade2 = 0.5 * (1 + Math.cos(offset + this.fadeSpeed * 0.5 * stamp)); // redner path if (renderPhases.contains( Border)) @@ -447,20 +448,20 @@ class Wiggler extends Sprite graphicsPath.lineTo( path[i].x, path[i].y); graphics.beginFill( this.color, slowfade1); - graphics.lineStyle(1 + this.offset * fade1, this.borderColor); + graphics.lineStyle(this.offset * fade1, this.borderColor); graphicsPath.lineTo( path[0].x, path[0].y); graphics.drawPath( graphicsPath.commands, graphicsPath.data ); } if (renderPhases.contains( Circles )) { - graphics.lineStyle( this.offset, + graphics.lineStyle(this.offset, this.borderColor, fade1); for (circ in circles) if (circ.visible) { - graphics.beginFill( circ.color, fade2); + graphics.beginFill( circ.color, slowfade2); graphics.drawCircle( circ.x, circ.y, circ.radius); } } @@ -629,7 +630,7 @@ class DrawingScreen extends Sprite timestamp = haxe.Timer.stamp(); path = [ new Point(e.localX, e.localY) ]; - graphics.lineStyle(2, 0); + graphics.lineStyle(2, 0xFFFFFF); graphics.moveTo( path[0].x, path[0].y ); } @@ -665,7 +666,7 @@ class DrawingScreen extends Sprite function clearAndRenderPath() { graphics.clear(); - graphics.lineStyle(2, 0); + graphics.lineStyle(2, 0xFFFFFF); graphics.moveTo(path[0].x, path[0].y); for (i in 1...path.length) graphics.lineTo(path[i].x, path[i].y); diff --git a/project.xml b/project.xml index 5a58c6a..6ec645d 100644 --- a/project.xml +++ b/project.xml @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="utf-8"?> <project> - <window fps="30" width="1200" height="960"/> + <window fps="30" background="0"/> <meta title="WiggleWorldApp" package="space.toyful.wiggleworld" |