Browse Source

Adding AtomicNET Butterflies

Josh Engebretson 9 years ago
parent
commit
1a38be4d54
41 changed files with 711 additions and 0 deletions
  1. 3 0
      AtomicNET/Butterflies/.gitignore
  2. 0 0
      AtomicNET/Butterflies/Butterflies.atomic
  3. 5 0
      AtomicNET/Butterflies/Resources.asset
  4. 5 0
      AtomicNET/Butterflies/Resources/Components.asset
  5. 123 0
      AtomicNET/Butterflies/Resources/Components/Butterfly.cs
  6. 5 0
      AtomicNET/Butterflies/Resources/Components/Butterfly.cs.asset
  7. 70 0
      AtomicNET/Butterflies/Resources/Components/Butterfly.js
  8. 7 0
      AtomicNET/Butterflies/Resources/Components/Butterfly.js.asset
  9. 44 0
      AtomicNET/Butterflies/Resources/Components/Spawner.cs
  10. 5 0
      AtomicNET/Butterflies/Resources/Components/Spawner.cs.asset
  11. 52 0
      AtomicNET/Butterflies/Resources/Components/Spawner.js
  12. 7 0
      AtomicNET/Butterflies/Resources/Components/Spawner.js.asset
  13. 5 0
      AtomicNET/Butterflies/Resources/Particles.asset
  14. 39 0
      AtomicNET/Butterflies/Resources/Particles/particle.pex
  15. 5 0
      AtomicNET/Butterflies/Resources/Particles/particle.pex.asset
  16. BIN
      AtomicNET/Butterflies/Resources/Particles/texture.png
  17. 5 0
      AtomicNET/Butterflies/Resources/Particles/texture.png.asset
  18. 17 0
      AtomicNET/Butterflies/Resources/README.TXT
  19. 5 0
      AtomicNET/Butterflies/Resources/README.TXT.asset
  20. 5 0
      AtomicNET/Butterflies/Resources/Scenes.asset
  21. 71 0
      AtomicNET/Butterflies/Resources/Scenes/TheScene.scene
  22. 8 0
      AtomicNET/Butterflies/Resources/Scenes/TheScene.scene.asset
  23. 5 0
      AtomicNET/Butterflies/Resources/Scripts.asset
  24. 67 0
      AtomicNET/Butterflies/Resources/Scripts/main.js
  25. 7 0
      AtomicNET/Butterflies/Resources/Scripts/main.js.asset
  26. 5 0
      AtomicNET/Butterflies/Resources/Sprites.asset
  27. BIN
      AtomicNET/Butterflies/Resources/Sprites/1.png
  28. 5 0
      AtomicNET/Butterflies/Resources/Sprites/1.png.asset
  29. BIN
      AtomicNET/Butterflies/Resources/Sprites/2.png
  30. 5 0
      AtomicNET/Butterflies/Resources/Sprites/2.png.asset
  31. BIN
      AtomicNET/Butterflies/Resources/Sprites/3.png
  32. 5 0
      AtomicNET/Butterflies/Resources/Sprites/3.png.asset
  33. BIN
      AtomicNET/Butterflies/Resources/Sprites/4.png
  34. 5 0
      AtomicNET/Butterflies/Resources/Sprites/4.png.asset
  35. BIN
      AtomicNET/Butterflies/Resources/Sprites/5.png
  36. 5 0
      AtomicNET/Butterflies/Resources/Sprites/5.png.asset
  37. BIN
      AtomicNET/Butterflies/Resources/Sprites/6.png
  38. 5 0
      AtomicNET/Butterflies/Resources/Sprites/6.png.asset
  39. 55 0
      AtomicNET/Butterflies/Resources/Sprites/butterfly.scml
  40. 5 0
      AtomicNET/Butterflies/Resources/Sprites/butterfly.scml.asset
  41. 51 0
      AtomicNET/Butterflies/Settings/Engine.json

+ 3 - 0
AtomicNET/Butterflies/.gitignore

