Browse Source

moved fish assets from AquariumToy to a new module TropicalAssets. This is so I can use the tropical Assets in other projects without the "sandbox" mechanizations coming along. It has been tested to make sure the sandbox still works. Specifically, AquariumToy now has a dependency of TropicalAssets.

Charlie Patterson 12 years ago
parent
commit
3abb46b
50 changed files with 387 additions and 288 deletions
  1. 0 42
      modules/AquariumToy/1/assets/particles/bubbles.asset.taml
  2. 5 5
      modules/AquariumToy/1/main.cs
  3. 1 1
      modules/AquariumToy/1/module.taml
  4. 0 231
      modules/AquariumToy/1/scripts/aquarium.cs
  5. 80 0
      modules/AquariumToy/1/scripts/fish.cs
  6. 1 1
      modules/TropicalAssets/1/assets/animations/angelfish1Anim.asset.taml
  7. 1 1
      modules/TropicalAssets/1/assets/animations/angelfish2Anim.asset.taml
  8. 1 1
      modules/TropicalAssets/1/assets/animations/butterflyfishAnim.asset.taml
  9. 1 1
      modules/TropicalAssets/1/assets/animations/eelAnim.asset.taml
  10. 1 1
      modules/TropicalAssets/1/assets/animations/pufferfishAnim.asset.taml
  11. 1 1
      modules/TropicalAssets/1/assets/animations/rockfishAnim.asset.taml
  12. 1 1
      modules/TropicalAssets/1/assets/animations/seahorseAnim.asset.taml
  13. 1 1
      modules/TropicalAssets/1/assets/animations/triggerfish1Anim.asset.taml
  14. 1 1
      modules/TropicalAssets/1/assets/animations/triggerfish2Anim.asset.taml
  15. 0 0
      modules/TropicalAssets/1/assets/images/angelfish1.asset.taml
  16. 0 0
      modules/TropicalAssets/1/assets/images/angelfish1.png
  17. 0 0
      modules/TropicalAssets/1/assets/images/angelfish2.asset.taml
  18. 0 0
      modules/TropicalAssets/1/assets/images/angelfish2.png
  19. 0 0
      modules/TropicalAssets/1/assets/images/background.asset.taml
  20. 0 0
      modules/TropicalAssets/1/assets/images/background.jpg
  21. 0 0
      modules/TropicalAssets/1/assets/images/beam.asset.taml
  22. 0 0
      modules/TropicalAssets/1/assets/images/beam.png
  23. 0 0
      modules/TropicalAssets/1/assets/images/bubble.asset.taml
  24. 0 0
      modules/TropicalAssets/1/assets/images/bubble.png
  25. 0 0
      modules/TropicalAssets/1/assets/images/butterflyfish.asset.taml
  26. 0 0
      modules/TropicalAssets/1/assets/images/butterflyfish.png
  27. 0 0
      modules/TropicalAssets/1/assets/images/eel.asset.taml
  28. 0 0
      modules/TropicalAssets/1/assets/images/eel.png
  29. 9 0
      modules/TropicalAssets/1/assets/images/font.asset.taml
  30. BIN
      modules/TropicalAssets/1/assets/images/font.png
  31. 4 0
      modules/TropicalAssets/1/assets/images/mine.asset.taml
  32. BIN
      modules/TropicalAssets/1/assets/images/mine.png
  33. 0 0
      modules/TropicalAssets/1/assets/images/pufferfish.asset.taml
  34. 0 0
      modules/TropicalAssets/1/assets/images/pufferfish.png
  35. 0 0
      modules/TropicalAssets/1/assets/images/rockfish.asset.taml
  36. 0 0
      modules/TropicalAssets/1/assets/images/rockfish.png
  37. 0 0
      modules/TropicalAssets/1/assets/images/rocksfar.asset.taml
  38. 0 0
      modules/TropicalAssets/1/assets/images/rocksfar.png
  39. 0 0
      modules/TropicalAssets/1/assets/images/rocksnear.asset.taml
  40. 0 0
      modules/TropicalAssets/1/assets/images/rocksnear.png
  41. 0 0
      modules/TropicalAssets/1/assets/images/seahorse.asset.taml
  42. 0 0
      modules/TropicalAssets/1/assets/images/seahorse.png
  43. 0 0
      modules/TropicalAssets/1/assets/images/triggerfish1.asset.taml
  44. 0 0
      modules/TropicalAssets/1/assets/images/triggerfish1.png
  45. 0 0
      modules/TropicalAssets/1/assets/images/wave.asset.taml
  46. 0 0
      modules/TropicalAssets/1/assets/images/wave.png
  47. 0 0
      modules/TropicalAssets/1/assets/particles/caustics.asset.taml
  48. 32 0
      modules/TropicalAssets/1/main.cs
  49. 12 0
      modules/TropicalAssets/1/module.taml
  50. 235 0
      modules/TropicalAssets/1/scripts/aquarium.cs

+ 0 - 42
modules/AquariumToy/1/assets/particles/bubbles.asset.taml

