Browse Source

Merge pull request #118 from MuffinManKen/MoreBasic2D

More Basic2d Changes
JoshEngebretson 8 years ago
parent
commit
207db6a2ae

+ 1 - 1
Basic2D/JavaScript/Resources/Components/Spinner.js

@@ -9,7 +9,7 @@ exports.component = function(self) {
     //update function calls each frame
     //update function calls each frame
     self.update = function(timeStep) {
     self.update = function(timeStep) {
         //roll a node
         //roll a node
-        self.node.roll(timeStep * 100 * self.speed);
+        self.node.roll(self.speed * timeStep * 75.0);
     };
     };
 
 
 };
 };

+ 5 - 19
Basic2D/JavaScript/Resources/Scenes/Scene.scene

@@ -5,8 +5,8 @@
 	<attribute name="Smoothing Constant" value="50" />
 	<attribute name="Smoothing Constant" value="50" />
 	<attribute name="Snap Threshold" value="5" />
 	<attribute name="Snap Threshold" value="5" />
 	<attribute name="Elapsed Time" value="0" />
 	<attribute name="Elapsed Time" value="0" />
-	<attribute name="Next Replicated Node ID" value="370" />
-	<attribute name="Next Replicated Component ID" value="1987" />
+	<attribute name="Next Replicated Node ID" value="371" />
+	<attribute name="Next Replicated Component ID" value="1988" />
 	<attribute name="Next Local Node ID" value="16778496" />
 	<attribute name="Next Local Node ID" value="16778496" />
 	<attribute name="Next Local Component ID" value="16777216" />
 	<attribute name="Next Local Component ID" value="16777216" />
 	<attribute name="Variables" />
 	<attribute name="Variables" />
@@ -18,6 +18,7 @@
 	<node id="2">
 	<node id="2">
 		<attribute name="Is Enabled" value="true" />
 		<attribute name="Is Enabled" value="true" />
 		<attribute name="Name" value="Zone" />
 		<attribute name="Name" value="Zone" />
+		<attribute name="Tags" />
 		<attribute name="Position" value="0 0 0" />
 		<attribute name="Position" value="0 0 0" />
 		<attribute name="Rotation" value="1 0 0 0" />
 		<attribute name="Rotation" value="1 0 0 0" />
 		<attribute name="Scale" value="1 1 1" />
 		<attribute name="Scale" value="1 1 1" />
@@ -28,26 +29,10 @@
 			<attribute name="Ambient Color" value="0.4 0.4 0.4 1" />
 			<attribute name="Ambient Color" value="0.4 0.4 0.4 1" />
 		</component>
 		</component>
 	</node>
 	</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">
 	<node id="361">
 		<attribute name="Is Enabled" value="true" />
 		<attribute name="Is Enabled" value="true" />
 		<attribute name="Name" value="Camera" />
 		<attribute name="Name" value="Camera" />
+		<attribute name="Tags" />
 		<attribute name="Position" value="0 0 -2" />
 		<attribute name="Position" value="0 0 -2" />
 		<attribute name="Rotation" value="1 0 0 0" />
 		<attribute name="Rotation" value="1 0 0 0" />
 		<attribute name="Scale" value="1 1 1" />
 		<attribute name="Scale" value="1 1 1" />
@@ -61,6 +46,7 @@
 	<node id="363">
 	<node id="363">
 		<attribute name="Is Enabled" value="true" />
 		<attribute name="Is Enabled" value="true" />
 		<attribute name="Name" value="Star" />
 		<attribute name="Name" value="Star" />
+		<attribute name="Tags" />
 		<attribute name="Position" value="0 0 0" />
 		<attribute name="Position" value="0 0 0" />
 		<attribute name="Rotation" value="1 0 0 0" />
 		<attribute name="Rotation" value="1 0 0 0" />
 		<attribute name="Scale" value="1 1 1" />
 		<attribute name="Scale" value="1 1 1" />

+ 0 - 0
Basic2D/TypeScript/Basic2D.atomic


+ 5 - 0
Basic2D/TypeScript/Resources.asset

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

+ 5 - 0
Basic2D/TypeScript/Resources/Components.asset

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

+ 33 - 0
Basic2D/TypeScript/Resources/Components/Spinner.js

@@ -0,0 +1,33 @@
+"atomic component";
+"use strict";
+var __extends = (this && this.__extends) || function (d, b) {
+    for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
+    function __() { this.constructor = d; }
+    d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
+};
+/**
+ * Component that will rotate a node at a configurable speed.
+ */
+var Spinner = (function (_super) {
+    __extends(Spinner, _super);
+    function Spinner() {
+        var _this = _super.apply(this, arguments) || this;
+        /**
+         * Fields witihin the inspectorFields object will be exposed to the editor
+         */
+        _this.inspectorFields = {
+            speed: 1.0
+        };
+        return _this;
+    }
+    /**
+     * Update called every cycle with timeStep containing the delta between calls
+     * @param  {number} timeStep time since last call to update
+     */
+    Spinner.prototype.update = function (timeStep) {
+        this.node.rotate2D(this.speed * timeStep * 75.0);
+    };
+    return Spinner;
+}(Atomic.JSComponent));
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.default = Spinner;