@@ -0,0 +1,3 @@
+Cache/*
+AtomicNET/*
+Resources/AtomicProject.*

+ 0 - 0
AtomicNET/Butterflies/Butterflies.atomic


+ 5 - 0
AtomicNET/Butterflies/Resources.asset

@@ -0,0 +1,5 @@
+{
+	"version": 1,
+	"guid": "c5a14ededf7c8df707fd8b3f83ffe0d3",
+	"FolderImporter": {}
+}

+ 5 - 0
AtomicNET/Butterflies/Resources/Components.asset

@@ -0,0 +1,5 @@
+{
+	"version": 1,
+	"guid": "454d0bd8b7099b6e27219171adfda921",
+	"FolderImporter": {}
+}

+ 123 - 0
AtomicNET/Butterflies/Resources/Components/Butterfly.cs

@@ -0,0 +1,123 @@
+using System;
+using AtomicEngine;
+
+
+class FloatRandom : Random
+{
+    public float Random() { return (float)NextDouble(); }
+}
+
+public class Butterfly : CSComponent
+{
+
+    float speed;
+    float direction;
+    float desiredDirection;
+    float rotationSpeed = 10.0f;
+    float time = 0.0f;
+
+    Vector2 pos;
+    AnimatedSprite2D sprite;
+
+    public void Start()
+    {
+
+        if (halfWidth == 0.0f)
+        {
+            random = new FloatRandom();
+
+            var graphics = AtomicNET.GetSubsystem<Graphics>();
+            halfWidth = graphics.Width * Constants.PIXEL_SIZE * 0.5f;
+            halfHeight = graphics.Height * Constants.PIXEL_SIZE * 0.5f;
+
+            animationSet = AtomicNET.Cache.GetResource<AnimationSet2D>("Sprites/butterfly.scml");
+        }
+
+        speed = 1 + 2.0f * random.Random();
+        direction = random.Random() * (float)Math.PI * 2.0f;
+
+        pos = Node.Position2D;
+
+        sprite = (AnimatedSprite2D)Node.CreateComponent("AnimatedSprite2D");
+        sprite.Speed = .1f + random.Random() * 2.0f;
+        sprite.AnimationSet = animationSet;
+        sprite.SetAnimation("idle");
+        sprite.Color = new Color(.1f + random.Random() * .9f, .1f + random.Random() * .9f, .1f + random.Random() * .9f, 1);
+        sprite.BlendMode = BlendMode.BLEND_ALPHA;
+    }
+
+    void Update(float timeStep)
+    {
+        time += timeStep;
+
+        if (time % 1000 / 1000 < 0.5f)
+            desiredDirection = random.Random() * (float)Math.PI * 2;
+
+        direction = circWrapTo(direction, desiredDirection, rotationSpeed * timeStep);
+        pos.X += (float)Math.Cos(direction) * speed * timeStep;
+        pos.Y += (float)Math.Sin(direction) * speed * timeStep;
+        Node.Position2D = pos;
+        Node.Rotation2D = (direction + (float)Math.PI * 3 / 2) * (180 / (float)Math.PI);
+
+        //check if our butterfly is out of bounds
+        if (pos.X < -halfWidth || pos.Y < -halfHeight || pos.X > halfWidth || pos.Y > halfHeight)
+        {
+            Node.Remove();
+        }
+
+    }
+
+    float circWrapTo(float value, float target, float step)
+    {
+        if (value == target)
+            return target;
+
+        var max = (float)Math.PI * 2;
+
+        var result = value;
+
+        var d = wrappedDistance(value, target, max);
+
+        if (Math.Abs(d) < step)
+            return target;
+
+        result += (d < 0 ? -1 : 1) * step;
+
+        if (result > max)
+            result = result - max;
+        else if (result < 0)
+            result = max + result;
+
+        return result;
+    }
+
+    float wrappedDistance(float a, float b, float max)
+    {
+        if (a == b) return 0;
+
+        float l;
+        float r;
+
+        if (a < b)
+        {
+            l = -a - max + b;
+            r = b - a;
+        }
+        else
+        {
+            l = b - a;
+            r = max - a + b;
+        }
+        if (Math.Abs(l) > Math.Abs(r))
+            return r;
+        else
+            return l;
+    }
+
+
+    static FloatRandom random;
+    static float halfWidth = 0.0f;
+    static float halfHeight = 0.0f;
+    static AnimationSet2D animationSet;
+
+}

+ 5 - 0
AtomicNET/Butterflies/Resources/Components/Butterfly.cs.asset

@@ -0,0 +1,5 @@
+{
+	"version": 1,
+	"guid": "6cc7089413a73d61d41d2cb90c9a800a",
+	"CSharpImporter": null
+}

+ 70 - 0
AtomicNET/Butterflies/Resources/Components/Butterfly.js

@@ -0,0 +1,70 @@
+'atomic component';
+
+var halfWidth = Atomic.graphics.width * Atomic.PIXEL_SIZE * 0.5;
+var halfHeight = Atomic.graphics.height * Atomic.PIXEL_SIZE * 0.5;
+
+var animationSet = Atomic.cache.getResource("AnimationSet2D", "Sprites/butterfly.scml");
+
+exports.component = function(self) {
+
+    var node = self.node;
+    self.speed = 1 + 2 * Math.random();
+    self.rotationSpeed = 10;
+    self.direction = Math.random() * Math.PI * 2;
+    self.time = 0.0;
+
+    //start function calls once, when component attached to the node
+    self.start = function() {
+        //pos is a array with 2 elements, the first is X, the second is Y
+        self.pos = node.getPosition2D();
+
+        //create AnimatedSprite2D component
+        self.spr = node.createComponent("AnimatedSprite2D");
+        self.spr.animationSet = animationSet;
+        self.spr.setAnimation("idle");
+        self.spr.color = [.1 + Math.random() * .9, .1 + Math.random() * .9, .1 + Math.random() * .9, 1];
+        self.spr.blendMode = Atomic.BLEND_ALPHA;
+    };
+
+    self.update = function(timeStep) {
+
+        self.time += timeStep;
+        if (self.time % 1000 / 1000 < 0.5) self.desiredDirection = Math.random() * Math.PI * 2;
+        self.direction = self.circWrapTo(self.direction, self.desiredDirection, self.rotationSpeed * timeStep);
+        self.pos[0] += Math.cos(self.direction) * self.speed * timeStep;
+        self.pos[1] += Math.sin(self.direction) * self.speed * timeStep;
+        node.position2D = self.pos;
+        node.rotation2D = (self.direction + Math.PI * 3 / 2) * (180 / Math.PI);
+        //check if our butterfly is out of bounds
+        if (self.pos[0] < -halfWidth || self.pos[1] < -halfHeight || self.pos[0] > halfWidth || self.pos[1] > halfHeight)
+            node.remove();
+    };
+    //just a maths functions, nothing really interesting
+    self.circWrapTo = function(value, target, step) {
+        if (value == target) return target;
+        var max = Math.PI * 2;
+        var result = value;
+        var d = self.wrappedDistance(value, target, max);
+        if (Math.abs(d) < step) return target;
+        result += (d < 0 ? -1 : 1) * step;
+        if (result > max) result = result - max;
+        else if (result < 0) result = max + result;
+        return result;
+    };
+    self.wrappedDistance = function(a, b, max) {
+        if (a == b) return 0;
+        var l;
+        var r;
+        if (a < b) {
+            l = -a - max + b;
+            r = b - a;
+        } else {
+            l = b - a;
+            r = max - a + b;
+        }
+        if (Math.abs(l) > Math.abs(r)) return r;
+        else return l;
+    };
+
+
+};

+ 7 - 0
AtomicNET/Butterflies/Resources/Components/Butterfly.js.asset

@@ -0,0 +1,7 @@
+{
+	"version": 1,
+	"guid": "95b3015b5a33af615714a15daac1cd8d",
+	"JavascriptImporter": {
+		"IsComponentFile": true
+	}
+}

+ 44 - 0
AtomicNET/Butterflies/Resources/Components/Spawner.cs

@@ -0,0 +1,44 @@
+using System;
+using AtomicEngine;
+
+public class Spawner : CSComponent
+{
+
+    void Start()
+    {
+        viewport = AtomicNET.GetSubsystem<Renderer>().GetViewport(0);
+    }
+
+    void Update(float timeStep)
+    {
+
+        var input = AtomicNET.GetSubsystem<Input>();
+
+        if (input.GetMouseButtonDown(Constants.MOUSEB_LEFT))
+        {
+            var mousePos = input.GetMousePosition();
+
+            for (var i = 0; i < 10; i++)
+                createButterflyNode(new Vector2(mousePos.X, mousePos.Y));
+        }        
+
+    }
+
+    void createButterflyNode(Vector2 pos)
+    {
+        //project mouse screen position to the world position
+        var screenPos = viewport.ScreenToWorldPoint((int) pos.X, (int) pos.Y, 0);
+
+        //create butterfly node
+        var node = Scene.CreateChild("Butterfly");
+
+        node.Position2D = new Vector2(screenPos.X, screenPos.Y);
+
+        var butterfly = node.CreateComponent<Butterfly>();
+
+    }
+
+    Viewport viewport;
+
+
+}

+ 5 - 0
AtomicNET/Butterflies/Resources/Components/Spawner.cs.asset

@@ -0,0 +1,5 @@
+{
+	"version": 1,
+	"guid": "1930a851c4f4f0dd768e1b404113dfcd",
+	"CSharpImporter": null
+}

+ 52 - 0
AtomicNET/Butterflies/Resources/Components/Spawner.js

@@ -0,0 +1,52 @@
+'atomic component';
+
+var viewport = Atomic.renderer.getViewport(0);
+
+//cache resource
+var particleEffect = Atomic.cache.getResource("ParticleEffect2D", "Particles/particle.pex");
+
+exports.component = function(self) {
+
+    self.start = function() {
+        //touch control
+        self.subscribeToEvent("TouchMove", function(event) {
+            createButterflyNode([event.x, event.y]);
+        });
+        self.subscribeToEvent("MultiGesture", function(event) {
+            if(event.numFingers >= 2) {
+                createButterflyParticle([event.centerX, event.centerY]);
+            }
+        });
+    };
+
+    self.update = function(timeStep) {
+        //if Left mouse button is pressed
+        if (Atomic.input.getMouseButtonDown(Atomic.MOUSEB_LEFT)) {
+            var mousePos = Atomic.input.getMousePosition();
+            createButterflyNode(mousePos);
+        //if Right mouse button WAS pressed once
+        } else if (Atomic.input.getMouseButtonPress(Atomic.MOUSEB_RIGHT)) {
+            var mousePos = Atomic.input.getMousePosition();
+            createButterflyParticle(mousePos);
+        }
+    };
+
+    function createButterflyNode(pos) {
+      //project mouse screen position to the world position
+      pos = viewport.screenToWorldPoint(pos[0], pos[1], 0);
+      //create butterfly node
+      var butterfly = self.scene.createChild("Butterfly");
+      butterfly.position2D = pos;
+      butterfly.createJSComponent("Components/Butterfly.js");
+    }
+
+    function createButterflyParticle(pos) {
+      //create particle emitter
+      var emitter = self.scene.createChild("ButterflyEmitter");
+      //project mouse screen position to the world position
+      pos = viewport.screenToWorldPoint(pos[0], pos[1], 0);
+      emitter.position2D = pos;
+      var pex = emitter.createComponent("ParticleEmitter2D");
+      pex.effect = particleEffect;
+    }
+};

+ 7 - 0
AtomicNET/Butterflies/Resources/Components/Spawner.js.asset

@@ -0,0 +1,7 @@
+{
+	"version": 1,
+	"guid": "45592974555d02de64d8f3637f3802cc",
+	"JavascriptImporter": {
+		"IsComponentFile": true
+	}
+}

+ 5 - 0
AtomicNET/Butterflies/Resources/Particles.asset

@@ -0,0 +1,5 @@
+{
+	"version": 1,
+	"guid": "446a4b7ae157fcb28a8d8698fcbb07d0",
+	"FolderImporter": {}
+}

+ 39 - 0
AtomicNET/Butterflies/Resources/Particles/particle.pex

@@ -0,0 +1,39 @@
+<particleEmitterConfig>
+  <texture name="texture.png"/>
+  <sourcePosition x="100.00" y="100.00"/>
+  <sourcePositionVariance x="30" y="30"/>
+  <speed value="1"/>
+  <speedVariance value=".25"/>
+  <particleLifeSpan value="2"/>
+  <particleLifespanVariance value="5"/>
+  <angle value="0"/>
+  <angleVariance value="360"/>
+  <gravity x="-44.6" y="-226.78"/>
+  <radialAcceleration value="-24.26"/>
+  <tangentialAcceleration value="-8.79"/>
+  <radialAccelVariance value="124.06"/>
+  <tangentialAccelVariance value="170.19"/>
+  <startColor red="0.5" green="0.5" blue="0.5" alpha="1.0"/>
+  <startColorVariance red="0.25" green="0.25" blue="0.25" alpha="0.0"/>
+  <finishColor red="0.5" green="0.5" blue="0.5" alpha="1.0"/>
+  <finishColorVariance red="0.25" green="0.25" blue="0.25" alpha="0.0"/>
+  <maxParticles value="250"/>
+  <startParticleSize value="8"/>
+  <startParticleSizeVariance value="5"/>
+  <finishParticleSize value="10"/>
+  <FinishParticleSizeVariance value="5"/>
+  <duration value="-1.00"/>
+  <emitterType value="0"/>
+  <maxRadius value="43.98"/>
+  <maxRadiusVariance value="377.4"/>
+  <minRadius value="84.07"/>
+  <minRadiusVariance value="307.95"/>
+  <rotatePerSecond value="271.58"/>
+  <rotatePerSecondVariance value="243.34"/>
+  <blendFuncSource value="770"/>
+  <blendFuncDestination value="1"/>
+  <rotationStart value="43.88"/>
+  <rotationStartVariance value="275.21"/>
+  <rotationEnd value="184.57"/>
+  <rotationEndVariance value="180.85"/>
+</particleEmitterConfig>

+ 5 - 0
AtomicNET/Butterflies/Resources/Particles/particle.pex.asset

@@ -0,0 +1,5 @@
+{
+	"version": 1,
+	"guid": "f8c6188180699fbedda600eae3f4a49f",
+	"PEXImporter": {}
+}

BIN
AtomicNET/Butterflies/Resources/Particles/texture.png


+ 5 - 0
AtomicNET/Butterflies/Resources/Particles/texture.png.asset

@@ -0,0 +1,5 @@
+{
+	"version": 1,
+	"guid": "119e283e886e515dd05420f7fe21d273",
+	"TextureImporter": {}
+}

+ 17 - 0
AtomicNET/Butterflies/Resources/README.TXT

@@ -0,0 +1,17 @@
+
+Atomic Butterflies
+------------------
+
+An example which shows creating a scene procedurally
+
+INSTRUCTIONS:
+
+Left Mouse - Spawn Butterflies
+
+Right Click - Spawn Butterfly Particles
+
+
+CREDITS:
+
+Originally created for Atomic-Haxe by rsredsq:
+https://github.com/rsredsq/atomic-haxe/tree/master/examples/Butterflies

+ 5 - 0
AtomicNET/Butterflies/Resources/README.TXT.asset

@@ -0,0 +1,5 @@
+{
+	"version": 1,
+	"guid": "85810cbd3375757ff848760fb2a2548a",
+	"TextImporter": {}
+}

+ 5 - 0
AtomicNET/Butterflies/Resources/Scenes.asset

@@ -0,0 +1,5 @@
+{
+	"version": 1,
+	"guid": "eff0f6bb8943a7f8c983419e408e15b2",
+	"FolderImporter": {}
+}

+ 71 - 0
AtomicNET/Butterflies/Resources/Scenes/TheScene.scene

@@ -0,0 +1,71 @@
+<?xml version="1.0"?>
+<scene id="1">
+	<attribute name="Name" value="" />
+	<attribute name="Time Scale" value="1" />
+	<attribute name="Smoothing Constant" value="50" />
+	<attribute name="Snap Threshold" value="5" />
+	<attribute name="Elapsed Time" value="0" />
+	<attribute name="Next Replicated Node ID" value="364" />
+	<attribute name="Next Replicated Component ID" value="1976" />
+	<attribute name="Next Local Node ID" value="16778496" />
+	<attribute name="Next Local Component ID" value="16777216" />
+	<attribute name="Variables" />
+	<attribute name="Variable Names" value="" />
+	<component type="PhysicsWorld" id="1" />
+	<component type="Octree" id="2" />
+	<component type="DebugRenderer" id="3" />
+	<node id="2">
+		<attribute name="Is Enabled" value="true" />
+		<attribute name="Name" value="Zone" />
+		<attribute name="Position" value="0 0 0" />
+		<attribute name="Rotation" value="1 0 0 0" />
+		<attribute name="Scale" value="1 1 1" />
+		<attribute name="Variables" />
+		<component type="Zone" id="4">
+			<attribute name="Bounding Box Min" value="-10000 -10000 -10000" />
+			<attribute name="Bounding Box Max" value="10000 10000 10000" />
+			<attribute name="Ambient Color" value="0.4 0.4 0.4 1" />
+		</component>
+	</node>
+	<node id="3">
+		<attribute name="Is Enabled" value="true" />
+		<attribute name="Name" value="GlobalLight" />
+		<attribute name="Position" value="0 0 0" />
+		<attribute name="Rotation" value="0.888074 0.325058 -0.325058 0" />
+		<attribute name="Scale" value="1 1 1" />
+		<attribute name="Variables" />
+		<component type="Light" id="5">
+			<attribute name="Light Type" value="Directional" />
+			<attribute name="Cast Shadows" value="true" />
+			<attribute name="CSM Splits" value="10 20 50 0" />
+			<attribute name="View Size Quantize" value="1" />
+			<attribute name="View Size Minimum" value="5" />
+			<attribute name="Depth Constant Bias" value="0.00025" />
+			<attribute name="Depth Slope Bias" value="0.001" />
+		</component>
+	</node>
+	<node id="361">
+		<attribute name="Is Enabled" value="true" />
+		<attribute name="Name" value="Camera" />
+		<attribute name="Position" value="0 0 -5" />
+		<attribute name="Rotation" value="1 0 0 0" />
+		<attribute name="Scale" value="1 1 1" />
+		<attribute name="Variables" />
+		<component type="Camera" id="1973">
+			<attribute name="Near Clip" value="0" />
+			<attribute name="Orthographic" value="true" />
+		</component>
+	</node>
+	<node id="363">
+		<attribute name="Is Enabled" value="true" />
+		<attribute name="Name" value="Spawner" />
+		<attribute name="Position" value="0 0 0" />
+		<attribute name="Rotation" value="1 0 0 0" />
+		<attribute name="Scale" value="1 1 1" />
+		<attribute name="Variables" />
+		<component type="CSComponent" id="1975">
+			<attribute name="Assembly" value="CSComponentAssembly;AtomicProject.dll" />
+			<attribute name="Class" value="Spawner" />
+		</component>
+	</node>
+</scene>

+ 8 - 0
AtomicNET/Butterflies/Resources/Scenes/TheScene.scene.asset

@@ -0,0 +1,8 @@
+{
+	"version": 1,
+	"guid": "ed87e2d80487df697a2e8fafdcca1229",
+	"SceneImporter": {
+		"sceneCamRotation": "1 0 0 0",
+		"sceneCamPosition": "0 0 0"
+	}
+}

+ 5 - 0
AtomicNET/Butterflies/Resources/Scripts.asset

@@ -0,0 +1,5 @@
+{
+	"version": 1,
+	"guid": "e4a74b5d6803ecf9eb1be3ec3fea325d",
+	"FolderImporter": {}
+}

+ 67 - 0
AtomicNET/Butterflies/Resources/Scripts/main.js

@@ -0,0 +1,67 @@
+// This script is the main entry point of the game
+
+
+var scene = Atomic.player.loadScene("Scenes/TheScene.scene");
+var camera = scene.getChild("Camera").getComponent("Camera");
+camera.setOrthoSize(Atomic.graphics.height * .7 * Atomic.PIXEL_SIZE);
+
+/*
+
+// create a scene
+var scene = new Atomic.Scene();
+
+// create an octree component
+scene.createComponent("Octree");
+
+// create out camera
+var cameraNode = scene.createChild("Camera");
+var camera = cameraNode.createComponent("Camera");
+
+// setup as 2D
+camera.setOrthographic(true);
+//Atomic.PIXEL_SIZE / 2 means that our pixels are doubled up
+camera.setOrthoSize(Atomic.graphics.height * Atomic.PIXEL_SIZE / 2);
+
+// create a viewport
+var viewport = new Atomic.Viewport(scene, camera);
+Atomic.renderer.setViewport(0, viewport);
+
+// create our spawner component
+scene.createJSComponent("Components/Spawner.js");
+
+createInstructions();
+
+function createInstructions() {
+
+    var view = new Atomic.UIView();
+
+    // Create a layout, otherwise child widgets won't know how to size themselves
+    // and would manually need to be sized
+    var layout = new Atomic.UILayout();
+
+    // specify the layout region
+    layout.rect = view.rect;
+
+    view.addChild(layout);
+
+    // we're laying out on the X axis so "position" controls top and bottom alignment
+    layout.layoutPosition = Atomic.UI_LAYOUT_POSITION_RIGHT_BOTTOM;
+    // while "distribution" handles the Y axis
+    layout.layoutDistributionPosition = Atomic.UI_LAYOUT_DISTRIBUTION_POSITION_RIGHT_BOTTOM;
+
+    var fd = new Atomic.UIFontDescription();
+    fd.id = "Vera";
+    fd.size = 18;
+
+    var scoreText = new Atomic.UIEditField();
+    scoreText.fontDescription = fd;
+    scoreText.readOnly = true;
+    scoreText.multiline = true;
+    scoreText.adaptToContentSize = true;
+    scoreText.text = "Atomic Butterflies\nLeft Mouse - Spawn Butterflies\nRight Click - Spawn Particles";
+    layout.addChild(scoreText);
+
+
+}
+
+*/

