Permalink
Browse files

background trees

  • Loading branch information...
1 parent e21f533 commit f30cc0d0ea39d2788a3fbdf672009d8f946f50a4 Colin Farrell committed Jan 29, 2012
Showing with 125 additions and 0 deletions.
  1. +36 −0 src/BackgroundTree.as
  2. +89 −0 src/MapBackgroundTreeMap.as
View
@@ -0,0 +1,36 @@
+package
+{
+ import org.flixel.FlxSprite;
+
+ public class BackgroundTree extends FlxSprite
+ {
+
+ [Embed(source="../assets/main_BGtree1.png")] protected var ImgTree1:Class;
+ [Embed(source="../assets/main_BGtree2.png")] protected var ImgTree2:Class;
+ [Embed(source="../assets/main_BGtree3.png")] protected var ImgTree3:Class;
+ [Embed(source="../assets/main_BGtree4.png")] protected var ImgTree4:Class;
+ [Embed(source="../assets/main_BGtree5.png")] protected var ImgTree5:Class;
+ [Embed(source="../assets/main_BGtree6.png")] protected var ImgTree6:Class;
+
+ protected var treeArray:Array;
+
+ public function BackgroundTree(X:Number=0, Y:Number=0)
+ {
+ var randomTree:Number;
+ super(X, Y);
+ treeArray = new Array(6);
+ treeArray[0]=(ImgTree1);
+ treeArray[1]=(ImgTree2);
+ treeArray[2]=(ImgTree3);
+ treeArray[3]=(ImgTree4);
+ treeArray[4]=(ImgTree5);
+ treeArray[5]=(ImgTree6);
+
+
+ randomTree = Math.round((Math.random() * 5));
+ loadGraphic(treeArray[randomTree],true,true,128, 128);
+
+
+ }
+ }
+}
@@ -0,0 +1,89 @@
+//Code generated by Flan. http://www.tbam.com.ar/utility--flan.php
+
+package {
+ import org.flixel.*;
+
+ public class MapBackgroundTreeMap extends MapBase {
+ //Media content declarations
+ [Embed(source="../assets/MapCSV_BackgroundTreeMap_MainGame.txt", mimeType="application/octet-stream")] public var CSV_MainGame:Class;
+ [Embed(source="../assets/game_tilesheetA32wide.png")] public var Img_MainGame:Class;
+
+
+ public function MapBackgroundTreeMap() {
+
+ _setCustomValues();
+
+ bgColor = 0xffffffff;
+
+ layerMainGame = new FlxTilemap();
+ layerMainGame.loadMap(new CSV_MainGame, Img_MainGame,32,32);
+ layerMainGame.x = 0;
+ layerMainGame.y = 0;
+ layerMainGame.scrollFactor.x = 1.000000;
+ layerMainGame.scrollFactor.y = 1.000000;
+
+ allLayers = [ layerMainGame ];
+
+
+ boundsMinX = 0;
+ boundsMinY = 0;
+ boundsMaxX = 1280;
+ boundsMaxY = 704;
+ }
+
+ override public function addSpritesToLayerMainGame(onAddCallback:Function = null):void {
+ var obj:FlxSprite;
+
+ obj = new Player(133, 239);;
+ obj.x+=obj.offset.x;
+ obj.y+=obj.offset.y;
+ FlxG.state.add(obj);
+ if(onAddCallback != null)
+ onAddCallback(obj);
+ obj = new Exit(1172, 229);;
+ obj.x+=obj.offset.x;
+ obj.y+=obj.offset.y;
+ FlxG.state.add(obj);
+ if(onAddCallback != null)
+ onAddCallback(obj);
+ obj = new BackgroundTree(854, 348);;
+ obj.x+=obj.offset.x;
+ obj.y+=obj.offset.y;
+ FlxG.state.add(obj);
+ if(onAddCallback != null)
+ onAddCallback(obj);
+ obj = new BackgroundTree(558, 188);;
+ obj.x+=obj.offset.x;
+ obj.y+=obj.offset.y;
+ FlxG.state.add(obj);
+ if(onAddCallback != null)
+ onAddCallback(obj);
+ obj = new BackgroundTree(247, 133);;
+ obj.x+=obj.offset.x;
+ obj.y+=obj.offset.y;
+ FlxG.state.add(obj);
+ if(onAddCallback != null)
+ onAddCallback(obj);
+ obj = new BackgroundTree(1012, 30);;
+ obj.x+=obj.offset.x;
+ obj.y+=obj.offset.y;
+ FlxG.state.add(obj);
+ if(onAddCallback != null)
+ onAddCallback(obj);
+ obj = new BackgroundTree(35, 229);;
+ obj.x+=obj.offset.x;
+ obj.y+=obj.offset.y;
+ FlxG.state.add(obj);
+ if(onAddCallback != null)
+ onAddCallback(obj);
+ }
+
+ override public function customFunction(param:* = null):* {
+
+ }
+
+ private function _setCustomValues():void {
+ }
+
+ }
+}

0 comments on commit f30cc0d

Please sign in to comment.