public void addPathPointWithMarker(float xPos, float yPos, int MarkerNumber) { p.add(xPos, yPos); FlxText t = new FlxText(xPos, yPos, 100); t.alignment = FlxJustification.Left; t.text = MarkerNumber.ToString(); t.setScrollFactors(1, 1); add(t); }
override public void create() { base.create(); FlxG.mouse.show(FlxG.Content.Load <Texture2D>("flixel/cursor")); mouseInfo = new FlxText(1, 1, 100); mouseInfo.text = "Info:"; mouseInfo.alignment = FlxJustification.Left; mouseInfo.setScrollFactors(1, 1); add(mouseInfo); FlxG.resetHud(); string textInfo = ""; textInfo = "Choose:\n"; textInfo += "1. Cheat State\n"; textInfo += "2. Cave State\n"; textInfo += "3. Race Or Die\n"; textInfo += "4. Tweens\n"; textInfo += "5. Robot Football\n"; textInfo += "6. Animation Callbacks\n"; textInfo += "7. FlxPath \n"; textInfo += "8. Physics \n"; textInfo += "9. Angle And Velocity\n"; textInfo += "F2. Physics 2\n"; textInfo += "F3. Island \n"; textInfo += "F4. Island 2 \n"; textInfo += "F5. Physics Hockey \n"; textInfo += "F6. FlxBar \n"; textInfo += "F7. Scrolling Test \n"; textInfo += "Q. Garbage Tests \n"; FlxG.setHudText(1, textInfo); FlxG.setHudTextPosition(1, 50, 20); FlxG.setHudTextScale(1, 2); FlxG.setHudGamepadButton(FlxHud.TYPE_KEYBOARD, FlxHud.Keyboard_1, FlxG.width - 120, 30); FlxG.showHud(); /* * FlxSprite logo = new FlxSprite(12, 12); * logo.loadGraphic("flixel/surt/race_or_die", true, false, 64, 64); * logo.addAnimation("Static", new int[] { 8 }, 0, true); * logo.play("Static"); * logo.setDrags(5, 5); * add(logo); */ }
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(); 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); }
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); }
override public void create() { base.create(); #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 = 1450; follower.drag.Y = 10; FlxG.follow(follower, 20.0f); FlxG.followBounds(0, 0, int.MaxValue, 2000); FlxText text1 = new FlxText(0, FlxG.height / 2 - 50, FlxG.width, "GAME OVER"); 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); string howWellDidYouGo = "Collected " + Lemonade_Globals.coins.ToString() + " from " + Lemonade_Globals.totalCoins.ToString() + " Coins "; credits = new FlxText(0, FlxG.height / 2 - 100, FlxG.width, ""); 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 = true; 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 = true; add(instruction); //rgb(237, 0, 142) tween = new Tweener(FlxG.height / 1.3f, FlxG.height / 1.2f, TimeSpan.FromSeconds(1.0f), XNATweener.Cubic.EaseInOut); tween.PingPong = true; tween.Start(); // play some music FlxG.playMp3("Lemonade/music/Lemonade1989Theme", 0.75f); FlxG.play("Lemonade/sfx/cw_sound15", 0.5f, false); }