override public void create() { FlxG.resetHud(); FlxG.hideHud(); FlxG.backColor = Color.DarkTurquoise; base.create(); _world = new World(new Vector2(0, 0)); FlxCaveGeneratorExt caveExt = new FlxCaveGeneratorExt(20, 20, 0.49f, 1); string[,] caveLevel = caveExt.generateCaveLevel(); //Optional step to print cave to the console. //caveExt.printCave(caveLevel); tileGrp = new FlxGroup(); for (int i = 0; i < caveLevel.GetLength(1); i++) { for (int y = 0; y < caveLevel.GetLength(0); y++) { //string toPrint = tiles[y, i]; if (Convert.ToInt32(caveLevel[y, i]) != 0) { FarSprite x = new FarSprite(100 + (i * 10), 10 + (y * 10), _world); //x.createGraphic(8, 8, colors[Convert.ToInt32(caveLevel[y, i])]); x.loadGraphic("flixel/autotilesIsland", false, false, 8, 8); //x.color = colors[Convert.ToInt32(caveLevel[y, i])]; x._body.BodyType = BodyType.Dynamic; //_body.BodyType = BodyType.Dynamic; x.frame = Convert.ToInt32(caveLevel[y, i]); //x.scale = 2; //x.angularDrag = 250; // //x.setOffset(4, 4); tileGrp.add(x); } //Console.Write(toPrint); } //Console.WriteLine(); } //string newMap = caveExt.convertMultiArrayStringToString(caveLevel); add(tileGrp); m = new FlxSprite(0, 0); m.loadGraphic("flixel/cursor"); add(m); _ground = BodyFactory.CreateRectangle(_world, 2000, 20, 1.0f, new Vector2(0, 350), null); _ground.BodyType = BodyType.Static; //g1 = new FlxSprite(0, 340); //g1.loadGraphic("flixel/diagnostic/testpalette", true, false, 1000, 20); //add(g1); }
override public void create() { base.create(); Lemonade_Globals.totalCoins = Lemonade_Globals.calculateTotalCoins(); FlxTilemap bgMap = new FlxTilemap(); bgMap.auto = FlxTilemap.STRING; bgMap.indexOffset = -1; bgMap.loadTMXMap("Lemonade/levels/slf2/newyork/newyork_intro.tmx", "map", "bg", FlxXMLReader.TILES, FlxG.Content.Load <Texture2D>("Lemonade/bgtiles_newyork"), 20, 20); bgMap.boundingBoxOverride = false; bgMap.setScrollFactors(1, 1); add(bgMap); bgMap = new FlxTilemap(); bgMap.auto = FlxTilemap.STRING; bgMap.indexOffset = -1; bgMap.loadTMXMap("Lemonade/levels/slf2/newyork/newyork_intro.tmx", "map", "bg2", FlxXMLReader.TILES, FlxG.Content.Load <Texture2D>("Lemonade/bgtiles_newyork"), 20, 20); bgMap.boundingBoxOverride = false; bgMap.setScrollFactors(1, 1); add(bgMap); FlxTilemap bgMap3 = new FlxTilemap(); bgMap3.auto = FlxTilemap.STRING; bgMap3.indexOffset = -1; bgMap3.loadTMXMap("Lemonade/levels/slf2/newyork/newyork_intro.tmx", "map", "stars", FlxXMLReader.TILES, FlxG.Content.Load <Texture2D>("Lemonade/bgtiles_newyork"), 20, 20); bgMap3.boundingBoxOverride = false; bgMap3.setScrollFactors(0.5f, 0.5f); add(bgMap3); FlxTilemap bgMap4 = new FlxTilemap(); bgMap4.auto = FlxTilemap.STRING; bgMap4.indexOffset = -1; bgMap4.loadTMXMap("Lemonade/levels/slf2/newyork/newyork_intro.tmx", "map", "city", FlxXMLReader.TILES, FlxG.Content.Load <Texture2D>("Lemonade/bgtiles_newyork"), 20, 20); bgMap4.boundingBoxOverride = false; bgMap4.setScrollFactors(1, 1); add(bgMap4); follower = new FlxSprite(400, 1500); follower.visible = false; add(follower); follower.velocity.Y = this.speed; FlxG.follow(follower, 20.0f); FlxG.followBounds(0, 0, int.MaxValue, 2000); int textSize = 2; #if __ANDROID__ textSize = 4; #endif heading = new FlxText(0, 50, FlxG.width, "Collection Incomplete"); heading.setFormat(FlxG.Content.Load <SpriteFont>("Lemonade/SMALL_PIXEL"), textSize, Lemonade_Globals.GAMEBOY_COLOR_4, FlxJustification.Center, Lemonade_Globals.GAMEBOY_COLOR_1); heading.setScrollFactors(0, 0); add(heading); string howWellDidYouGo = "Collected " + Lemonade_Globals.coins.ToString() + "\nfrom " + Lemonade_Globals.totalCoins.ToString() + " Coins "; credits = new FlxText(0, FlxG.height / 1.75f, FlxG.width, howWellDidYouGo); credits.setFormat(FlxG.Content.Load <SpriteFont>("Lemonade/SMALL_PIXEL"), textSize, Lemonade_Globals.GAMEBOY_COLOR_4, FlxJustification.Center, Lemonade_Globals.GAMEBOY_COLOR_1); credits.setScrollFactors(0, 0); credits.visible = false; add(credits); string ins = "Press X to Continue"; #if __ANDROID__ ins = "Press O to Continue"; #endif instruction = new FlxText(0, FlxG.height / 1.3f, FlxG.width, ins); instruction.setFormat(FlxG.Content.Load <SpriteFont>("Lemonade/SMALL_PIXEL"), textSize, Lemonade_Globals.GAMEBOY_COLOR_4, FlxJustification.Center, Lemonade_Globals.GAMEBOY_COLOR_1); instruction.setScrollFactors(0, 0); instruction.visible = false; add(instruction); if (Lemonade_Globals.coins == Lemonade_Globals.totalCoins) { heading.setFormat(FlxG.Content.Load <SpriteFont>("Lemonade/SMALL_PIXEL"), textSize, Lemonade_Globals.GAMEBOY_COLOR_4, FlxJustification.Center, Lemonade_Globals.GAMEBOY_COLOR_1); heading.text = "Complete Collection!!\nThe Lemonade Factory is saved."; instruction.setFormat(FlxG.Content.Load <SpriteFont>("Lemonade/SMALL_PIXEL"), textSize, Lemonade_Globals.GAMEBOY_COLOR_4, FlxJustification.Center, Lemonade_Globals.GAMEBOY_COLOR_1); string ins2 = "Press X to Continue"; #if __ANDROID__ ins2 = "Press O to Continue"; #endif instruction.text = ins2; //FlxU.openURL("http://initials.itch.io/slf2/download/Y9wdBOHe7a92Qpo9t5UJdz05HhZR5p10F0L6wfdP"); } tween = new Tweener(FlxG.height / 1.3f, FlxG.height / 1.2f, TimeSpan.FromSeconds(0.67f), XNATweener.Cubic.EaseInOut); tween.PingPong = true; tween.Start(); // play some music FlxG.playMp3("Lemonade/music/March", 0.75f); rain = new FlxGroup(); for (int i = 0; i < 150; i++) { FlxSprite rainDrop = new FlxSprite((FlxU.random() * FlxG.width * 2), -200 + (FlxU.random() * 1000)); rainDrop.loadGraphic("Lemonade/rain", true, false, 2, 2); rainDrop.frame = (int)FlxU.random(0, 6); rainDrop.velocity.Y = FlxU.random(350, 400); rain.add(rainDrop); } add(rain); splashes = new FlxEmitter(); splashes.createSprites("Lemonade/rain", 150, true, 0.0f, 0.0f); splashes.setXSpeed(-25, 25); splashes.setYSpeed(-30, 0); splashes.gravity = 1.0f; add(splashes); }
public Hud(int xPos, int yPos) : base(xPos, yPos) { loadGraphic(FlxG.Content.Load <Texture2D>("Lemonade/currentChar"), true, false, 14, 28); setScrollFactors(0, 0); addAnimation("andre", new int[] { 2 }, 0, true); play("andre"); coin = new Coin(FlxG.width - 24, 2, true); coin.setScrollFactors(0, 0); coinCounter = new FlxText(FlxG.width - 36, 10, 100); coinCounter.setFormat(null, 1, Lemonade_Globals.GAMEBOY_COLOR_4, FlxJustification.Left, Lemonade_Globals.GAMEBOY_COLOR_1); coinCounter.alignment = FlxJustification.Left; coinCounter.setScrollFactors(0, 0); toastySprite = new FlxSprite(0, FlxG.height); string person = "Lemonade/illustration/andre_drawing"; int ran = (int)FlxU.random(0, 4); switch (ran) { case 0: person = "Lemonade/illustration/andre_drawing"; break; case 1: person = "Lemonade/illustration/liselot_drawing"; break; case 2: person = "Lemonade/illustration/army_drawing"; break; case 3: person = "Lemonade/illustration/worker_drawing"; break; default: person = "Lemonade/illustration/andre_drawing"; break; } toastySprite.loadGraphic(person, false, false, 302, 640); toastySprite.setScrollFactors(0, 0); tween = new Tweener(4, 12, 1, Quadratic.EaseInOut); tween.Start(); tween.PingPong = true; powerBar = new FlxGroup(); for (int i = 0; i < 30; i++) { int offsetY = 0; int offsetS = 0; #if __ANDROID__ offsetY = 50; offsetS = 150; #endif FlxSprite bar = new FlxSprite(offsetS + 5 + (i * 10), FlxG.height - 10 - offsetY); bar.createGraphic(8, 8, Lemonade_Globals.GAMEBOY_COLOR_4); bar.setScrollFactors(0, 0); powerBar.add(bar); } }
override public void create() { base.create(); Lemonade_Globals.totalCoins = Lemonade_Globals.calculateTotalCoins(); Console.WriteLine("Total coins = {0}", Lemonade_Globals.totalCoins); #if __ANDROID__ FlxG.BUILD_TYPE = FlxG.BUILD_TYPE_OUYA; #endif FlxTilemap bgMap = new FlxTilemap(); bgMap.auto = FlxTilemap.STRING; bgMap.indexOffset = -1; bgMap.loadTMXMap("Lemonade/levels/slf2/newyork/newyork_intro.tmx", "map", "bg", FlxXMLReader.TILES, FlxG.Content.Load <Texture2D>("Lemonade/bgtiles_newyork"), 20, 20); bgMap.boundingBoxOverride = false; bgMap.setScrollFactors(1, 1); add(bgMap); bgMap = new FlxTilemap(); bgMap.auto = FlxTilemap.STRING; bgMap.indexOffset = -1; bgMap.loadTMXMap("Lemonade/levels/slf2/newyork/newyork_intro.tmx", "map", "bg2", FlxXMLReader.TILES, FlxG.Content.Load <Texture2D>("Lemonade/bgtiles_newyork"), 20, 20); bgMap.boundingBoxOverride = false; bgMap.setScrollFactors(1, 1); add(bgMap); FlxTilemap bgMap3 = new FlxTilemap(); bgMap3.auto = FlxTilemap.STRING; bgMap3.indexOffset = -1; bgMap3.loadTMXMap("Lemonade/levels/slf2/newyork/newyork_intro.tmx", "map", "stars", FlxXMLReader.TILES, FlxG.Content.Load <Texture2D>("Lemonade/bgtiles_newyork"), 20, 20); bgMap3.boundingBoxOverride = false; bgMap3.setScrollFactors(0.5f, 0.5f); add(bgMap3); FlxTilemap bgMap4 = new FlxTilemap(); bgMap4.auto = FlxTilemap.STRING; bgMap4.indexOffset = -1; bgMap4.loadTMXMap("Lemonade/levels/slf2/newyork/newyork_intro.tmx", "map", "city", FlxXMLReader.TILES, FlxG.Content.Load <Texture2D>("Lemonade/bgtiles_newyork"), 20, 20); bgMap4.boundingBoxOverride = false; bgMap4.setScrollFactors(1, 1); add(bgMap4); follower = new FlxSprite(0, -100); follower.visible = false; add(follower); follower.velocity.Y = 450; FlxG.follow(follower, 20.0f); FlxG.followBounds(0, 0, int.MaxValue, 2000); FlxText text1 = new FlxText(0, FlxG.height / 2 - 50, FlxG.width, "Initials\nVideo\nGames\nPresents"); text1.setFormat(FlxG.Content.Load <SpriteFont>("Lemonade/SMALL_PIXEL"), 2, Lemonade_Globals.GAMEBOY_COLOR_4, FlxJustification.Center, Lemonade_Globals.GAMEBOY_COLOR_1); text1.setScrollFactors(1.5f, 1.5f); add(text1); credits = new FlxText(0, FlxG.height / 2 - 100, FlxG.width, "A Game by\nShane Brouwer"); credits.setFormat(FlxG.Content.Load <SpriteFont>("Lemonade/SMALL_PIXEL"), 2, Lemonade_Globals.GAMEBOY_COLOR_4, FlxJustification.Center, Lemonade_Globals.GAMEBOY_COLOR_1); credits.setScrollFactors(0, 0); credits.visible = false; add(credits); string ins = "Press X to Continue"; #if __ANDROID__ ins = "Press O to Continue"; #endif instruction = new FlxText(0, FlxG.height / 1.3f, FlxG.width, ins); instruction.setFormat(FlxG.Content.Load <SpriteFont>("Lemonade/SMALL_PIXEL"), 2, Lemonade_Globals.GAMEBOY_COLOR_4, FlxJustification.Center, Lemonade_Globals.GAMEBOY_COLOR_1); instruction.setScrollFactors(0, 0); instruction.visible = false; add(instruction); tween = new Tweener(FlxG.height / 1.3f, FlxG.height / 1.2f, TimeSpan.FromSeconds(0.67f), XNATweener.Cubic.EaseInOut); tween.PingPong = true; tween.Start(); // play some music FlxG.playMp3("Lemonade/music/Beyond", 0.75f); rain = new FlxGroup(); for (int i = 0; i < 150; i++) { FlxSprite rainDrop = new FlxSprite((FlxU.random() * FlxG.width), -200 + (FlxU.random() * 1000)); rainDrop.loadGraphic("Lemonade/rain", true, false, 2, 2); rainDrop.frame = (int)FlxU.random(0, 6); rainDrop.velocity.Y = FlxU.random(350, 400); rain.add(rainDrop); } add(rain); splashes = new FlxEmitter(); splashes.createSprites("Lemonade/rain", 150, true, 0.0f, 0.0f); splashes.setXSpeed(-25, 25); splashes.setYSpeed(-30, 0); splashes.gravity = 1.0f; add(splashes); }
public CarPark(int xPos, int yPos) : base(xPos, yPos) { loadGraphic("putt/carPark", true, false, 256, 224); _path = new FlxPath(); _path.add(0, 0); _path.add(13, 28); _path.add(39, 19); _path.add(63, 55); _path.add(84, 104); _path.add(83, 144); _path.add(103, 175); _path.add(105, 130); _path.add(110, 103); _path.add(132, 81); _path.add(156, 70); _path.add(165, 81); _path.add(173, 102); _path.add(176, 124); _path.add(179, 141); _path.add(181, 139); _path.add(186, 115); _path.add(201, 76); _path.add(225, 61); _path.add(800, 33); record = false; ball = new FlxSprite(0, 0); ball.loadGraphic("putt/ball_8x8", true, false, 8, 8); ball.frame = 2; ballPositionCounter = 0; ball.pathCornering = 100; ballPositions = new List <Vector2>(); ballPositions.Add(new Vector2(8, 31)); ballPositions.Add(new Vector2(8, 31)); ballPositions.Add(new Vector2(8, 31)); ballPositions.Add(new Vector2(7, 31)); ballPositions.Add(new Vector2(7, 31)); ballPositions.Add(new Vector2(7, 31)); ballPositions.Add(new Vector2(7, 31)); ballPositions.Add(new Vector2(7, 30)); ballPositions.Add(new Vector2(7, 29)); ballPositions.Add(new Vector2(11, 27)); ballPositions.Add(new Vector2(17, 24)); ballPositions.Add(new Vector2(20, 23)); ballPositions.Add(new Vector2(23, 22)); ballPositions.Add(new Vector2(27, 22)); ballPositions.Add(new Vector2(31, 23)); ballPositions.Add(new Vector2(37, 24)); ballPositions.Add(new Vector2(43, 26)); ballPositions.Add(new Vector2(48, 28)); ballPositions.Add(new Vector2(53, 30)); ballPositions.Add(new Vector2(58, 32)); ballPositions.Add(new Vector2(64, 36)); ballPositions.Add(new Vector2(73, 44)); ballPositions.Add(new Vector2(79, 49)); ballPositions.Add(new Vector2(86, 55)); ballPositions.Add(new Vector2(92, 62)); ballPositions.Add(new Vector2(97, 70)); ballPositions.Add(new Vector2(101, 80)); ballPositions.Add(new Vector2(107, 95)); ballPositions.Add(new Vector2(109, 106)); ballPositions.Add(new Vector2(113, 118)); ballPositions.Add(new Vector2(116, 130)); ballPositions.Add(new Vector2(121, 140)); ballPositions.Add(new Vector2(126, 149)); ballPositions.Add(new Vector2(132, 161)); ballPositions.Add(new Vector2(136, 167)); ballPositions.Add(new Vector2(138, 170)); ballPositions.Add(new Vector2(139, 172)); ballPositions.Add(new Vector2(139, 173)); ballPositions.Add(new Vector2(139, 169)); ballPositions.Add(new Vector2(137, 166)); ballPositions.Add(new Vector2(135, 161)); ballPositions.Add(new Vector2(134, 154)); ballPositions.Add(new Vector2(133, 146)); ballPositions.Add(new Vector2(132, 138)); ballPositions.Add(new Vector2(131, 125)); ballPositions.Add(new Vector2(130, 117)); ballPositions.Add(new Vector2(130, 108)); ballPositions.Add(new Vector2(130, 100)); ballPositions.Add(new Vector2(131, 92)); ballPositions.Add(new Vector2(137, 87)); ballPositions.Add(new Vector2(141, 80)); ballPositions.Add(new Vector2(144, 78)); ballPositions.Add(new Vector2(146, 77)); ballPositions.Add(new Vector2(149, 76)); ballPositions.Add(new Vector2(152, 76)); ballPositions.Add(new Vector2(156, 76)); ballPositions.Add(new Vector2(161, 78)); ballPositions.Add(new Vector2(163, 82)); ballPositions.Add(new Vector2(164, 88)); ballPositions.Add(new Vector2(165, 95)); ballPositions.Add(new Vector2(166, 103)); ballPositions.Add(new Vector2(166, 116)); ballPositions.Add(new Vector2(166, 123)); ballPositions.Add(new Vector2(168, 128)); ballPositions.Add(new Vector2(169, 130)); ballPositions.Add(new Vector2(171, 130)); ballPositions.Add(new Vector2(171, 130)); ballPositions.Add(new Vector2(172, 128)); ballPositions.Add(new Vector2(172, 122)); ballPositions.Add(new Vector2(173, 116)); ballPositions.Add(new Vector2(175, 110)); ballPositions.Add(new Vector2(177, 103)); ballPositions.Add(new Vector2(179, 96)); ballPositions.Add(new Vector2(182, 85)); ballPositions.Add(new Vector2(184, 79)); ballPositions.Add(new Vector2(186, 73)); ballPositions.Add(new Vector2(189, 67)); ballPositions.Add(new Vector2(192, 61)); ballPositions.Add(new Vector2(199, 54)); ballPositions.Add(new Vector2(201, 51)); ballPositions.Add(new Vector2(204, 48)); ballPositions.Add(new Vector2(207, 45)); ballPositions.Add(new Vector2(211, 44)); ballPositions.Add(new Vector2(213, 44)); ballPositions.Add(new Vector2(216, 44)); ballPositions.Add(new Vector2(220, 45)); ballPositions.Add(new Vector2(224, 49)); ballPositions.Add(new Vector2(227, 53)); ballPositions.Add(new Vector2(230, 60)); ballPositions.Add(new Vector2(232, 68)); ballPositions.Add(new Vector2(234, 75)); ballPositions.Add(new Vector2(235, 77)); ballPositions.Add(new Vector2(235, 77)); ballPositions.Add(new Vector2(235, 77)); ballPositions.Add(new Vector2(235, 75)); ballPositions.Add(new Vector2(235, 69)); ballPositions.Add(new Vector2(234, 62)); ballPositions.Add(new Vector2(233, 56)); ballPositions.Add(new Vector2(233, 50)); ballPositions.Add(new Vector2(235, 44)); ballPositions.Add(new Vector2(238, 37)); ballPositions.Add(new Vector2(243, 31)); ballPositions.Add(new Vector2(252, 21)); ballPositions.Add(new Vector2(262, 15)); ballPositions.Add(new Vector2(272, 10)); ballPositions.Add(new Vector2(280, 7)); ballPositions.Add(new Vector2(287, 5)); ballPositions.Add(new Vector2(292, 4)); ballPositionCounter = 0; }
override public void create() { base.create(); FlxG.setHudGamepadButton(FlxHud.TYPE_KEYBOARD, FlxHud.Keyboard_Arrow_Left, 10, 110); FlxG.setHudGamepadButton(FlxHud.TYPE_KEYBOARD_DIRECTION, FlxHud.Keyboard_Arrow_Right, 110, 110); FlxSprite bg = new FlxSprite(0, 0); bg.createGraphic(FlxG.width, FlxG.width, new Color(0.05f, 0.05f, 0.08f)); bg.setScrollFactors(0, 0); add(bg); stars = new FlxGroup(); // Make a starfield to fly through. for (int i = 0; i < 100; i++) { star = new FlxSprite(FlxU.random(0, FlxG.width), FlxU.random(0, FlxG.height)); star.createGraphic(3, 3, Color.White); star.velocity.Y = FlxU.random(20, 100); star.velocity.X = 0; stars.add(star); } add(stars); spaceShip = new FlxSprite(FlxG.width / 2, FlxG.height / 2); spaceShip.loadGraphic(FlxG.Content.Load <Texture2D>("flixel/surt/spaceship_32x32"), true, false, 32, 32); //Add some animations to our Spaceship spaceShip.addAnimation("static", new int[] { 0 }, 36, true); spaceShip.addAnimation("transform1", new int[] { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19 }, 12, false); spaceShip.addAnimation("transform2", new int[] { 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39 }, 12, false); spaceShip.addAnimation("transform3", new int[] { 40, 41, 42 }, 12, false); //spaceShip.addAnimation("transform", new int[] { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39}, 24, false); //spaceShip.addAnimation("reverse", new int[] { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39 }, 24, false); spaceShip.addAnimation("transform", spaceShip.generateFrameNumbersBetween(0, 39), 24, false); spaceShip.addAnimation("reverse", spaceShip.generateFrameNumbersBetween(39, 0), 24, false); spaceShip.play("static"); //Add an animation callback - This will call Pulse on every frame. spaceShip.addAnimationCallback(pulse); spaceShip.scale = 3; spaceShip.setDrags(1100, 1100); add(spaceShip); jets = new FlxEmitter(); jets.setSize(5, 50); jets.createSprites(FlxG.Content.Load <Texture2D>("flixel/diagnostic/testpalette"), 100, true, 0.0f, 0.0f); jets.setXSpeed(-110, 110); jets.setYSpeed(40, 80); add(jets); jets.at(spaceShip); }
override public void create() { base.create(); FlxG.resetHud(); String hudText = "Press \n"; hudText += "Q. Back \n"; hudText += "W. Bounce \n"; hudText += "E. Circular \n"; hudText += "R. Cubic \n"; hudText += "A. Elastic \n"; hudText += "S. Exponential \n"; hudText += "D. Linear \n"; hudText += "F. Quadratic \n"; hudText += "Z. Quartic \n"; hudText += "X. Quintic \n"; hudText += "C. Sinusoidal"; FlxG.setHudText(2, hudText); FlxG.mouse.hide(); //Define the time it takes to move the car across the screen. timeToMove = 2.5f; //Define the distance the car will move. driveDistance = 350; //Define the starting positions of the cars. car1Pos = new Vector2(20, 0); car2Pos = new Vector2(20, 50); car3Pos = new Vector2(20, 100); car4Pos = new Vector2(20, 150); car5Pos = new Vector2(20, 200); car6Pos = new Vector2(20, 250); redCarText = new FlxText(car1Pos.X, car1Pos.Y + 40, FlxG.width); redCarText.text = "Back.EaseInOut"; redCarText.setFormat(null, 1, Color.Red, FlxJustification.Left, Color.Black); add(redCarText); yellowCarText = new FlxText(car2Pos.X, car2Pos.Y + 40, FlxG.width); yellowCarText.text = "Bounce.EaseInOut"; yellowCarText.setFormat(null, 1, Color.Yellow, FlxJustification.Left, Color.Black); add(yellowCarText); greenCarText = new FlxText(car3Pos.X, car3Pos.Y + 40, FlxG.width); greenCarText.text = "Circular.EaseInOut"; greenCarText.setFormat(null, 1, Color.Green, FlxJustification.Left, Color.Black); add(greenCarText); blueCarText = new FlxText(car4Pos.X, car4Pos.Y + 40, FlxG.width); blueCarText.text = "Cubic.EaseInOut"; blueCarText.setFormat(null, 1, Color.Blue, FlxJustification.Left, Color.Black); add(blueCarText); purpleCarText = new FlxText(car5Pos.X, car5Pos.Y + 40, FlxG.width); purpleCarText.text = "Elastic.EaseInOut - Loop"; purpleCarText.setFormat(null, 1, Color.Purple, FlxJustification.Left, Color.Black); add(purpleCarText); lightGreenCarText = new FlxText(car6Pos.X, car6Pos.Y + 40, FlxG.width); lightGreenCarText.text = "Exponential.EaseInOut - Ping Pong"; lightGreenCarText.setFormat(null, 1, Color.LightGreen, FlxJustification.Left, Color.Black); add(lightGreenCarText); carsGroup = new FlxGroup(); add(carsGroup); redCar = new FlxSprite(car1Pos.X, car1Pos.Y); redCar.loadGraphic(FlxG.Content.Load <Texture2D>("flixel/surt/race_or_die"), true, false, 64, 64); redCar.addAnimation("Static", new int[] { 6 }, 0, true); redCar.play("Static"); redCar.angle = 180; carsGroup.add(redCar); redCarTween = new Tweener(car1Pos.X, driveDistance, TimeSpan.FromSeconds(timeToMove), Back.EaseInOut); redCarTween.Loop = true; redCarTween.Start(); yellowCar = new FlxSprite(car2Pos.X, car2Pos.Y); yellowCar.loadGraphic(FlxG.Content.Load <Texture2D>("flixel/surt/race_or_die"), true, false, 64, 64); yellowCar.addAnimation("Static", new int[] { 7 }, 0, true); yellowCar.play("Static"); yellowCar.angle = 180; carsGroup.add(yellowCar); yellowCarTween = new Tweener(car2Pos.X, driveDistance, TimeSpan.FromSeconds(timeToMove), Bounce.EaseInOut); yellowCarTween.Loop = true; greenCar = new FlxSprite(car3Pos.X, car3Pos.Y); greenCar.loadGraphic(FlxG.Content.Load <Texture2D>("flixel/surt/race_or_die"), true, false, 64, 64); greenCar.addAnimation("Static", new int[] { 8 }, 0, true); greenCar.play("Static"); greenCar.angle = 180; carsGroup.add(greenCar); greenCarTween = new Tweener(car3Pos.X, driveDistance, TimeSpan.FromSeconds(timeToMove), XNATweener.Circular.EaseInOut); greenCarTween.Loop = true; blueCar = new FlxSprite(car4Pos.X, car4Pos.Y); blueCar.loadGraphic(FlxG.Content.Load <Texture2D>("flixel/surt/race_or_die"), true, false, 64, 64); blueCar.addAnimation("Static", new int[] { 9 }, 0, true); blueCar.play("Static"); blueCar.angle = 180; carsGroup.add(blueCar); blueCarTween = new Tweener(car4Pos.X, driveDistance, TimeSpan.FromSeconds(timeToMove), XNATweener.Cubic.EaseInOut); blueCarTween.Loop = true; purpleCar = new FlxSprite(car5Pos.X, car5Pos.Y); purpleCar.loadGraphic(FlxG.Content.Load <Texture2D>("flixel/surt/race_or_die"), true, false, 64, 64); purpleCar.addAnimation("Static", new int[] { 10 }, 0, true); purpleCar.play("Static"); purpleCar.angle = 180; carsGroup.add(purpleCar); purpleCarTween = new Tweener(car5Pos.X, driveDistance, TimeSpan.FromSeconds(timeToMove), XNATweener.Elastic.EaseInOut); purpleCarTween.Loop = true; lightGreenCar = new FlxSprite(car6Pos.X, car6Pos.Y); lightGreenCar.loadGraphic(FlxG.Content.Load <Texture2D>("flixel/surt/race_or_die"), true, false, 64, 64); lightGreenCar.addAnimation("Static", new int[] { 11 }, 0, true); lightGreenCar.play("Static"); lightGreenCar.angle = 180; carsGroup.add(lightGreenCar); lightGreenCarTween = new Tweener(car6Pos.X, driveDistance, TimeSpan.FromSeconds(timeToMove), XNATweener.Exponential.EaseInOut); lightGreenCarTween.PingPong = true; Console.WriteLine(lightGreenCar.GetType().AssemblyQualifiedName); String myClass = "org.flixel.examples.CarSprite"; var type = Type.GetType(myClass); Console.WriteLine(type); var myObject = (FlxSprite)Activator.CreateInstance(type, 800, 400); //Console.WriteLine(myObject.GetType().AssemblyQualifiedName); //myObject.x = 300; //myObject.y = 300; add(myObject); }
override public void create() { base.create(); FlxG.resetHud(); makeCave(1.0f, Color.White); FlxSprite avatar = new FlxSprite(0, FlxG.height - 64); avatar.loadGraphic(FlxG.Content.Load <Texture2D>("flixel/surt/race_or_die"), true, false, 64, 64); avatar.addAnimation("Static", new int[] { 2 }, 0, true); avatar.play("Static"); avatar.setScrollFactors(0, 0); add(avatar); p = new FlxPath(null); addPathPointWithMarker(40.0f, 40.0f, 0); addPathPointWithMarker(522.67800098f, 342.106739267f, 1); addPathPointWithMarker(582.8467536f, 603.25142048f, 2); addPathPointWithMarker(531.13384868f, 263.27163512f, 3); addPathPointWithMarker(1447.02681801f, 449.15789055f, 4); addPathPointWithMarker(1201.74908191f, 528.33347167f, 5); addPathPointWithMarker(147.07640576f, 672.46462447f, 6); addPathPointWithMarker(199.62346884f, 584.58110087f, 7); addPathPointWithMarker(108.19931517f, 355.52333218f, 8); addPathPointWithMarker(698.584671041f, 174.70156601f, 9); for (int i = 0; i < 9; i++) { FlxLine line = new FlxLine(0, 0, new Vector2(p.nodes[i].X, p.nodes[i].Y), new Vector2(p.nodes[i + 1].X, p.nodes[i + 1].Y), Color.White, 2); add(line); } car = new FlxSprite(40, 40); car.loadGraphic(FlxG.Content.Load <Texture2D>("flixel/surt/race_or_die"), true, false, 64, 64); //car.addAnimation("Static", new int[] { 8 }, 0, true); //car.play("Static"); car.frame = 8; car.setDrags(5, 5); add(car); car.path = p; car.pathCornering = 5.0f; car.pathAngleOffset = 180; //car.pathSpeed = 500.0f; car.followPath(p, 250.0f, FlxSprite.PATH_LOOP_FORWARD, true); FlxG.follow(car, 5.0f); FlxG.followBounds(0, 0, 100 * 16, 100 * 16); for (int i = 0; i < 7; i++) { p = new FlxPath(null); p.add(40.0f, 40.0f); p.add(522.67800098f + FlxU.random(1, 100), 342.106739267f + FlxU.random(1, 100)); p.add(582.8467536f, 603.25142048f + FlxU.random(1, 1200)); p.add(531.13384868f, 263.27163512f + FlxU.random(1, 1200)); p.add(1447.02681801f, 449.15789055f + FlxU.random(1, 1200)); p.add(1201.74908191f, 528.33347167f + FlxU.random(1, 1200)); p.add(147.07640576f, 672.46462447f + FlxU.random(1, 1200)); p.add(199.62346884f, 584.58110087f + FlxU.random(1, 1200)); p.add(108.19931517f, 355.52333218f + FlxU.random(1, 1200)); p.add(698.584671041f, 174.70156601f + FlxU.random(1, 2100)); car = new FlxSprite(40, 40); car.loadGraphic(FlxG.Content.Load <Texture2D>("flixel/surt/race_or_die"), true, false, 64, 64); //car.addAnimation("Static", new int[] { 8 }, 0, true); //car.play("Static"); car.frame = 6 + i; car.setDrags(5, 5); add(car); car.path = p; car.pathCornering = 5.0f; car.pathAngleOffset = 180; //car.pathSpeed = 500.0f; car.followPath(p, 50.0f + (i * 30), FlxSprite.PATH_LOOP_FORWARD, true); } }
override public void create() { base.create(); FlxG.playMp3("Lemonade/music/AmbulanceCalls", 0.5f); block = new FlxTileblock(0, 0, FlxG.width + 20, FlxG.height + 20); block.auto = FlxTileblock.FRAMENUMBER; block.frameNumber = 6; block.setScrollFactors(0, 0); block.loadTiles(FlxG.Content.Load <Texture2D>("Lemonade/fade"), 20, 20, 0); add(block); icons = new FlxGroup(); tweeners = new List <Vector3Tweener>(); for (int i = 0; i < 6; i++) { int offsetX = 75; int offsetY = 0; int offsetY2 = 0; #if __ANDROID__ offsetX = 400; offsetY = 100; offsetY2 = 120; #endif FlxSprite p1 = new FlxSprite(0 + (i * 36) + offsetX, 12); p1.loadGraphic("Lemonade/illustration/people", true, false, 302, 640); p1.frame = i; icons.add(p1); tweeners.Add(new Vector3Tweener(new Vector3(-100 + (i * 36) + offsetX, -290 + offsetY2, 0.1f), new Vector3(12 + offsetY + offsetX, 100, 1), 0.45f, Bounce.EaseOut)); } foreach (var item in tweeners) { item.Pause(); } add(icons); switch (Lemonade_Globals.location) { case "warehouse": selected = 0; break; case "military": selected = 1; break; case "newyork": selected = 2; break; case "sydney": selected = 3; break; case "management": selected = 4; break; case "factory": selected = 5; break; default: selected = 0; break; } tweeners[selected].Play(); timer = 5.0f; t1 = new FlxText(0, FlxG.height - 72, FlxG.width); t1.setFormat(null, 2, Lemonade_Globals.GAMEBOY_COLOR_1, FlxJustification.Center, Lemonade_Globals.GAMEBOY_COLOR_4); add(t1); t2 = new FlxText(0, 3, FlxG.width); t2.setFormat(null, 2, Lemonade_Globals.GAMEBOY_COLOR_1, FlxJustification.Center, Lemonade_Globals.GAMEBOY_COLOR_4); add(t2); }
override public void create() { base.create(); rollIndicators = new FlxGroup(); framesElapsed = 0; selected = 0; suggestionForClubNoted = false; suggestionForForceNoted = false; suggestionForClubStatus = 0; suggestionForForceStatus = 0; selectedClub = 0; playAgainSelected = 0; Globals.ballInHole = false; //"Sand Wedge" } clubs = new List <string> { "Putter", "1 Wood", "3 Wood", "5 Wood", "1 Iron", "2 Iron", "3 Iron", "4 Iron", "5 Iron", "6 Iron", "7 Iron", "8 Iron", "9 Iron" }; //, "Chip Shot", "Pitch", "Fade", "Draw", "Lay-up", "Knock Down", "Flop" force = new List <string> { "Feather Touch", "Firm Putt", "Power Drive" }; playAgain = new List <string> { "Yes", "No", "Skip Hole +9" }; game = new FlxSprite(0, 0); game.loadGraphic("putt/bg", true, false, 256, 224); game.boundingBoxOverride = false; add(game); ball = new Ball(FlxG.width / 2 - 8, FlxG.height - 24); hole = new Hole(FlxG.width / 2, FlxG.height / 2); // load the level. loadOgmo(); add(hole); add(ball); lee = new Lee(FlxG.width / 6, FlxG.height - 170); add(lee); aim = new Aim(1, FlxG.height / 2); aim.y = hole.y - aim.width; add(aim); power = new FlxBar(FlxG.width - 110, FlxG.height - 30, FlxBar.FILL_LEFT_TO_RIGHT, 80, 8, null, "", 0, 50, true); add(power); power.visible = false; power.useCustomColors = true; sound = new FlxSound(); sound.loadEmbedded(Globals.ContentFolder + "/sfx/welcome", false); if (Globals.hole == 1) { sound.play(); } actionButton = new ActionButton(FlxG.width - 40, FlxG.height - 40); actionButton.visible = false; add(actionButton); if (FlxG.debug && Globals.platform == "Touch") { FlxG.mouse.show(); } if (Globals.platform == "Touch") { actionButton.visible = true; } add(rollIndicators); carPark = new CarPark(0, 0); carPark.visible = false; add(carPark); text = new FlxText(22, 16, 200); text.setFormat(FlxG.Content.Load <SpriteFont>("flixel/initials/SMALL_PIXEL"), 1, Color.Yellow, FlxJustification.Left, Color.Black); add(text); subtitle = new FlxText(22, 2, FlxG.width); subtitle.setFormat(FlxG.Content.Load <SpriteFont>("flixel/initials/SMALL_PIXEL"), 1, Color.White, FlxJustification.Left, Color.Black); add(subtitle); activator = new Carrot((int)text.x - 11, (int)text.y); //activator.createGraphic(8, 8, Color.Violet); activator.visible = false; add(activator); log("Welcome to " + Globals.GameNameSplit); if (Globals.pirate && Globals.hole >= 4) { #if !__IOS__ FlxU.openURL("http://initialsgames.com/"); FlxG.Game.Exit(); #endif } }
override public void create() { base.create(); // play some music FlxG.playMp3("Lemonade/music/music_menu_1", 0.75f); // load some tile maps List <Dictionary <string, string> > bgString = FlxXMLReader.readNodesFromTmxFile("Lemonade/levels/slf2/newyork/bgnewyork.tmx", "map", "bg", FlxXMLReader.TILES); ny = new FlxTilemap(); ny.auto = FlxTilemap.STRING; ny.indexOffset = -1; ny.loadMap(bgString[0]["csvData"], FlxG.Content.Load <Texture2D>("Lemonade/bgtiles_newyork"), 20, 20); ny.boundingBoxOverride = true; ny.setScrollFactors(0, 0); ny.visible = false; add(ny); bgString = FlxXMLReader.readNodesFromTmxFile("Lemonade/levels/slf2/sydney/bgsydney.tmx", "map", "bg", FlxXMLReader.TILES); sydney = new FlxTilemap(); sydney.auto = FlxTilemap.STRING; sydney.indexOffset = -1; sydney.loadMap(bgString[0]["csvData"], FlxG.Content.Load <Texture2D>("Lemonade/bgtiles_sydney"), 20, 20); sydney.boundingBoxOverride = true; sydney.setScrollFactors(0, 0); sydney.visible = false; add(sydney); bgString = FlxXMLReader.readNodesFromTmxFile("Lemonade/levels/slf2/military/bgmilitary.tmx", "map", "bg", FlxXMLReader.TILES); miltary = new FlxTilemap(); miltary.auto = FlxTilemap.STRING; miltary.indexOffset = -1; miltary.loadMap(bgString[0]["csvData"], FlxG.Content.Load <Texture2D>("Lemonade/bgtiles_military"), 20, 20); miltary.boundingBoxOverride = true; miltary.setScrollFactors(0, 0); miltary.visible = false; add(miltary); //FlxG.mouse.show(FlxG.Content.Load<Texture2D>("Mode/cursor")); FlxButton b = new FlxButton((FlxG.width / 2) - 100, 150, startGame); b.loadGraphic(new FlxSprite().loadGraphic(FlxG.Content.Load <Texture2D>("Lemonade/button_ny")), new FlxSprite().loadGraphic(FlxG.Content.Load <Texture2D>("Lemonade/buttonPressed_ny"))); b.loadText(new FlxText(-20, 10, 100, "Sydney"), new FlxText(-20, 10, 100, "Sydney!")); buttons.add(b); b = new FlxButton(FlxG.width / 2, 150, startGame); b.loadGraphic(new FlxSprite().loadGraphic(FlxG.Content.Load <Texture2D>("Lemonade/button_ny")), new FlxSprite().loadGraphic(FlxG.Content.Load <Texture2D>("Lemonade/buttonPressed_ny"))); b.loadText(new FlxText(-20, 10, 100, "New York"), new FlxText(-20, 10, 100, "New York!")); buttons.add(b); b = new FlxButton((FlxG.width / 2) + 100, 150, startGame); b.loadGraphic(new FlxSprite().loadGraphic(FlxG.Content.Load <Texture2D>("Lemonade/button_ny")), new FlxSprite().loadGraphic(FlxG.Content.Load <Texture2D>("Lemonade/buttonPressed_ny"))); b.loadText(new FlxText(-20, 10, 100, "Military"), new FlxText(-20, 10, 100, "Military!")); buttons.add(b); for (int i = 1; i < 13; i++) { FlxButton a = new FlxButton(175 + (i * 45), 225, startGame); a.loadGraphic(new FlxSprite().loadGraphic(FlxG.Content.Load <Texture2D>("Lemonade/button_ny")), new FlxSprite().loadGraphic(FlxG.Content.Load <Texture2D>("Lemonade/buttonPressed_ny"))); a.loadText(new FlxText(-40, 10, 100, i.ToString()), new FlxText(-40, 10, 100, i.ToString() + "!")); buttons.add(a); } b = new FlxButton((FlxG.width / 2) - 100, 275, startMultiplayerGame); b.loadGraphic(new FlxSprite().loadGraphic(FlxG.Content.Load <Texture2D>("Lemonade/button_ny")), new FlxSprite().loadGraphic(FlxG.Content.Load <Texture2D>("Lemonade/buttonPressed_ny"))); b.loadText(new FlxText(-20, 10, 100, "Multiplayer"), new FlxText(-20, 10, 100, "Multiplayer!")); buttons.add(b); location = new FlxText(0, 50, FlxG.width); location.setFormat(FlxG.Content.Load <SpriteFont>("Lemonade/SMALL_PIXEL"), 3, Color.White, FlxJustification.Center, Color.Black); location.text = ""; add(location); addButtons(); FlxText badges = new FlxText(0, 330, 0, "Badges"); badges.setFormat(FlxG.Content.Load <SpriteFont>("Lemonade/SMALL_PIXEL"), 3, Color.White, FlxJustification.Left, Color.Black); add(badges); Color notDone = new Color(0.1f, 0.1f, 0.1f); badge1 = new FlxSprite((FlxG.width / 2) - 150, 330); badge1.loadGraphic(FlxG.Content.Load <Texture2D>("Lemonade/offscreenIcons"), true, false, 12, 12); badge1.frame = 2; badge1.color = notDone; add(badge1); badge2 = new FlxSprite((FlxG.width / 2) - 50, 330); badge2.loadGraphic(FlxG.Content.Load <Texture2D>("Lemonade/offscreenIcons"), true, false, 12, 12); badge2.frame = 3; badge2.color = notDone; add(badge2); badge3 = new FlxSprite((FlxG.width / 2) + 50, 330); badge3.loadGraphic(FlxG.Content.Load <Texture2D>("Lemonade/offscreenIcons"), true, false, 12, 12); badge3.frame = 4; badge3.color = notDone; add(badge3); badge4 = new FlxSprite((FlxG.width / 2) + 150, 330); badge4.loadGraphic(FlxG.Content.Load <Texture2D>("Lemonade/offscreenIcons"), true, false, 12, 12); badge4.frame = 5; badge4.color = notDone; add(badge4); tweenBounce = new Tweener(5.0f, 8.0f, TimeSpan.FromSeconds(1.12f), Elastic.EaseOut); tweenBounce.PingPong = true; try { FlxG.username = LoadFromDevice(); } catch { Console.WriteLine("Cannot load name from file"); } if (FlxG.username != "") { //_nameEntry.text = FlxG.username; FlxG.setHudText(3, "Username:\n" + FlxG.username); FlxG.setHudTextPosition(3, 50, FlxG.height - 30); FlxG.setHudTextScale(3, 2); } }
override public void create() { FlxG.resetHud(); FlxG.hideHud(); FlxG.backColor = FlxColor.ToColor("#3cbcfc"); base.create(); FlxCaveGeneratorExt caveExt = new FlxCaveGeneratorExt(40, 40, 0.514f, 2); string[,] caveLevel = caveExt.generateCaveLevel(); //Optional step to print cave to the console. //caveExt.printCave(caveLevel); #region color Color[] colors = new Color[] { FlxColor.ToColor("#7C7C7C"), FlxColor.ToColor("#0000FC"), FlxColor.ToColor("#0000BC"), FlxColor.ToColor("#4428BC"), FlxColor.ToColor("#940084"), FlxColor.ToColor("#A80020"), FlxColor.ToColor("#A81000"), FlxColor.ToColor("#881400"), FlxColor.ToColor("#503000"), FlxColor.ToColor("#007800"), FlxColor.ToColor("#006800"), FlxColor.ToColor("#005800"), FlxColor.ToColor("#004058"), FlxColor.ToColor("#000000"), FlxColor.ToColor("#000000"), FlxColor.ToColor("#000000"), FlxColor.ToColor("#BCBCBC"), FlxColor.ToColor("#0078F8"), FlxColor.ToColor("#0058F8"), FlxColor.ToColor("#6844FC"), FlxColor.ToColor("#D800CC"), FlxColor.ToColor("#E40058"), FlxColor.ToColor("#F83800"), FlxColor.ToColor("#E45C10"), FlxColor.ToColor("#AC7C00"), FlxColor.ToColor("#00B800"), FlxColor.ToColor("#00A800"), FlxColor.ToColor("#00A844"), FlxColor.ToColor("#008888"), FlxColor.ToColor("#000000"), FlxColor.ToColor("#000000"), FlxColor.ToColor("#000000"), FlxColor.ToColor("#F8F8F8"), FlxColor.ToColor("#3CBCFC"), FlxColor.ToColor("#6888FC"), FlxColor.ToColor("#9878F8"), FlxColor.ToColor("#F878F8"), FlxColor.ToColor("#F85898"), FlxColor.ToColor("#F87858"), FlxColor.ToColor("#FCA044"), FlxColor.ToColor("#F8B800"), FlxColor.ToColor("#B8F818"), FlxColor.ToColor("#58D854"), FlxColor.ToColor("#58F898"), FlxColor.ToColor("#00E8D8"), FlxColor.ToColor("#787878"), FlxColor.ToColor("#000000"), FlxColor.ToColor("#000000"), FlxColor.ToColor("#FCFCFC"), FlxColor.ToColor("#A4E4FC"), FlxColor.ToColor("#B8B8F8"), FlxColor.ToColor("#D8B8F8"), FlxColor.ToColor("#F8B8F8"), FlxColor.ToColor("#F8A4C0"), FlxColor.ToColor("#F0D0B0"), FlxColor.ToColor("#FCE0A8"), FlxColor.ToColor("#F8D878"), FlxColor.ToColor("#D8F878"), FlxColor.ToColor("#B8F8B8"), FlxColor.ToColor("#B8F8D8"), FlxColor.ToColor("#00FCFC"), FlxColor.ToColor("#F8D8F8"), FlxColor.ToColor("#000000"), FlxColor.ToColor("#000000") }; #endregion tileGrp = new FlxGroup(); waterGrp = new FlxGroup(); pellets = new FlxGroup(); Vector2 startPos = new Vector2(0, 0); for (int i = 0; i < caveLevel.GetLength(1); i++) { for (int y = 0; y < caveLevel.GetLength(0); y++) { //string toPrint = tiles[y, i]; if (Convert.ToInt32(caveLevel[y, i]) != 0) { if (startPos.X == 0) { startPos = new Vector2(i * 8, y * 8); } FlxSprite x = new FlxSprite(i * 8, y * 8); //x.createGraphic(8, 8, colors[Convert.ToInt32(caveLevel[y, i])]); x.loadGraphic("autotilesIsland", false, false, 8, 8); //x.color = colors[Convert.ToInt32(caveLevel[y, i])]; x.frame = Convert.ToInt32(caveLevel[y, i]); //x.scale = 2; //x.angularDrag = 250; //x.setOffset(4, 4); tileGrp.add(x); if (FlxU.random() < 0.02f) { FlxSprite xx = new FlxSprite(i * 8, y * 8); xx.createGraphic(8, 8, Color.Red); pellets.add(xx); } } else { FlxSprite x = new FlxSprite(i * 8, y * 8); x.loadGraphic("water", false, false, 8, 8); x.addAnimation("flow", new int[] { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 }, (int)FlxU.random(1, 7), true); x.play("flow"); waterGrp.add(x); } //Console.Write(toPrint); } //Console.WriteLine(); } //string newMap = caveExt.convertMultiArrayStringToString(caveLevel); add(tileGrp); add(waterGrp); add(pellets); //m = new FlxSprite(0, 0); //m.loadGraphic("flixel/cursor"); //add(m); shadow = new FlxSprite(startPos.X, startPos.Y); shadow.createGraphic(8, 8, Color.Black); shadow.debugName = "onground"; shadow.alpha = 0.5f; add(shadow); player = new FlxSprite(startPos.X, startPos.Y); player.createGraphic(8, 8, colors[12]); add(player); //FlxG.showHud(); FlxG.follow(shadow, 20.0f); FlxG.followBounds(0, 0, 320, 320); }
override public void create() { FlxG.resetHud(); FlxG.hideHud(); FlxG.backColor = Color.DarkTurquoise; base.create(); FlxCaveGeneratorExt caveExt = new FlxCaveGeneratorExt(80, 120, 0.49f, 1); string[,] caveLevel = caveExt.generateCaveLevel(); //Optional step to print cave to the console. //caveExt.printCave(caveLevel); Color[] colors = new Color[] { Color.Aqua, Color.ForestGreen, Color.Yellow, Color.Yellow, Color.Yellow, Color.Yellow, Color.Yellow, Color.Yellow, Color.Yellow, Color.Yellow, Color.Yellow, Color.Yellow, Color.Yellow, Color.Yellow, Color.Yellow, Color.Green, Color.Yellow, Color.Yellow, Color.Yellow, Color.Yellow, Color.Yellow, Color.Yellow, Color.Yellow, Color.Yellow, Color.Yellow, Color.Yellow, Color.Yellow, Color.Yellow, Color.Yellow, Color.Yellow, Color.Yellow, Color.Yellow, Color.Yellow, Color.Yellow, Color.Yellow, Color.Yellow, Color.Yellow, Color.Yellow, Color.Yellow, Color.Yellow, Color.Yellow, Color.Yellow, Color.Yellow, Color.Yellow, Color.Yellow, Color.Yellow, Color.Yellow, Color.Yellow, Color.Yellow, Color.Yellow, Color.Yellow, Color.Yellow, Color.Yellow, Color.Yellow, Color.Yellow, Color.Yellow, Color.Yellow, Color.Yellow, Color.Yellow, Color.Yellow, Color.Yellow, Color.Yellow, Color.Yellow, Color.Yellow, Color.Yellow, Color.Yellow, Color.Yellow, Color.Yellow, Color.Yellow, Color.Yellow, Color.Yellow, Color.Yellow }; tileGrp = new FlxGroup(); for (int i = 0; i < caveLevel.GetLength(1); i++) { for (int y = 0; y < caveLevel.GetLength(0); y++) { //string toPrint = tiles[y, i]; if (Convert.ToInt32(caveLevel[y, i]) != 0) { FlxSprite x = new FlxSprite(i * 8, y * 8); //x.createGraphic(8, 8, colors[Convert.ToInt32(caveLevel[y, i])]); x.loadGraphic("flixel/autotilesIsland", false, false, 8, 8); //x.color = colors[Convert.ToInt32(caveLevel[y, i])]; x.frame = Convert.ToInt32(caveLevel[y, i]); //x.scale = 2; x.angularDrag = 250; x.setOffset(4, 4); tileGrp.add(x); } //Console.Write(toPrint); } //Console.WriteLine(); } //string newMap = caveExt.convertMultiArrayStringToString(caveLevel); add(tileGrp); m = new FlxSprite(0, 0); m.loadGraphic("flixel/cursor"); add(m); }
override public void create() { FlxG.resetHud(); FlxG.hideHud(); FlxG.backColor = Color.DarkTurquoise; base.create(); FlxCaveGeneratorExt caveExt = new FlxCaveGeneratorExt(100, 60, 0.42f, 3); string[,] caveLevel = caveExt.generateCaveLevel(); tileGrp = new FlxGroup(); for (int i = 0; i < caveLevel.GetLength(1); i++) { for (int y = 0; y < caveLevel.GetLength(0); y++) { //string toPrint = tiles[y, i]; if (Convert.ToInt32(caveLevel[y, i]) != 0) { FlxSprite x = new FlxSprite(i * 8, y * 8); //x.createGraphic(8, 8, colors[Convert.ToInt32(caveLevel[y, i])]); x.loadGraphic("flixel/autotilesIsland", false, false, 8, 8); //x.color = colors[Convert.ToInt32(caveLevel[y, i])]; x.frame = Convert.ToInt32(caveLevel[y, i]); //x.scale = 2; x.angularDrag = 250; //x.setOffset(4, 4); x.@fixed = true; tileGrp.add(x); } //Console.Write(toPrint); } //Console.WriteLine(); } //string newMap = caveExt.convertMultiArrayStringToString(caveLevel); add(tileGrp); boats = new FlxGroup(); for (int i = 0; i < 20; i++) { Boat b = new Boat((int)FlxU.random(0, FlxG.width), (int)FlxU.random(0, FlxG.height)); b.velocity.X = FlxU.random(-40, 40); b.velocity.Y = FlxU.random(-40, 40); boats.add(b); } add(boats); }