override public void create() { base.create(); FlxG.hideHud(); FlxG.resetHud(); robot = new FlxSprite(60, 60); robot.loadGraphic("flixel/surt/race_or_die", true, false, 64, 64); robot.addAnimation("static", new int[] { 0 }, 12, true); robot.play("static"); robot.angle = 0; robot.width = 32; robot.height = 32; robot.setOffset(12, 12); robot.health = 100; robot.alpha = 0.1f; add(robot); bar = new FlxBar(30, 30, FlxBar.FILL_LEFT_TO_RIGHT, 100, 10, robot, "rad", 0, 100, true); add(bar); bar2 = new FlxBar(60, 90, FlxBar.FILL_LEFT_TO_RIGHT, 20, 2, null, "health", 0, 100, false); bar2.loadCustomEmptyGraphic("flixel/initials/healthBar"); bar2.emptyBar.offset.X = 2; bar2.emptyBar.offset.Y = 3; add(bar2); }
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); }