+ 7 - 0
AtomicNET/Butterflies/Resources/Scripts/main.js.asset

@@ -0,0 +1,7 @@
+{
+	"version": 1,
+	"guid": "eca179757c676750cf21705aac3161ad",
+	"JavascriptImporter": {
+		"IsComponentFile": false
+	}
+}

+ 5 - 0
AtomicNET/Butterflies/Resources/Sprites.asset

@@ -0,0 +1,5 @@
+{
+	"version": 1,
+	"guid": "084acd70b72b2db1f3204453d2af4a0b",
+	"FolderImporter": {}
+}

BIN
AtomicNET/Butterflies/Resources/Sprites/1.png


+ 5 - 0
AtomicNET/Butterflies/Resources/Sprites/1.png.asset

@@ -0,0 +1,5 @@
+{
+	"version": 1,
+	"guid": "e2e40bd07c80688fb2d8013db3748ce8",
+	"TextureImporter": {}
+}

BIN
AtomicNET/Butterflies/Resources/Sprites/2.png


+ 5 - 0
AtomicNET/Butterflies/Resources/Sprites/2.png.asset

@@ -0,0 +1,5 @@
+{
+	"version": 1,
+	"guid": "0715a2e165d35e821d120908263d623a",
+	"TextureImporter": {}
+}