@@ -1,42 +0,0 @@
-<ParticleAsset
-    AssetName="Bubbles">
-    <ParticleAssetEmitter
-        EmitterName="bubbles"
-		EmitterType="line"
-		EmitterSize="100 1"
-        FixedForceAngle="90"
-        OldestInFront="1"
-        Image="@asset=ToyAssets:Particles5"
-        Frame="2">
-        <ParticleAssetEmitter.Fields>
-            <Quantity
-                Keys="0 10" />
-			<EmissionArc
-				Keys="0 0" />
-			<EmissionAngle
-				Keys="0 90" />				
-            <Lifetime
-                Keys="0 5" />				
-            <LifetimeVariation
-                Keys="0 3" />
-            <Speed
-                Keys="0 1" />
-            <SpeedVariation
-                Keys="0 0.5" />				
-            <RandomMotion
-                Keys="0 45" />				
-            <FixedForce
-                Keys="0 1" />				
-            <FixedForceVariation
-                Keys="0 1.5" />
-            <SizeX
-                Keys="0 1" />				
-            <SizeXVariation
-                Keys="0 1" />
-            <SizeXLife
-                Keys="0 0 0.2 1 0.5 2 0.9 1 1 0" />				
-            <AlphaChannel
-                Keys="0 0 0.1 0.3 0.8 0.3 1 0" />
-        </ParticleAssetEmitter.Fields>
-    </ParticleAssetEmitter>
-</ParticleAsset>

+ 5 - 5
modules/AquariumToy/1/main.cs

