Browse Source

Merge pull request #61 from AtomicGameEngine/LME-ATOMIC-BASIC2DUPDATE

Basic 2D update
LaraEngebretson 9 years ago
parent
commit
ab3ac5cad8

+ 16 - 0
Basic2D/Resources/Components/Spinner.js

@@ -0,0 +1,16 @@
+"atomic component";
+//inspector fields to make speed variable visible in editor
+var inspectorFields = {
+    speed: 1.0
+}
+
+exports.component = function(self) {
+    
+    //update function calls each frame
+    self.update = function(timeStep) {
+        //roll a node
+        self.node.roll(timeStep * 100);
+
+    }
+
+}

+ 1 - 1
Basic2D/Resources/Components/Star.js.asset → Basic2D/Resources/Components/Spinner.js.asset

@@ -1,6 +1,6 @@
 {
 	"version": 1,
-	"guid": "c9c2087b640424afd91176cd7b2a6199",
+	"guid": "be092271ebfd0ed63c3bd5e325981fbb",
 	"JavascriptImporter": {
 		"IsComponentFile": true
 	}

+ 0 - 29
Basic2D/Resources/Components/Star.js

@@ -1,29 +0,0 @@
-'atomic component';
-
-//A star component
-exports.component = function(self) {
-
-    //link to the current node
-    var node = self.node;
-
-    //start function calls when component attached to the node, calls after constructor
-    self.start = function() {
-
-        //create StaticSprite2D component to the current node
-        var sprite2D = node.createComponent("StaticSprite2D");
-        //get star.png sprite from cache
-        sprite2D.sprite = Atomic.cache.getResource("Sprite2D", "Sprites/star.png");
-        //set blend mode to BLEND_ALPHA
-        sprite2D.blendMode = Atomic.BLEND_ALPHA;
-
-    }
-
-    //update function calls each frame
-    self.update = function(timeStep) {
-        //roll a node
-        node.roll(timeStep * 100);
-
-    }
-
-
-}

+ 0 - 5
Basic2D/Resources/Modules.asset

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

+ 0 - 7
Basic2D/Resources/Modules/lodash.js.asset

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

+ 9 - 4
Basic2D/Resources/Scenes/Scene.scene

@@ -5,8 +5,8 @@
 	<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 Replicated Node ID" value="370" />
+	<attribute name="Next Replicated Component ID" value="1987" />
 	<attribute name="Next Local Node ID" value="16778496" />
 	<attribute name="Next Local Component ID" value="16777216" />
 	<attribute name="Variables" />
@@ -14,6 +14,7 @@
 	<component type="PhysicsWorld" id="1" />
 	<component type="Octree" id="2" />
 	<component type="DebugRenderer" id="3" />
+	<component type="Renderer2D" id="1980" />
 	<node id="2">
 		<attribute name="Is Enabled" value="true" />
 		<attribute name="Name" value="Zone" />
@@ -64,8 +65,12 @@
 		<attribute name="Rotation" value="1 0 0 0" />
 		<attribute name="Scale" value="1 1 1" />
 		<attribute name="Variables" />
-		<component type="JSComponent" id="1975">
-			<attribute name="ComponentFile" value="JSComponentFile;Components/Star.js" />
+		<component type="JSComponent" id="1977">
+			<attribute name="ComponentFile" value="JSComponentFile;Components/Spinner.js" />
+		</component>
+		<component type="StaticSprite2D" id="1979">
+			<attribute name="Layer" value="-100" />
+			<attribute name="Sprite" value="Sprite2D;Sprites/star.png" />
 		</component>
 	</node>
 </scene>

+ 4 - 1
Basic2D/Resources/Scenes/Scene.scene.asset

@@ -1,5 +1,8 @@
 {
 	"version": 1,
 	"guid": "39c9c7cef67bb9ec693277c83f4e6ee3",
-	"SceneImporter": {}
+	"SceneImporter": {
+		"sceneCamRotation": "1 0 0 0",
+		"sceneCamPosition": "0 0 -3.40579"
+	}
 }