BIN
AtomicNET/Butterflies/Resources/Sprites/3.png


+ 5 - 0
AtomicNET/Butterflies/Resources/Sprites/3.png.asset

@@ -0,0 +1,5 @@
+{
+	"version": 1,
+	"guid": "126a73567e64033c69a67fba65f2862f",
+	"TextureImporter": {}
+}

BIN
AtomicNET/Butterflies/Resources/Sprites/4.png


+ 5 - 0
AtomicNET/Butterflies/Resources/Sprites/4.png.asset

@@ -0,0 +1,5 @@
+{
+	"version": 1,
+	"guid": "98beee1b3dd7608051e00918466ca722",
+	"TextureImporter": {}
+}

BIN
AtomicNET/Butterflies/Resources/Sprites/5.png


+ 5 - 0
AtomicNET/Butterflies/Resources/Sprites/5.png.asset

@@ -0,0 +1,5 @@
+{
+	"version": 1,
+	"guid": "63cfca5a7aef8b399f623681d705ac80",
+	"TextureImporter": {}
+}

BIN
AtomicNET/Butterflies/Resources/Sprites/6.png


+ 5 - 0
AtomicNET/Butterflies/Resources/Sprites/6.png.asset

@@ -0,0 +1,5 @@
+{
+	"version": 1,
+	"guid": "31375181ba3b9c9ce1786336c1c6f215",
+	"TextureImporter": {}
+}