+ 7 - 0
Basic2D/TypeScript/Resources/Components/Spinner.js.asset

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

+ 30 - 0
Basic2D/TypeScript/Resources/Components/Spinner.ts

@@ -0,0 +1,30 @@
+"atomic component";
+
+/**
+ * Component that will rotate a node at a configurable speed.
+ */
+export default class Spinner extends Atomic.JSComponent {
+
+    /**
+     * Fields witihin the inspectorFields object will be exposed to the editor
+     */
+    inspectorFields = {
+        speed: 1.0
+    };
+
+    /**
+     * The speed in which to turn the component
+     * @type {number}
+     */
+    speed: number;
+
+    /**
+     * Update called every cycle with timeStep containing the delta between calls
+     * @param  {number} timeStep time since last call to update
+     */
+    update(timeStep) {
+
+        this.node.roll(this.speed * timeStep * 75.0);
+
+    }
+}

+ 7 - 0
Basic2D/TypeScript/Resources/Components/Spinner.ts.asset

@@ -0,0 +1,7 @@
+{
+	"version": 1,
+	"guid": "f9bde46ba531ab431872ae28fb11c457",
+	"TypeScriptImporter": {
+		"IsComponentFile": false
+	}
+}

+ 5 - 0
Basic2D/TypeScript/Resources/Scenes.asset

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

+ 65 - 0
Basic2D/TypeScript/Resources/Scenes/Scene.scene

@@ -0,0 +1,65 @@
+<?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="1978" />
+	<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" />
+	<component type="Renderer2D" id="1976" />
+	<node id="2">
+		<attribute name="Is Enabled" value="true" />
+		<attribute name="Name" value="Zone" />
+		<attribute name="Tags" />
+		<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="361">
+		<attribute name="Is Enabled" value="true" />
+		<attribute name="Name" value="Camera" />
+		<attribute name="Tags" />
+		<attribute name="Position" value="0 0 -2" />
+		<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" />
+			<attribute name="Orthographic Size" value="5" />
+		</component>
+	</node>
+	<node id="363">
+		<attribute name="Is Enabled" value="true" />
+		<attribute name="Name" value="Star" />
+		<attribute name="Tags" />
+		<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="StaticSprite2D" id="1975">
+			<attribute name="Layer" value="-100" />
+			<attribute name="Sprite" value="Sprite2D;Sprites/star.png" />
+		</component>
+		<component type="JSComponent" id="1977">
+			<attribute name="ComponentFile" value="JSComponentFile;Components/Spinner.js" />
+			<attribute name="FieldValues">
+				<variant hash="273365031" type="Float" value="1" />
+			</attribute>
+		</component>
+	</node>
+</scene>

+ 8 - 0
Basic2D/TypeScript/Resources/Scenes/Scene.scene.asset

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

+ 5 - 0
Basic2D/TypeScript/Resources/Scripts.asset

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

+ 3 - 0
Basic2D/TypeScript/Resources/Scripts/main.js

@@ -0,0 +1,3 @@
+// This script is the main entry point of the game
+//Load scene
+Atomic.player.loadScene("Scenes/Scene.scene");

+ 7 - 0
Basic2D/TypeScript/Resources/Scripts/main.js.asset

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

+ 3 - 0
Basic2D/TypeScript/Resources/Scripts/main.ts

@@ -0,0 +1,3 @@
+// This script is the main entry point of the game
+//Load scene
+Atomic.player.loadScene("Scenes/Scene.scene");

+ 7 - 0
Basic2D/TypeScript/Resources/Scripts/main.ts.asset

@@ -0,0 +1,7 @@
+{
+	"version": 1,
+	"guid": "2bab366c6414409b93adedee00886250",
+	"TypeScriptImporter": {
+		"IsComponentFile": false
+	}
+}

+ 5 - 0
Basic2D/TypeScript/Resources/Sprites.asset

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

BIN
Basic2D/TypeScript/Resources/Sprites/star.png


+ 7 - 0
Basic2D/TypeScript/Resources/Sprites/star.png.asset

@@ -0,0 +1,7 @@
+{
+	"version": 1,
+	"guid": "49b0acd22cb8531c92b0a917889494ee",
+	"TextureImporter": {
+		"compressionSize": 0
+	}
+}