@@ -22,12 +22,12 @@
 
 function AquariumToy::create( %this )
 {
-    exec("./scripts/aquarium.cs");
+    exec("./scripts/fish.cs");
 
     // Configure settings.
     AquariumToy.maxFish = 10;
     AquariumToy.currentFish = 0;
-    AquariumToy.selectedAnimation = "AquariumToy:angelfish1Anim";
+    AquariumToy.selectedAnimation = "TropicalAssets:angelfish1Anim";
     
     // Set all the fish scene-layers to sort in "batch" mode
     // so that all the fish will be sorted into a batchable order to reduce draw calls.
@@ -62,8 +62,8 @@ function AquariumToy::reset(%this)
     // Set the gravity.
     SandboxScene.setGravity(0, 0);
 
-    buildAquarium();
-    createAquariumEffects();
+    buildAquarium(SandboxScene);
+    createAquariumEffects(SandboxScene);
 
     // Reset the ball count.
     %this.currentFish = 0;
@@ -88,7 +88,7 @@ function AquariumToy::spawnFish(%this)
         class = "FishClass";
         position = %position;
         size = %fishInfo;
-        SceneLayer = "2";
+        SceneLayer = "15";
         SceneGroup = "14";
         minSpeed = "5";
         maxSpeed = "15";

+ 1 - 1
modules/AquariumToy/1/module.taml

@@ -2,7 +2,7 @@
 	ModuleId="AquariumToy"
 	VersionId="1"
 	Description="A fun demonstration of an aquarium."
-	Dependencies="ToyAssets=1"
+	Dependencies="ToyAssets=1,TropicalAssets=1"
 	Type="toy"
 	ToyCategoryIndex="5"
 	ScriptFile="main.cs"

+ 0 - 231
modules/AquariumToy/1/scripts/aquarium.cs

@@ -1,231 +0,0 @@
-//-----------------------------------------------------------------------------
-// Copyright (c) 2013 GarageGames, LLC
-//
-// Permission is hereby granted, free of charge, to any person obtaining a copy
-// of this software and associated documentation files (the "Software"), to
-// deal in the Software without restriction, including without limitation the
-// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
-// sell copies of the Software, and to permit persons to whom the Software is
-// furnished to do so, subject to the following conditions:
-//
-// The above copyright notice and this permission notice shall be included in
-// all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
-// IN THE SOFTWARE.
-//-----------------------------------------------------------------------------
-
-function getFishAnimationList()
-{
-   %list = "AquariumToy:angelfish1Anim" @ "," @ "AquariumToy:angelfish2Anim" @ "," @ "AquariumToy:butterflyfishAnim";
-   %list = %list @ "," @ "AquariumToy:pufferfishAnim" @ "," @ "AquariumToy:rockfishAnim" @ "," @ "AquariumToy:seahorseAnim";
-   %list = %list @ "," @ "AquariumToy:triggerfish1Anim" @ "," @ "AquariumToy:eelAnim";
-}
-
-//-----------------------------------------------------------------------------
-
-function getFishSize(%anim)
-{
-    switch$(%anim)
-    {
-        case "AquariumToy:angelfish1Anim":
-        %fishInfo = "15 15";
-
-        case "AquariumToy:angelfish2Anim":
-        %fishInfo = "15 15";
-        
-        case "AquariumToy:butterflyfishAnim":
-        %fishInfo = "15 15";
-        
-        case "AquariumToy:pufferfishAnim":
-        %fishInfo = "15 15";
-        
-        case "AquariumToy:rockfishAnim":
-        %fishInfo = "15 7.5";
-        
-        case "AquariumToy:seahorseAnim":
-        %fishInfo = "7.5 15";
-        
-        case "AquariumToy:triggerfish1Anim":
-        %fishInfo = "15 15";
-
-        case "AquariumToy:eelAnim":
-        %fishInfo = "7.5 3.75";
-    }
-
-    return %fishInfo;
-}
-
-//-----------------------------------------------------------------------------
-
-function buildAquarium()
-{
-    // Background
-    %background = new Sprite();
-    %background.setBodyType( "static" );
-    %background.setImage( "AquariumToy:background" );
-    %background.setSize( 100, 75 );
-    %background.setCollisionSuppress();
-    %background.setAwake( false );
-    %background.setActive( false );
-    %background.setSceneLayer(5);
-    SandboxScene.add( %background );
-    
-    // Far rocks
-    %farRocks = new Sprite();
-    %farRocks.setBodyType( "static" );
-    %farRocks.setPosition( 0, -7.5 );
-    %farRocks.setImage( "AquariumToy:rocksfar" );
-    %farRocks.setSize( 100, 75 );
-    %farRocks.setCollisionSuppress();
-    %farRocks.setAwake( false );
-    %farRocks.setActive( false );
-    %farRocks.setSceneLayer(4);
-    SandboxScene.add( %farRocks );
-    
-    // Near rocks
-    %nearRocks = new Sprite();
-    %nearRocks.setBodyType( "static" );
-    %nearRocks.setPosition( 0, -8.5 );
-    %nearRocks.setImage( "AquariumToy:rocksnear" );
-    %nearRocks.setSize( 100, 75 );
-    %nearRocks.setCollisionSuppress();
-    %nearRocks.setAwake( false );
-    %nearRocks.setActive( false );
-    %nearRocks.setSceneLayer(3);
-    SandboxScene.add( %nearRocks );
-    
-    // Left trigger
-    %leftTrigger = new SceneObject() { class = "AquariumBoundary"; };
-    
-    %leftTrigger.side = "left";
-    %leftTrigger.setSize( 5, 400 );
-    %leftTrigger.setPosition( -85, 0);
-    %leftTrigger.setSceneLayer( 1 );
-    %leftTrigger.setSceneGroup( 15 );
-    %leftTrigger.setCollisionGroups( 14 );
-    %leftTrigger.createPolygonBoxCollisionShape( 5, 400);
-    %leftTrigger.setDefaultDensity( 1 );
-    %leftTrigger.setDefaultFriction( 1.0 );        
-    %leftTrigger.setAwake( true );
-    %leftTrigger.setActive( true );
-    %leftTrigger.setCollisionCallback(true);
-    %leftTrigger.setBodyType( "static" );
-    %leftTrigger.setCollisionShapeIsSensor(0, true);
-    SandboxScene.add( %leftTrigger );
-    
-    // Right trigger
-    %rightTrigger = new SceneObject() { class = "AquariumBoundary"; };
-    
-    %rightTrigger.setSize( 5, 400 );
-    %rightTrigger.side = "right";
-    %rightTrigger.setPosition( 85, 0);
-    %rightTrigger.setSceneLayer( 1 );
-    %rightTrigger.setSceneGroup( 15 );
-    %rightTrigger.setCollisionGroups( 14 );
-    %rightTrigger.createPolygonBoxCollisionShape( 5, 400);
-    %rightTrigger.setDefaultDensity( 1 );
-    %rightTrigger.setDefaultFriction( 1.0 );    
-    %rightTrigger.setAwake( true );
-    %rightTrigger.setActive( true );
-    %rightTrigger.setCollisionCallback(true);
-    %rightTrigger.setBodyType( "static" );
-    %rightTrigger.setCollisionShapeIsSensor(0, true);
-    SandboxScene.add( %rightTrigger );    
-}
-
-//-----------------------------------------------------------------------------
-
-function AquariumBoundary::onCollision(%this, %object, %collisionDetails)
-{
-    if (%object.class $= "FishClass")
-        %object.recycle(%this.side);
-}
-
-//-----------------------------------------------------------------------------
-
-function createAquariumEffects()
-{
-    %obj = new Scroller();
-    %obj.setBodyType( "static" );
-    %obj.setImage( "AquariumToy:wave" );
-    %obj.setPosition( 0, 0 );
-    %obj.setScrollX(2);
-    %obj.setSize( 100, 75 );
-    %obj.setRepeatX( 0.2 );   
-    %obj.setSceneLayer( 0 );
-    %obj.setSceneGroup( 0 );
-    %obj.setCollisionSuppress();
-    %obj.setAwake( false );
-    %obj.setActive( false );
-    SandboxScene.add( %obj );
-
-    // Add the bubbles particle.
-    %bubbles= new ParticlePlayer();
-    %bubbles.Particle = "AquariumToy:Bubbles";
-    %bubbles.setPosition( 0, -38 );
-    %bubbles.setSceneLayer(4);
-    SandboxScene.add( %bubbles );   
-    
-    // Add the caustics particle.
-    %caustics = new ParticlePlayer();
-    %caustics.Particle = "AquariumToy:Caustics";
-    SandboxScene.add( %caustics ); 
-}
-
-//-----------------------------------------------------------------------------
-
-function FishClass::onAdd(%this)
-{
-    // Set a random speed for the fish
-    %this.setSpeed();
-   
-    if (getRandom(0, 10) > 5)
-    {
-        %this.setLinearVelocityX(%this.speed);
-        %this.setFlipX(false);
-    }
-    else
-    {
-        %this.setLinearVelocityX(-%this.speed);
-        %this.setFlipX(true);
-    }
-}
-
-//-----------------------------------------------------------------------------
-
-function FishClass::recycle(%this, %side)
-{
-    // Fish has turned around, so set a new random speed
-    %this.setSpeed();
-    %layer = getRandom(0, 5);
-    %this.setLinearVelocityY(getRandom(-3, 3));
-    %this.setPositionY(getRandom(-15, 15));
-    %this.setSceneLayer(%layer);
-
-    if (%side $= "left")
-    {
-        %this.setLinearVelocityX(%this.speed);
-        %this.setFlipX(false);
-    }
-    else if (%side $= "right")
-    {
-        %this.setLinearVelocityX(-%this.speed);
-        %this.setFlipX(true);
-    }
-}
-
-//-----------------------------------------------------------------------------
-
-function FishClass::setSpeed(%this)
-{
-   // Speed is a dynamic variable created when this function is first called
-   // Every other time after the first call will simply modify the variable
-   // .minSpeed and .maxSpeed are declared in the Dynamic Fields rollout of the editor
-   %this.speed = getRandom(%this.minSpeed, %this.maxSpeed);
-}

+ 80 - 0
modules/AquariumToy/1/scripts/fish.cs

@@ -0,0 +1,80 @@
+//-----------------------------------------------------------------------------
+// Copyright (c) 2013 GarageGames, LLC
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to
+// deal in the Software without restriction, including without limitation the
+// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+// sell copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+// IN THE SOFTWARE.
+//-----------------------------------------------------------------------------
+
+
+function FishClass::onCollision(%this, %object, %collisionDetails)
+{
+    if (%object.class $= "AquariumBoundary")
+        %this.recycle(%object.side);
+}
+
+//-----------------------------------------------------------------------------
+
+function FishClass::onAdd(%this)
+{
+    // Set a random speed for the fish
+    %this.setSpeed();
+   
+    if (getRandom(0, 10) > 5)
+    {
+        %this.setLinearVelocityX(%this.speed);
+        %this.setFlipX(false);
+    }
+    else
+    {
+        %this.setLinearVelocityX(-%this.speed);
+        %this.setFlipX(true);
+    }
+}
+
+//-----------------------------------------------------------------------------
+
+function FishClass::recycle(%this, %side)
+{
+    // Fish has turned around, so set a new random speed
+    %this.setSpeed();
+    %layer = getRandom(0, 5);
+    %this.setLinearVelocityY(getRandom(-3, 3));
+    %this.setPositionY(getRandom(-15, 15));
+    %this.setSceneLayer(%layer);
+
+    if (%side $= "left")
+    {
+        %this.setLinearVelocityX(%this.speed);
+        %this.setFlipX(false);
+    }
+    else if (%side $= "right")
+    {
+        %this.setLinearVelocityX(-%this.speed);
+        %this.setFlipX(true);
+    }
+}
+
+//-----------------------------------------------------------------------------
+
+function FishClass::setSpeed(%this)
+{
+   // Speed is a dynamic variable created when this function is first called
+   // Every other time after the first call will simply modify the variable
+   // .minSpeed and .maxSpeed are declared in the Dynamic Fields rollout of the editor
+   %this.speed = getRandom(%this.minSpeed, %this.maxSpeed);
+}

+ 1 - 1
modules/AquariumToy/1/assets/animations/angelfish1Anim.asset.taml → modules/TropicalAssets/1/assets/animations/angelfish1Anim.asset.taml

@@ -1,5 +1,5 @@
 <AnimationAsset
     AssetName="angelfish1Anim"
-    Image="@asset=AquariumToy:angelFishImage"
+    Image="@asset=TropicalAssets:angelFishImage"
     AnimationFrames="0 1 2 3 3 2 1 0"
     AnimationTime="0.4" />

+ 1 - 1
modules/AquariumToy/1/assets/animations/angelfish2Anim.asset.taml → modules/TropicalAssets/1/assets/animations/angelfish2Anim.asset.taml

@@ -1,5 +1,5 @@
 <AnimationAsset
     AssetName="angelfish2Anim"
-    Image="@asset=AquariumToy:angelfish2"
+    Image="@asset=TropicalAssets:angelfish2"
     AnimationFrames="0 1 2 3 3 2 1 0"
     AnimationTime="0.4" />

+ 1 - 1
modules/AquariumToy/1/assets/animations/butterflyfishAnim.asset.taml → modules/TropicalAssets/1/assets/animations/butterflyfishAnim.asset.taml

@@ -1,5 +1,5 @@
 <AnimationAsset
     AssetName="butterflyfishAnim"
-    Image="@asset=AquariumToy:butterflyfish"
+    Image="@asset=TropicalAssets:butterflyfish"
     AnimationFrames="0 1 2 3 3 2 1 0"
     AnimationTime="0.4" />

+ 1 - 1
modules/AquariumToy/1/assets/animations/eelAnim.asset.taml → modules/TropicalAssets/1/assets/animations/eelAnim.asset.taml

@@ -1,5 +1,5 @@
 <AnimationAsset
     AssetName="eelAnim"
-    Image="@asset=AquariumToy:eel"
+    Image="@asset=TropicalAssets:eel"
     AnimationFrames="0 1 2 3 3 2 1 0"
     AnimationTime="0.3" />

+ 1 - 1
modules/AquariumToy/1/assets/animations/pufferfishAnim.asset.taml → modules/TropicalAssets/1/assets/animations/pufferfishAnim.asset.taml

@@ -1,5 +1,5 @@
 <AnimationAsset
     AssetName="pufferfishAnim"
-    Image="@asset=AquariumToy:pufferfish"
+    Image="@asset=TropicalAssets:pufferfish"
     AnimationFrames="0 1 2 3 3 2 1 0"
     AnimationTime="0.4" />

+ 1 - 1
modules/AquariumToy/1/assets/animations/rockfishAnim.asset.taml → modules/TropicalAssets/1/assets/animations/rockfishAnim.asset.taml

@@ -1,5 +1,5 @@
 <AnimationAsset
     AssetName="rockfishAnim"
-    Image="@asset=AquariumToy:rockfish"
+    Image="@asset=TropicalAssets:rockfish"
     AnimationFrames="0 1 2 3 3 2 1 0"
     AnimationTime="0.4" />

+ 1 - 1
modules/AquariumToy/1/assets/animations/seahorseAnim.asset.taml → modules/TropicalAssets/1/assets/animations/seahorseAnim.asset.taml

@@ -1,5 +1,5 @@
 <AnimationAsset
     AssetName="seahorseAnim"
-    Image="@asset=AquariumToy:seahorse"
+    Image="@asset=TropicalAssets:seahorse"
     AnimationFrames="0 1 2 3 3 2 1 0"
     AnimationTime="0.8" />

+ 1 - 1
modules/AquariumToy/1/assets/animations/triggerfish1Anim.asset.taml → modules/TropicalAssets/1/assets/animations/triggerfish1Anim.asset.taml

@@ -1,5 +1,5 @@
 <AnimationAsset
     AssetName="triggerfish1Anim"
-    Image="@asset=AquariumToy:triggerfish1"
+    Image="@asset=TropicalAssets:triggerfish1"
     AnimationFrames="0 1 2 3 3 2 1 0"
     AnimationTime="0.4" />

+ 1 - 1
modules/AquariumToy/1/assets/animations/triggerfish2Anim.asset.taml → modules/TropicalAssets/1/assets/animations/triggerfish2Anim.asset.taml

@@ -1,5 +1,5 @@
 <AnimationAsset
     AssetName="triggerfish2Anim"
-    Image="@asset=AquariumToy:triggerfish2"
+    Image="@asset=TropicalAssets:triggerfish2"
     AnimationFrames="0 1 2 3 3 2 1 0"
     AnimationTime="0.4" />

+ 0 - 0
modules/AquariumToy/1/assets/images/angelfish1.asset.taml → modules/TropicalAssets/1/assets/images/angelfish1.asset.taml


+ 0 - 0
modules/AquariumToy/1/assets/images/angelfish1.png → modules/TropicalAssets/1/assets/images/angelfish1.png


+ 0 - 0
modules/AquariumToy/1/assets/images/angelfish2.asset.taml → modules/TropicalAssets/1/assets/images/angelfish2.asset.taml


+ 0 - 0
modules/AquariumToy/1/assets/images/angelfish2.png → modules/TropicalAssets/1/assets/images/angelfish2.png


+ 0 - 0
modules/AquariumToy/1/assets/images/background.asset.taml → modules/TropicalAssets/1/assets/images/background.asset.taml


+ 0 - 0
modules/AquariumToy/1/assets/images/background.jpg → modules/TropicalAssets/1/assets/images/background.jpg


+ 0 - 0
modules/AquariumToy/1/assets/images/beam.asset.taml → modules/TropicalAssets/1/assets/images/beam.asset.taml


+ 0 - 0
modules/AquariumToy/1/assets/images/beam.png → modules/TropicalAssets/1/assets/images/beam.png


+ 0 - 0
modules/AquariumToy/1/assets/images/bubble.asset.taml → modules/TropicalAssets/1/assets/images/bubble.asset.taml


+ 0 - 0
modules/AquariumToy/1/assets/images/bubble.png → modules/TropicalAssets/1/assets/images/bubble.png


+ 0 - 0
modules/AquariumToy/1/assets/images/butterflyfish.asset.taml → modules/TropicalAssets/1/assets/images/butterflyfish.asset.taml


+ 0 - 0
modules/AquariumToy/1/assets/images/butterflyfish.png → modules/TropicalAssets/1/assets/images/butterflyfish.png


+ 0 - 0
modules/AquariumToy/1/assets/images/eel.asset.taml → modules/TropicalAssets/1/assets/images/eel.asset.taml


+ 0 - 0
modules/AquariumToy/1/assets/images/eel.png → modules/TropicalAssets/1/assets/images/eel.png


+ 9 - 0
modules/TropicalAssets/1/assets/images/font.asset.taml

@@ -0,0 +1,9 @@
+<ImageAsset
+    AssetName="font"
+    ImageFile="font.png"
+	CellOffsetY="1"
+	CellStrideY="16"
+    CellCountX="16"
+    CellCountY="6"
+    CellWidth="16"
+    CellHeight="14" />

BIN
modules/TropicalAssets/1/assets/images/font.png


+ 4 - 0
modules/TropicalAssets/1/assets/images/mine.asset.taml

@@ -0,0 +1,4 @@
+<ImageAsset
+    AssetName="mine"
+    ImageFile="mine.png"
+/>

BIN
modules/TropicalAssets/1/assets/images/mine.png


+ 0 - 0
modules/AquariumToy/1/assets/images/pufferfish.asset.taml → modules/TropicalAssets/1/assets/images/pufferfish.asset.taml


+ 0 - 0
modules/AquariumToy/1/assets/images/pufferfish.png → modules/TropicalAssets/1/assets/images/pufferfish.png


+ 0 - 0
modules/AquariumToy/1/assets/images/rockfish.asset.taml → modules/TropicalAssets/1/assets/images/rockfish.asset.taml


+ 0 - 0
modules/AquariumToy/1/assets/images/rockfish.png → modules/TropicalAssets/1/assets/images/rockfish.png


+ 0 - 0
modules/AquariumToy/1/assets/images/rocksfar.asset.taml → modules/TropicalAssets/1/assets/images/rocksfar.asset.taml


+ 0 - 0
modules/AquariumToy/1/assets/images/rocksfar.png → modules/TropicalAssets/1/assets/images/rocksfar.png


+ 0 - 0
modules/AquariumToy/1/assets/images/rocksnear.asset.taml → modules/TropicalAssets/1/assets/images/rocksnear.asset.taml


+ 0 - 0
modules/AquariumToy/1/assets/images/rocksnear.png → modules/TropicalAssets/1/assets/images/rocksnear.png


+ 0 - 0
modules/AquariumToy/1/assets/images/seahorse.asset.taml → modules/TropicalAssets/1/assets/images/seahorse.asset.taml


+ 0 - 0
modules/AquariumToy/1/assets/images/seahorse.png → modules/TropicalAssets/1/assets/images/seahorse.png


+ 0 - 0
modules/AquariumToy/1/assets/images/triggerfish1.asset.taml → modules/TropicalAssets/1/assets/images/triggerfish1.asset.taml


+ 0 - 0
modules/AquariumToy/1/assets/images/triggerfish1.png → modules/TropicalAssets/1/assets/images/triggerfish1.png


+ 0 - 0
modules/AquariumToy/1/assets/images/wave.asset.taml → modules/TropicalAssets/1/assets/images/wave.asset.taml


+ 0 - 0
modules/AquariumToy/1/assets/images/wave.png → modules/TropicalAssets/1/assets/images/wave.png


+ 0 - 0
modules/AquariumToy/1/assets/particles/caustics.asset.taml → modules/TropicalAssets/1/assets/particles/caustics.asset.taml


+ 32 - 0
modules/TropicalAssets/1/main.cs

@@ -0,0 +1,32 @@
+//-----------------------------------------------------------------------------
+// Copyright (c) 2013 GarageGames, LLC
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to
+// deal in the Software without restriction, including without limitation the
+// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+// sell copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+// IN THE SOFTWARE.
+//-----------------------------------------------------------------------------
+
+function TropicalAssets::create( %this )
+{
+    exec("./scripts/aquarium.cs");
+}
+
+//-----------------------------------------------------------------------------
+
+function TropicalAssets::destroy( %this )
+{
+}

+ 12 - 0
modules/TropicalAssets/1/module.taml

@@ -0,0 +1,12 @@
+<ModuleDefinition
+	ModuleId="TropicalAssets"
+	VersionId="1"
+	Description="Tropical Fish Assets.  Particularly useful for the AquariumToy"
+	ScriptFile="main.cs"
+	CreateFunction="create"
+	DestroyFunction="destroy">
+		<DeclaredAssets
+			Path="assets"
+			Extension="asset.taml"
+			Recurse="true"/>
+</ModuleDefinition>

+ 235 - 0
modules/TropicalAssets/1/scripts/aquarium.cs

@@ -0,0 +1,235 @@
+//-----------------------------------------------------------------------------
+// Copyright (c) 2013 GarageGames, LLC
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to
+// deal in the Software without restriction, including without limitation the
+// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+// sell copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+// IN THE SOFTWARE.
+//-----------------------------------------------------------------------------
+
+function getFishAnimationList()
+{
+   %list = "TropicalAssets:angelfish1Anim" @ "," @ "TropicalAssets:angelfish2Anim" @ "," @ "TropicalAssets:butterflyfishAnim";
+   %list = %list @ "," @ "TropicalAssets:pufferfishAnim" @ "," @ "TropicalAssets:rockfishAnim" @ "," @ "TropicalAssets:seahorseAnim";
+   %list = %list @ "," @ "TropicalAssets:triggerfish1Anim" @ "," @ "TropicalAssets:eelAnim";
+}
+
+//-----------------------------------------------------------------------------
+
+function getFishSize(%anim)
+{
+    switch$(%anim)
+    {
+        case "TropicalAssets:angelfish1Anim":
+        %fishInfo = "15 15";
+
+        case "TropicalAssets:angelfish2Anim":
+        %fishInfo = "15 15";
+        
+        case "TropicalAssets:butterflyfishAnim":
+        %fishInfo = "15 15";
+        
+        case "TropicalAssets:pufferfishAnim":
+        %fishInfo = "15 15";
+        
+        case "TropicalAssets:rockfishAnim":
+        %fishInfo = "15 7.5";
+        
+        case "TropicalAssets:seahorseAnim":
+        %fishInfo = "7.5 15";
+        
+        case "TropicalAssets:triggerfish1Anim":
+        %fishInfo = "15 15";
+
+        case "TropicalAssets:eelAnim":
+        %fishInfo = "7.5 3.75";
+    }
+
+    return %fishInfo;
+}
+
+//-----------------------------------------------------------------------------
+
+function buildAquarium(%scene)
+{
+    // A pre-built aquarium of size 100x75, with blue water, some haze, and some nice rocks.
+    // Triggers will be provide around the edges, kind of like an electric fence,
+    // with a call to addAquariumBoundaries.
+
+    // Background
+    %background = new Sprite();
+    %background.setBodyType( "static" );
+    %background.setImage( "TropicalAssets:background" );
+    %background.setSize( 100, 75 );
+    %background.setCollisionSuppress();
+    %background.setAwake( false );
+    %background.setActive( false );
+    %background.setSceneLayer(30);
+    %scene.add( %background );
+    
+    // Far rocks
+    %farRocks = new Sprite();
+    %farRocks.setBodyType( "static" );
+    %farRocks.setPosition( 0, -7.5 );
+    %farRocks.setImage( "TropicalAssets:rocksfar" );
+    %farRocks.setSize( 100, 75 );
+    %farRocks.setCollisionSuppress();
+    %farRocks.setAwake( false );
+    %farRocks.setActive( false );
+    %farRocks.setSceneLayer(20);
+    %scene.add( %farRocks );
+    
+    // Near rocks
+    %nearRocks = new Sprite();
+    %nearRocks.setBodyType( "static" );
+    %nearRocks.setPosition( 0, -8.5 );
+    %nearRocks.setImage( "TropicalAssets:rocksnear" );
+    %nearRocks.setSize( 100, 75 );
+    %nearRocks.setCollisionSuppress();
+    %nearRocks.setAwake( false );
+    %nearRocks.setActive( false );
+    %nearRocks.setSceneLayer(10);
+    %scene.add( %nearRocks );
+    
+    addAquariumBoundaries( %scene, 100, 75 );
+}
+
+function addAquariumBoundaries(%scene, %width, %height)
+{
+    // add boundaries on all sides of the aquarium a bit outside of the border of the tank.
+    // The triggers allow for onCollision to be sent to any fish or other object that touch the edges.
+    // The triggers are far enough outside the tank so that objects will most likely be just out of view
+    // before they are sent the onCollision callback.  This will they can adjust "off stage".
+
+    // Calculate a width and height to use for the bounds.
+    // They should be bigger than the aquarium itself.
+    %wrapWidth = %width * 1.5;
+    %wrapHeight = %height * 1.5;
+
+    // Left trigger
+    %leftTrigger = new SceneObject() { class = "AquariumBoundary"; };
+    
+    %leftTrigger.side = "left";
+    // make the bound as tall as the tank
+    %leftTrigger.setSize( 5, %wrapHeight );
+    // put the bounds 50% further out than the edge of the tank
+    %leftTrigger.setPosition( -%wrapWidth/2, 0 );
+    %leftTrigger.setSceneLayer( 1 );
+    %leftTrigger.createPolygonBoxCollisionShape( 5, %wrapHeight );
+    %leftTrigger.setDefaultDensity( 1 );
+    %leftTrigger.setDefaultFriction( 1.0 );        
+    %leftTrigger.setAwake( true );
+    %leftTrigger.setActive( true );
+    // the objects that collide with us should handle any callbacks.
+    // remember to set those scene objects to collide with scene group 15 (which is our group)!
+    %leftTrigger.setSceneGroup( 15 );
+    %leftTrigger.setCollisionCallback(false);
+    %leftTrigger.setBodyType( "static" );
+    %leftTrigger.setCollisionShapeIsSensor(0, true);
+    %scene.add( %leftTrigger );
+    
+    // Right trigger
+    %rightTrigger = new SceneObject() { class = "AquariumBoundary"; };
+    
+    // make the bound as tall as the tank
+    %rightTrigger.setSize( 5, %wrapHeight );
+    %rightTrigger.side = "right";
+    // put the bounds 50% further out than the edge of the tank
+    %rightTrigger.setPosition( %wrapWidth/2, 0 );
+    %rightTrigger.setSceneLayer( 1 );
+    %rightTrigger.createPolygonBoxCollisionShape( 5, %wrapHeight );
+    %rightTrigger.setDefaultDensity( 1 );
+    %rightTrigger.setDefaultFriction( 1.0 );    
+    %rightTrigger.setAwake( true );
+    %rightTrigger.setActive( true );
+    // the objects that collide with us should handle any callbacks.
+    // remember to set those scene objects to collide with scene group 15 (which is our group)!
+    %rightTrigger.setSceneGroup( 15 );
+    %rightTrigger.setCollisionCallback(false);
+    %rightTrigger.setBodyType( "static" );
+    %rightTrigger.setCollisionShapeIsSensor(0, true);
+    %scene.add( %rightTrigger );    
+
+    // Left trigger
+    %topTrigger = new SceneObject() { class = "AquariumBoundary"; };
+    
+    %topTrigger.side = "top";
+    // make the bound as wide as the tank
+    %topTrigger.setSize( %wrapWidth, 5 );
+    // put the bounds 50% further out than the edge of the tank
+    %topTrigger.setPosition( 0, -%wrapHeight/2 );
+    %topTrigger.setSceneLayer( 1 );
+    %topTrigger.createPolygonBoxCollisionShape( %wrapWidth, 5 );
+    %topTrigger.setDefaultDensity( 1 );
+    %topTrigger.setDefaultFriction( 1.0 );        
+    %topTrigger.setAwake( true );
+    %topTrigger.setActive( true );
+    // the objects that collide with us should handle any callbacks.
+    // remember to set those scene objects to collide with scene group 15 (which is our group)!
+    %topTrigger.setSceneGroup( 15 );
+    %topTrigger.setCollisionCallback(false);
+    %topTrigger.setBodyType( "static" );
+    %topTrigger.setCollisionShapeIsSensor(0, true);
+    %scene.add( %topTrigger );
+    
+    // Right trigger
+    %bottomTrigger = new SceneObject() { class = "AquariumBoundary"; };
+    
+    // make the bound as wide as the tank
+    %bottomTrigger.setSize( %wrapWidth, 5 );
+    %bottomTrigger.side = "bottom";
+    // put the bounds 50% further out than the edge of the tank
+    %bottomTrigger.setPosition( 0, %wrapHeight/2 );
+    %bottomTrigger.setSceneLayer( 1 );
+    %bottomTrigger.createPolygonBoxCollisionShape( %wrapWidth, 5 );
+    %bottomTrigger.setDefaultDensity( 1 );
+    %bottomTrigger.setDefaultFriction( 1.0 );    
+    %bottomTrigger.setAwake( true );
+    %bottomTrigger.setActive( true );
+    // the objects that collide with us should handle any callbacks.
+    // remember to set those scene objects to collide with scene group 15 (which is our group)!
+    %bottomTrigger.setSceneGroup( 15 );
+    %bottomTrigger.setCollisionCallback(false);
+    %bottomTrigger.setBodyType( "static" );
+    %bottomTrigger.setCollisionShapeIsSensor(0, true);
+    %scene.add( %bottomTrigger );
+}
+
+//-----------------------------------------------------------------------------
+
+function createAquariumEffects(%scene)
+{
+    %obj = new Scroller();
+    %obj.setBodyType( "static" );
+    %obj.setImage( "TropicalAssets:wave" );
+    %obj.setPosition( 0, 0 );
+    %obj.setScrollX(2);
+    %obj.setSize( 100, 75 );
+    %obj.setRepeatX( 0.2 );   
+    %obj.setSceneLayer( 0 );
+    %obj.setSceneGroup( 0 );
+    %obj.setCollisionSuppress();
+    %obj.setAwake( false );
+    %obj.setActive( false );
+    %scene.add( %obj );
+    
+    // Add the caustics particle.
+    %caustics = new ParticlePlayer();
+    %caustics.Particle = "TropicalAssets:Caustics";
+    %scene.add( %caustics ); 
+}
+
+//-----------------------------------------------------------------------------