+ 55 - 0
AtomicNET/Butterflies/Resources/Sprites/butterfly.scml

@@ -0,0 +1,55 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<spriter_data scml_version="1.0" generator="BrashMonkey Spriter" generator_version="r4.1" pixel_mode="1">
+    <folder id="0">
+        <file id="0" name="1.png" width="16" height="16" pivot_x="0.5" pivot_y="0.5"/>
+        <file id="1" name="2.png" width="16" height="16" pivot_x="0.5" pivot_y="0.5"/>
+        <file id="2" name="3.png" width="16" height="16" pivot_x="0.5" pivot_y="0.5"/>
+        <file id="3" name="4.png" width="16" height="16" pivot_x="0.5" pivot_y="0.5"/>
+        <file id="4" name="5.png" width="16" height="16" pivot_x="0.5" pivot_y="0.5"/>
+        <file id="5" name="6.png" width="16" height="16" pivot_x="0.5" pivot_y="0.5"/>
+    </folder>
+    <entity id="0" name="butterfly">
+        <animation id="0" name="idle" length="500" interval="100">
+            <mainline>
+                <key id="0">
+                    <object_ref id="0" timeline="0" key="0" z_index="0"/>
+                </key>
+                <key id="1" time="100">
+                    <object_ref id="0" timeline="0" key="1" z_index="0"/>
+                </key>
+                <key id="2" time="200">
+                    <object_ref id="0" timeline="0" key="2" z_index="0"/>
+                </key>
+                <key id="3" time="300">
+                    <object_ref id="0" timeline="0" key="3" z_index="0"/>
+                </key>
+                <key id="4" time="400">
+                    <object_ref id="0" timeline="0" key="4" z_index="0"/>
+                </key>
+                <key id="5" time="500">
+                    <object_ref id="0" timeline="0" key="5" z_index="0"/>
+                </key>
+            </mainline>
+            <timeline id="0" name="1">
+                <key id="0" spin="0">
+                    <object folder="0" file="0"/>
+                </key>
+                <key id="1" time="100" spin="0">
+                    <object folder="0" file="1"/>
+                </key>
+                <key id="2" time="200" spin="0">
+                    <object folder="0" file="2"/>
+                </key>
+                <key id="3" time="300" spin="0">
+                    <object folder="0" file="3"/>
+                </key>
+                <key id="4" time="400" spin="0">
+                    <object folder="0" file="4"/>
+                </key>
+                <key id="5" time="500" spin="0">
+                    <object folder="0" file="5"/>
+                </key>
+            </timeline>
+        </animation>
+    </entity>
+</spriter_data>

