Browse Source

Updating Basic2D

Josh Engebretson 10 years ago
parent
commit
39d27d4b34

+ 1 - 0
Basic2D/.gitignore

@@ -0,0 +1 @@
+Cache/*

+ 5 - 0
Basic2D/Resources.asset

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

+ 5 - 0
Basic2D/Resources/Components.asset

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

+ 16 - 10
Basic2D/Resources/Components/Star.js

@@ -1,16 +1,22 @@
-var game = Atomic.game;
-var node = self.node;
+'atomic component';
 
-function start() {
+exports.component = function(self) {
 
-	var sprite2D = node.createComponent("StaticSprite2D");
-	sprite2D.sprite = game.getSprite2D("Sprites/star.png");
-	sprite2D.blendMode = Atomic.BLEND_ALPHA;
-	
-}
+    var node = self.node;
 
-function update(timeStep) {	
+    self.start = function() {
+
+        var sprite2D = node.createComponent("StaticSprite2D");
+        sprite2D.sprite = Atomic.cache.getResource("Sprite2D", "Sprites/star.png");
+        sprite2D.blendMode = Atomic.BLEND_ALPHA;
+
+    }
+
+    self.update = function(timeStep) {
+
+        node.roll(timeStep * 100);
+
+    }
 
-	node.roll(timeStep * 100);
 
 }

+ 7 - 0
Basic2D/Resources/Components/Star.js.asset

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

+ 5 - 0
Basic2D/Resources/Scenes.asset

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

+ 71 - 0
Basic2D/Resources/Scenes/Scene.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 -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="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="JSComponent" id="1975">
+			<attribute name="ComponentFile" value="JSComponentFile;Components/Star.js" />
+		</component>
+	</node>
+</scene>

+ 5 - 0
Basic2D/Resources/Scenes/Scene.scene.asset

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

+ 5 - 0
Basic2D/Resources/Scripts.asset

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

+ 1 - 15
Basic2D/Resources/Scripts/main.js

@@ -1,23 +1,9 @@
 
 // This script is the main entry point of the game
-require("AtomicGame");
 
-Atomic.game.init(start, update);
+Atomic.player.loadScene("Scenes/Scene.scene");
 
 
-// called at the start of play
-function start() {
-
-	var game = Atomic.game;
-
-	// create a 2D scene
-	game.createScene2D();
-
-    var spaceNode = game.scene.createChild("Star");
-    spaceNode.createJSComponent("Star");
-
-}
-
 // called per frame
 function update(timeStep) {
 

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

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

+ 5 - 0
Basic2D/Resources/Sprites.asset

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

+ 5 - 0
Basic2D/Resources/Sprites/star.png.asset

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