+ 5 - 0
AtomicNET/Butterflies/Resources/Sprites/butterfly.scml.asset

@@ -0,0 +1,5 @@
+{
+	"version": 1,
+	"guid": "1717377a5edb73848a5f149b2f8ac7cb",
+	"SpriterImporter": {}
+}

+ 51 - 0
AtomicNET/Butterflies/Settings/Engine.json

@@ -0,0 +1,51 @@
+{
+  "desktop": {
+
+    "engine" : {
+      "workerThreads" : true,
+      "logQuiet" : false,
+      "logLevel" : 1
+    },
+
+    "graphics": {
+      "headless": false,
+      "frameLimiter" : true,
+      "flushGPU" : false,
+      "forceGL2" : false,
+      "orientations" : "LandscapeLeft LandscapeRight",
+      "vsync" : false,
+      "tripleBuffer" : false,
+      "multiSample" : 1,
+      "renderPath" : "forward",
+      "shadows" : true,
+      "lowQualityShadows" : false,
+      "materialQuality" : "high",
+      "textureQuality" : "high",
+      "textureFilterMode" : "trilinear",
+      "textureAnisotropy" : 4
+    },
+
+    "window" : {
+      "title" : "Atomic Butterflies",
+      "fullscreen" : false,
+      "borderless" : false,
+      "resizable" : false,
+      "width" : 852,
+      "height" : 480
+    },
+
+    "sound": {
+      "enabled" : true,
+      "interpolation" : true,
+      "stereo" : true,
+      "bufferMS": 100,
+      "mixRate" : 44100
+    },
+
+    "input" : {
+      "touchEmulation" : false
+    }
+
+  }
+
+}