override public void create() { base.create(); FlxG.resetHud(); FlxG.hideHud(); _world.Gravity.Y = 0; team1 = new FlxGroup(); team2 = new FlxGroup(); puck = new FarSprite(FlxG.width / 2, FlxG.height / 2, _world); puck.createGraphic(20, 20, Color.Green); puck.attachCircle(20, 20); add(puck); puck._body.ApplyLinearImpulse(new Vector2(FlxU.random(-15000, 15000), FlxU.random(-15000, 15000))); for (int i = 0; i < 6; i++) { FarSprite p1 = new FarSprite(i * 80, (int)FlxU.random(0, FlxG.height), _world); p1.createGraphic(4, 40, Color.Red); p1.attachRectangle(4, 40); team1.add(p1); } add(team1); add(team2); }
override public void update() { m.x = FlxG.mouse.x; m.y = FlxG.mouse.y; FlxU.overlap(tileGrp, m, scaleUp); base.update(); for (int i = 0; i < 4; i++) { int f = (int)FlxU.random(1, tileGrp.members.Count - 1); if (((FlxSprite)(tileGrp.members[f])).frame > 14) { ((FlxSprite)(tileGrp.members[f])).scale = 0.1f; } } foreach (FlxSprite item in tileGrp.members) { if (item.scale < 1) { item.scale += 0.02f; item.color = Color.Red; } else if (item.scale > 1) { item.color = Color.White; item.scale = 1; } } }
public Coin(int xPos, int yPos, bool Outline) : base(xPos, yPos) { if (Outline) { loadGraphic("Lemonade/GoldCoinGameboyWithOutline", true, false, 32, 32); } else { loadGraphic("Lemonade/GoldCoinGameboy", true, false, 32, 32); } addAnimation("animation", new int[] { 0, 1, 2, 3, 4, 5, 6, 7, 8, 4 }, (int)FlxU.random(4, 8), true); play("animation"); width = 16; height = 16; setOffset(8, 8); fanfare = new FlxEmitter(); fanfare.createSprites("Lemonade/bubble", 8, true, 0.0f, 0.0f); fanfare.setXSpeed(-100, 100); fanfare.setYSpeed(-100, 100); fanfare.gravity = 5; fanfare.delay = 3.0f; tween = new XNATweener.Tweener(-25, 25, FlxU.random(0.8f, 1.2f), XNATweener.Quadratic.EaseInOut); tween.PingPong = true; tween.Start(); }
protected bool overlapped(object Sender, FlxSpriteCollisionEvent e) { //you can fire functions on each object. //((FlxObject)(e.Object1)).overlapped(e.Object2); //((FlxObject)(e.Object2)).overlapped(e.Object1); //if (e.Object1.dead == false && e.Object2.dead == false) //{ // if (Math.Abs(e.Object1.velocity.Y) > Math.Abs(e.Object2.velocity.Y)) // { // e.Object2.kill(); // } // else if (Math.Abs(e.Object2.velocity.Y) < Math.Abs(e.Object1.velocity.Y)) // { // e.Object1.kill(); // } //} if (FlxU.random() < 0.5f) { e.Object2.kill(); } else { e.Object1.kill(); } return(true); }
override public void create() { FlxG.resetHud(); FlxG.showHud(); FlxG.backColor = Color.LightGray; base.create(); string levelData = FlxU.randomString(10); FlxG.log("levelData: " + levelData); makeCave(0.1f, Color.Black); makeCave(0.5f, new Color(0.98f, 1.0f, 0.95f)); makeCave2(1.0f, Color.Green); spaceShip = new FlxSprite(60, 60); spaceShip.loadGraphic(FlxG.Content.Load <Texture2D>("flixel/surt/spaceship_32x32"), true, false, 32, 32); spaceShip.addAnimation("Static", new int[] { 0 }, 36, true); 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 }, 36, false); spaceShip.play("Static"); spaceShip.setDrags(1100, 1100); add(spaceShip); FlxG.follow(spaceShip, 10.0f); FlxG.followBounds(0, 0, 50 * 16, 40 * 16); }
override public void create() { base.create(); //FlxG.hideHud(); FlxG.resetHud(); _world = new World(new Vector2(0, 980.0f)); _ground = BodyFactory.CreateRectangle(_world, 3000, 20, 1.0f, new Vector2(0, 700), null); _ground.BodyType = BodyType.Static; g1 = new FlxSprite(0, 700); g1.loadGraphic("flixel/diagnostic/testpalette", true, false, 1000, 20); add(g1); for (int i = 0; i < 40; i++) { FarSprite f = new FarSprite(Convert.ToInt32(FlxU.random(90, 800)), Convert.ToInt32(FlxU.random(-600, 0)), _world); f.loadGraphic("flixel/initials/crate_80x60", true, false, FlxU.randomInt(20, 40), FlxU.randomInt(40, 60)); f._body.AngularVelocity = FlxU.randomInt(0, 5); add(f); } List <Dictionary <string, string> > completeSet = new List <Dictionary <string, string> >(); string currentLevel = "l" + FlxG.level.ToString(); XDocument xdoc = XDocument.Load("Content/flixel/ogmo/PhysicsLevel.oel"); // Load level main stats. XElement xelement = XElement.Load("Content/flixel/ogmo/PhysicsLevel.oel"); IEnumerable <XAttribute> attList = from at in xelement.Attributes() select at; foreach (XAttribute xAttr in attList) { //Console.WriteLine(xAttr.Name.ToString() + " " + xAttr.Value.ToString()); //levelAttrs.Add(xAttr.Name.ToString(), xAttr.Value.ToString()); } foreach (XElement xEle in xdoc.Descendants("level").Descendants("NewLayer0").Elements()) { Console.WriteLine(xEle.Name.ToString() + " " + xEle.Attribute("x").ToString().Split('=')[1].Replace('\"', ' ')); FarSprite f = new FarSprite( Convert.ToInt32(xEle.Attribute("x").ToString().Split('=')[1].Replace('\"', ' ')) + 500, Convert.ToInt32(xEle.Attribute("y").ToString().Split('=')[1].Replace('\"', ' ')) + 220, _world); f.loadGraphic("flixel/initials/crate_80x60", true, false, Convert.ToInt32(xEle.Attribute("width").ToString().Split('=')[1].Replace('\"', ' ')), Convert.ToInt32(xEle.Attribute("height").ToString().Split('=')[1].Replace('\"', ' '))); add(f); } }
public bool overlappedCrate(object sender, FlxSpriteCollisionEvent e) { FlxG.score++; if (e.Object2.GetType().ToString().EndsWith("Fruit")) { ((Fruit)(e.Object2))._body.SetTransform(new Vector2((int)FlxU.random(0, 0), (int)FlxU.random(0, 0)), 0.0f); //e.Object2.reset(-110, -110); e.Object2.debugName = "repack"; ((Fruit)(e.Object2))._body.Enabled = false; } if (e.Object2.GetType().ToString().EndsWith("Crate")) { foreach (var item in crates.members) { if (item.GetType().ToString().EndsWith("Fruit")) //&& item.debugName == "repack" { //e.Object2.reset(e.Object2.x, e.Object2.y); ((Fruit)(item))._body.SetTransform(new Vector2(e.Object2.x, e.Object2.y), 0.0f); item.debugName = ""; ((Fruit)(item))._body.Enabled = true; } } e.Object2.reset((int)FlxU.random(0, FlxG.width), (int)FlxU.random(0, FlxG.height - 100)); } return(true); }
override public void update() { if (FlxG.keys.ONE) { //((FarSprite)(team1.members[0]))._body.ApplyAngularImpulse(5550); foreach (FarSprite item in team1.members) { item._body.ApplyAngularImpulse(5550); } } if (FlxG.keys.TWO) { //((FarSprite)(team1.members[0]))._body.ApplyAngularImpulse(5550); foreach (FarSprite item in team1.members) { item._body.ApplyAngularImpulse(-5550); } } if (FlxG.keys.SPACE) { puck._body.Position = new Vector2(FlxG.width / 2, FlxG.height / 2); puck._body.ApplyLinearImpulse(new Vector2(FlxU.random(-15000, 15000), FlxU.random(-15000, 15000))); } base.update(); }
public void shoot(FlxPoint Location, float Angle) { _sfxShoot.play(true); base.reset(Location.X - Width / 2, Location.Y - Height / 2); FlxU.rotatePoint(0, (int)speed, 0, 0, Angle, _tagPoint); Velocity.X = _tagPoint.X; Velocity.Y = _tagPoint.Y; Solid = (true); play("idle"); }
public void ballInPlay() { FlxU.overlap(ball, hole, ballInHole); if (ball.velocity.Y == 0) { resetSelections(); state = GameState.BallEnded; return; } }
public Boat(int xPos, int yPos) : base(xPos, yPos) { loadGraphic(FlxG.Content.Load <Texture2D>("boats"), true, false, 16, 16); addAnimation("up", new int[] { 0, 1 }, (int)FlxU.random(4, 8), true); addAnimation("right", new int[] { 18, 19 }, (int)FlxU.random(4, 8), true); addAnimation("down", new int[] { 36, 37 }, (int)FlxU.random(4, 8), true); addAnimation("left", new int[] { 54, 55 }, (int)FlxU.random(4, 8), true); addAnimation("stopped", new int[] { 36 }, (int)FlxU.random(4, 8), true); play("right"); }
override public void create() { base.create(); FlxG.mouse.hide(); FlxG.hideHud(); playingField = new FlxTileblock(0, 0, 640, 640); playingField.auto = FlxTileblock.RANDOM; playingField.loadTiles(FlxG.Content.Load <Texture2D>("examples/sports_ground"), 16, 16, 0); add(playingField); team1 = new FlxGroup(); team2 = new FlxGroup(); // Create two teams of 7 robots; for (int i = 0; i < 7; i++) { FlxSprite robot = new FlxSprite(20 + (i * 90), 10); robot.loadGraphic(FlxG.Content.Load <Texture2D>("flixel/surt/race_or_die"), true, false, 64, 64); robot.addAnimation("Static", new int[] { 7 }, 0, true); robot.play("Static"); robot.angle = 270; robot.velocity.Y = FlxU.random(10, 100); //robot.width = 32; //robot.height = 32; //robot.offset.X = 16; //robot.offset.Y = 16; team1.add(robot); } for (int i = 0; i < 7; i++) { FlxSprite robot = new FlxSprite(20 + (i * 90), 200); robot.loadGraphic(FlxG.Content.Load <Texture2D>("flixel/surt/race_or_die"), true, false, 64, 64); robot.addAnimation("Static", new int[] { 9 }, 0, true); robot.play("Static"); robot.angle = 90; robot.velocity.Y = FlxU.random(-10, -100); //robot.width = 32; //robot.height = 32; //robot.offset.X = 16; //robot.offset.Y = 16; team2.add(robot); } add(team1); add(team2); }
public static void writeGameProgressToFile() { string progress = ""; foreach (var item in gameProgress) { progress += item.Key.ToString() + "," + item.Value.KilledArmy.ToString().ToLower() + "," + item.Value.KilledChef.ToString().ToLower() + "," + item.Value.KilledInspector.ToString().ToLower() + "," + item.Value.KilledWorker.ToString().ToLower() + "," + item.Value.LevelComplete.ToString().ToLower() + "\n"; } FlxU.saveToDevice(progress, "gameProgress.slf"); }
protected bool ballInHole(object Sender, FlxSpriteCollisionEvent e) { Console.WriteLine("Ball speed at time of sinking x {0} y {1} -- ball x/y {2} {3} hole x/y {4} {5} ", ball.velocity.X, ball.velocity.Y, ball.x, ball.y, hole.x, hole.y); if (ball.rise == true) { return(false); } else if (ball.velocity.Y < -35) { // Voice -- "A little too much juice on that one. Next time try a softer approach. // too fast to sink playSound("alittletoomuchjuice"); FlxG.play("putt/sfx/ballinhole"); if (ball.x > hole.x - 1) { ball.velocity.X = 56; } else if (ball.x < hole.x - 3) { ball.velocity.X = -56; } } else { //went in the hole. if (ball.visible) { FlxG.play("putt/sfx/GolfBallInHole"); Globals.ballInHole = true; if (FlxG.debug) { FlxU.saveToDevice(string.Format("Hole Aim (x) Power Force: ,{0},{1},{2},{3},{4}", Globals.hole, aim.x, aim.health, selectedClub, selectedForce), "hole" + Globals.hole + ".txt"); } } state = GameState.BallEnded; ball.visible = false; resetSelections(); } return(true); }
override public void update() { if (FlxG.keys.justPressed(Keys.B)) { FlxG.showBounds = true; } //Reset if (FlxG.keys.justPressed(Keys.Space)) { int i = 0; foreach (FlxSprite robot in team1.members) { robot.dead = false; robot.exists = true; robot.x = 20 + (i * 90); robot.y = 10; robot.velocity.Y = FlxU.random(10, 100); i++; } i = 0; foreach (FlxSprite robot in team2.members) { robot.dead = false; robot.exists = true; // or // robot.reset(20, 20); robot.x = 20 + (i * 90); robot.y = 200; robot.velocity.Y = FlxU.random(-10, -100); i++; } } FlxU.overlap(team1, team2, overlapped); base.update(); }
override public void update() { if (FlxG.mouse.justPressed() || FlxU.random() < 0.031f) { FarSprite f = new FarSprite(FlxG.mouse.screenX, FlxG.mouse.screenY, _world); f.loadGraphic("flixel/initials/crate_80x60", true, false, FlxU.randomInt(20, 40), FlxU.randomInt(40, 60)); //f._body.AngularVelocity = FlxU.randomInt(0, 5); //f._body.ApplyLinearImpulse(new Vector2(FlxG.mouse.screenX, FlxG.mouse.screenY), new Vector2(FlxG.mouse.screenX, FlxG.mouse.screenY)); //f._body.ApplyLinearImpulse(new Vector2(FlxU.random(-15000, 15000), FlxU.random(-15000, 15000))); //f._body.LinearVelocity = new Vector2(100000000000000000, 1000000000000000) ; f._body.ApplyLinearImpulse(new Vector2(int.MaxValue, int.MaxValue * -1)); f._body.Mass = 2100; add(f); } _world.Step(Math.Min((float)FlxG.elapsedAsGameTime.ElapsedGameTime.TotalSeconds, (1f / 30f))); base.update(); }
override public void update() { _world.Step(Math.Min((float)FlxG.elapsedAsGameTime.ElapsedGameTime.TotalSeconds, (1f / 30f))); if (FlxG.keys.justPressed(Keys.B)) { FlxG.showBounds = !FlxG.showBounds; } FlxG.setHudText(1, FlxG.score.ToString()); FlxU.collide(movingBlocksGrp, crates); FlxU.collide(blocksGrp, crates); FlxU.collide(charactersGrp, blocksGrp); FlxU.collide(charactersGrp, movingBlocksGrp); FlxU.overlap(charactersGrp, doors, overlapped); FlxU.overlap(charactersGrp, crates, overlappedCrate); if (FlxControl.ACTIONJUSTPRESSED) { foreach (MovingBlock block in movingBlocksGrp.members) { block.forward = !block.forward; if (block.forward && block.velocity.X == 0 && block.velocity.Y == 0) { block.startFollowingPath(FlxObject.PATH_FORWARD); } if (!block.forward && block.velocity.X == 0 && block.velocity.Y == 0) { block.startFollowingPath(FlxObject.PATH_BACKWARD); } } } base.update(); }
override public void update() { _world.Step(Math.Min((float)FlxG.elapsedAsGameTime.ElapsedGameTime.TotalSeconds, (1f / 30f))); m.x = FlxG.mouse.x; m.y = FlxG.mouse.y; FlxU.overlap(tileGrp, m, scaleUp); base.update(); if (FlxG.keys.justPressed(Keys.C)) { foreach (FarSprite item in tileGrp.members) { item._body.BodyType = BodyType.Dynamic; item._body.ApplyLinearImpulse(new Vector2(FlxU.random(-13120, 13120), FlxU.random(-13120, 13120))); } } if (FlxG.keys.justPressed(Keys.D)) { FlxG.quake.start(0.003f, 0.2f); for (int i = 0; i < 7; i++) { int f = (int)FlxU.random(1, tileGrp.members.Count - 1); ((FarSprite)(tileGrp.members[f]))._body.BodyType = BodyType.Dynamic; ((FarSprite)(tileGrp.members[f]))._body.ApplyLinearImpulse(new Vector2(FlxU.random(-13120, 13120), FlxU.random(-13120, 13120))); } } if (FlxG.keys.justPressed(Keys.F)) { _world.Gravity = new Vector2(0, 98); } }
override public void create() { base.create(); FlxG.hideHud(); _world = new World(new Vector2(0, 98.0f)); for (int i = 0; i < 10; i++) { Vector2 v = new Vector2((int)FlxU.random(0, 400), (int)FlxU.random(0, 200)); FarSprite f = new FarSprite((int)v.X, (int)v.Y, _world); f.loadGraphic("flixel/initials/crate_80x60", true, false, (int)FlxU.random(10, 20), (int)FlxU.random(10, 20)); f._body.Mass = 500f; //f._body.AngularVelocity = FlxU.random(-20,20); add(f); } for (int i = 0; i < 10; i++) { Vector2 v = new Vector2((int)FlxU.random(0, 400), (int)FlxU.random(0, 200)); FarTileblock f = new FarTileblock((int)v.X, (int)v.Y, (int)FlxU.random(10, 40), (int)FlxU.random(10, 40), _world); f.loadTiles("flixel/initials/crate_80x60", 5, 5, 0); //f.loadGraphic("flixel/initials/crate_80x60", true, false, (int)FlxU.random(10, 20), (int)FlxU.random(10, 20)); f._body.Mass = 500f; f._body.AngularVelocity = FlxU.random(-20, 20); f.moves = true; add(f); } _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); }
//A helper function that returns the angle between //the Enemy's midpoint and the player's midpoint. protected float angleTowardPlayer() { return(FlxU.getAngle(getMidpoint(_tagPoint), _player.getMidpoint(_playerMidpoint))); //return FlxU.getAngle(getMidpoint(_tagPoint),_player.getMidpoint(_playerMidpoint)); }
//This is the main flixel update function or loop function. //Most of the enemy's logic or behavior is in this function here. public override void update() { //Then, rotate toward that angle. //We could rotate instantly toward the player by simply calling: //angle = angleTowardPlayer(); //However, we want some less predictable, more wobbly behavior. float da = angleTowardPlayer(); if (da < Angle) { AngularAcceleration = -AngularDrag; } else if (da > Angle) { AngularAcceleration = AngularDrag; } else { AngularAcceleration = 0; } //Figure out if we want the jets on or not. _timer += FlxG.elapsed; if (_timer > 8) { _timer = 0; } bool jetsOn = _timer < 6; //Set the bot's movement speed and direction //based on angle and whether the jets are on. _thrust = FlxU.computeVelocity(_thrust, (jetsOn?90:0), Drag.X, 60); FlxU.rotatePoint(0, (int)_thrust, 0, 0, Angle, Velocity); //Shooting - three shots every few seconds if (onScreen()) { bool shoot = false; float os = _shotClock; _shotClock += FlxG.elapsed; if ((os < 4.0) && (_shotClock >= 4.0)) { _shotClock = 0; shoot = true; } else if ((os < 3.5) && (_shotClock >= 3.5)) { shoot = true; } else if ((os < 3.0) && (_shotClock >= 3.0)) { shoot = true; } //If we rolled over one of those time thresholds, //shoot a bullet out along the angle we're currently facing. if (shoot) { //First, recycle a bullet from the bullet pile. //If there are none, recycle will automatically create one for us. EnemyBullet b = (EnemyBullet)_bullets.recycle(typeof(EnemyBullet)); //Then, shoot it from our midpoint out along our angle. b.shoot(getMidpoint(_tagPoint), Angle); } } //Then call FlxSprite's update() function, to automate // our motion and animation and stuff. base.update(); //Finally, update the jet particles shooting out the back of the ship. if (jetsOn) { if (!_jets.on) { //If they're supposed to be on and they're not, //turn em on and play a little sound. _jets.start(false, 0.5f, 0.01f); if (onScreen()) { _sfxJet.play(true); } } //Then, position the jets at the center of the Enemy, //and point the jets the opposite way from where we're moving. _jets.at(this); _jets.setXSpeed(-Velocity.X - 30, -Velocity.X + 30); _jets.setYSpeed(-Velocity.Y - 30, -Velocity.Y + 30); } else //If jets are supposed to be off, just turn em off. { _jets.on = false; } //Finally, update the jet emitter and all its member sprites. _jets.update(); }
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.mouse.show(FlxG.Content.Load<Texture2D>("Mode/cursor")); for (int i = 0; i < 40; i++) { for (int y = 0; y < 40; y++) { 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"); add(x); } } FlxTilemap t = new FlxTilemap(); string map = "0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0\n"; map += "0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0\n"; map += "0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0\n"; map += "0,0,0,0,1,1,1,1,1,0,1,0,1,0,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0\n"; map += "0,0,0,0,0,0,1,0,0,0,1,0,1,0,1,0,0,0,0,0,0,0,1,1,0,0,0,0,0,0,0,0,0\n"; map += "0,0,0,0,0,0,1,0,0,0,1,1,1,0,1,1,0,0,0,0,0,0,1,1,1,1,0,0,0,0,0,0,0\n"; map += "0,0,0,0,0,0,1,0,0,0,1,0,1,0,1,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0\n"; map += "0,0,0,0,0,0,1,0,0,0,1,0,1,0,1,1,1,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0\n"; map += "0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0\n"; map += "0,0,0,1,0,1,1,1,0,1,0,0,0,1,1,1,0,1,0,0,0,1,0,1,1,1,0,0,0,0,0,0,0\n"; map += "0,0,0,1,0,1,0,0,0,1,0,0,0,1,0,1,0,1,1,0,0,1,0,1,0,0,1,0,0,0,0,0,0\n"; map += "0,0,0,1,0,1,1,1,0,1,0,0,0,1,1,1,0,1,0,1,0,1,0,1,0,0,1,0,0,0,0,0,0\n"; map += "0,0,0,1,0,0,0,1,0,1,0,0,0,1,0,1,0,1,0,0,1,1,0,1,0,0,1,0,0,0,0,0,0\n"; map += "0,0,0,1,0,1,1,1,0,1,1,1,0,1,0,1,0,1,0,0,0,1,0,1,1,1,0,0,0,0,0,0,0\n"; map += "0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0\n"; map += "0,0,0,1,1,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0\n"; map += "0,0,0,0,1,1,0,0,0,0,0,0,0,0,0,0,1,1,1,0,0,0,0,0,0,1,0,0,0,0,0,0,0\n"; map += "0,0,0,0,0,1,1,1,1,0,0,0,0,0,0,1,1,1,1,0,0,0,0,1,1,1,0,0,0,0,0,0,0\n"; map += "0,0,0,0,0,0,0,1,1,0,0,0,0,0,1,1,1,1,1,0,0,0,1,1,0,0,0,0,0,0,0,0,0\n"; map += "0,0,0,0,0,0,1,1,1,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0\n"; map += "0,0,0,0,0,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0\n"; map += "0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0\n"; map += "0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0\n"; t.auto = FlxTilemap.AUTO; t.loadMap(map, FlxG.Content.Load <Texture2D>("autotilesIsland"), 8, 8); add(t); }
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 update() { coinCounter.text = Lemonade_Globals.coins.ToString(); tween.Update(FlxG.elapsedAsGameTime); coin.update(); coinCounter.update(); toastySprite.update(); coin.y = tween.Position; //coinCounter.y = tween.Position; int count = 1; foreach (FlxSprite item in powerBar.members) { if (count > Lemonade_Globals.totalTimeAvailable) { item.visible = false; } if (count > time) { if (item.color == Lemonade_Globals.GAMEBOY_COLOR_1 && count < 4) { FlxG.play("Lemonade/sfx/cw_sound09"); } else if (item.color == Lemonade_Globals.GAMEBOY_COLOR_1) { //Console.WriteLine("Coins per minute {0}", coinsPerMinute); if (coinsPerMinute > 2.5f) { toastySprite.velocity.Y = -200; Lemonade_Globals.coinsThisLevel = 0; FlxG.play("Lemonade/sfx/cw_sound12", 0.25f, false); FlxG.play("Lemonade/sfx/cw_sound15", 0.44f, false); FlxG.quake.start(0.005f, 0.5f); } } item.color = Lemonade_Globals.GAMEBOY_COLOR_4; } else { item.color = Lemonade_Globals.GAMEBOY_COLOR_1; } item.update(); count++; } if (time <= 0.5f) { if (FlxU.random() < 0.1f) { FlxG.play("Lemonade/sfx/cw_sound09"); } } if (toastySprite.y < FlxG.height - 180) { toastySprite.velocity.Y *= -1; } base.update(); if (canStart) { int mult = 1; if (FlxG.keys.F5) { mult = 10; } time -= FlxG.elapsed * mult; totalTime += FlxG.elapsed; } coinsPerMinute = Lemonade_Globals.coinsThisLevel / totalTime; }
override public void create() { FlxG.backColor = FlxColor.ToColor("dedbc3"); base.create(); _world = new World(new Vector2(0, 98.0f)); charactersGrp = new FlxGroup(); blocksGrp = new FlxGroup(); movingBlocksGrp = new FlxGroup(); doors = new FlxGroup(); crates = new FlxGroup(); //Dictionary<string,string> levelAttrs = FlxXMLReader.readAttributesFromOelFile("ogmo/level1.oel", "level/grid"); //FlxTilemap tiles = new FlxTilemap(); //tiles.useExtraMiddleTiles = false; //tiles.auto = FlxTilemap.AUTO; //tiles.indexOffset = -1; //tiles.loadMap(levelAttrs["grid"], FlxG.Content.Load<Texture2D>("level1_tiles"), 10, 10); //tiles.setScrollFactors(0, 0); //tiles.boundingBoxOverride = true; //blocksGrp.add(tiles); List <Dictionary <string, string> > lblocks = FlxXMLReader.readNodesFromOelFile("ogmo/level1.oel", "level/grid"); foreach (Dictionary <string, string> nodes in lblocks) { FarTileblock t = new FarTileblock(Convert.ToInt32(nodes["x"]) + (Convert.ToInt32(nodes["w"]) / 2), Convert.ToInt32(nodes["y"]) + (Convert.ToInt32(nodes["h"]) / 2), Convert.ToInt32(nodes["w"]), Convert.ToInt32(nodes["h"]), _world); t.auto = FlxTilemap.AUTO; t.loadTiles("level1_tiles", 10, 10, 0); blocksGrp.add(t); t._body.BodyType = BodyType.Static; FlxTileblock t2 = new FlxTileblock(Convert.ToInt32(nodes["x"]), Convert.ToInt32(nodes["y"]), Convert.ToInt32(nodes["w"]), Convert.ToInt32(nodes["h"])); t2.auto = FlxTilemap.AUTO; t2.loadTiles("level1_tiles", 10, 10, 0); blocksGrp.add(t2); } List <Dictionary <string, string> > blocks = FlxXMLReader.readNodesFromOelFile("ogmo/level1.oel", "level/tileblocks"); foreach (Dictionary <string, string> nodes in blocks) { if (nodes["Name"] == "elevator") { MovingBlock block = new MovingBlock(Convert.ToInt32(nodes["x"]), Convert.ToInt32(nodes["y"])); block.loadGraphic("level1_specialBlock", false, true, 40, 20); movingBlocksGrp.add(block); FlxPath xpath = new FlxPath(null); xpath.add(Convert.ToInt32(nodes["x"]) + 20, Convert.ToInt32(nodes["y"]) + 10); xpath.addPointsUsingStrings(nodes["pathNodesX"], nodes["pathNodesY"], 20, 10); block.followPath(xpath, 80, FlxObject.PATH_FORWARD, false); } if (nodes["Name"] == "door") { Door door = new Door(Convert.ToInt32(nodes["x"]), Convert.ToInt32(nodes["y"]) - 100); doors.add(door); } //foreach (var item in nodes) //{ // Console.WriteLine("{0} {1}", item.Key, item.Value); //} } //bat = new Bat(x, y); //actors.add(bat); //Console.WriteLine("Building a bat {0} {1} {2} {3}", x, y, PathNodesX, PathNodesY); //if (PathNodesX != "" && PathNodesY != "") //{ // Console.WriteLine("Building a path {0} {1} {2}", PathNodesX, PathNodesY, PathCornering); // FlxPath xpath = new FlxPath(null); // xpath.add(x, y); // xpath.addPointsUsingStrings(PathNodesX, PathNodesY); // bat.followPath(xpath, PathSpeed, PathType, false); // bat.pathCornering = PathCornering; //} Andre andre = new Andre(0, 0); charactersGrp.add(andre); Liselot liselot = new Liselot(40, 40); charactersGrp.add(liselot); Army army = new Army(30, 20); charactersGrp.add(army); Inspector inspector = new Inspector(50, 50); charactersGrp.add(inspector); Worker worker = new Worker(60, 60); charactersGrp.add(worker); Chef chef = new Chef(100, 30); charactersGrp.add(chef); FlxTileblock bg = new FlxTileblock(0, 0, 240, 800); bg.auto = FlxTileblock.RANDOM; bg.loadTiles("level1_shelfTile", 80, 80, 0); add(bg); bg = new FlxTileblock(640, 0, 240, 800); bg.auto = FlxTileblock.RANDOM; bg.loadTiles("level1_shelfTile", 80, 80, 0); add(bg); for (int i = 0; i < 5; i++) { SmallCrate c = new SmallCrate((int)FlxU.random(0, FlxG.width), (int)FlxU.random(0, FlxG.height - 100)); crates.add(c); } for (int i = 0; i < 5; i++) { Bottle b = new Bottle((int)FlxU.random(0, FlxG.width), (int)FlxU.random(0, FlxG.height - 100)); crates.add(b); } for (int i = 0; i < 55; i++) { Fruit f = new Fruit((int)FlxU.random(0, FlxG.width), (int)FlxU.random(0, FlxG.height - 100), _world); f._body.ApplyLinearImpulse(new Vector2(20, 2120)); crates.add(f); } add(doors); add(charactersGrp); add(blocksGrp); add(movingBlocksGrp); add(crates); FlxG.showHud(); FlxG.setHudTextPosition(1, FlxG.width / 2, 10); FlxG.setHudTextScale(1, 3); }
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 update() { if (FlxG.keys.justPressed(Keys.Q)) { FlxG.bloom.Visible = !FlxG.bloom.Visible; FlxG.bloom.usePresets = true; follower.velocity.Y += 1450; } if (FlxG.keys.ONE) { FlxG.bloom.Settings = BloomPostprocess.BloomSettings.PresetSettings[1]; } if (FlxG.keys.TWO) { FlxG.bloom.Settings = BloomPostprocess.BloomSettings.PresetSettings[2]; } if (FlxG.keys.THREE) { FlxG.bloom.Settings = BloomPostprocess.BloomSettings.PresetSettings[3]; } if (FlxG.keys.FOUR) { FlxG.bloom.Settings = BloomPostprocess.BloomSettings.PresetSettings[4]; } if (FlxG.keys.FIVE) { FlxG.bloom.Settings = BloomPostprocess.BloomSettings.PresetSettings[5]; } if (FlxG.keys.SIX) { FlxG.bloom.Settings = BloomPostprocess.BloomSettings.PresetSettings[6]; } if (FlxG.keys.SEVEN) { FlxG.bloom.Settings = BloomPostprocess.BloomSettings.PresetSettings[7]; } foreach (FlxSprite item in rain.members) { if (item.y > 2000) { splashes.at(item); splashes.start(true, 0.0f, 10); item.y = 1200; } } base.update(); if (instruction.visible) { if (tween.hasEnded) { FlxG.play("Lemonade/sfx/cw_sound09", 0.75f, false); } } tween.Update(FlxG.elapsedAsGameTime); instruction.y = tween.Position; if (follower.y > 2100) { credits.visible = true; } if (follower.y > 2300) { instruction.visible = true; } if (((follower.y > int.MaxValue && follower.x == 0) || (FlxG.keys.justPressed(Keys.X) && follower.y > 100) || (FlxG.gamepads.isNewButtonPress(Buttons.A) && follower.y > 100) || (FlxControl.ACTIONJUSTPRESSED && follower.y > 100)) && (FlxG.transition.members[0] as FlxSprite).scale < 0.001f) { if (Lemonade_Globals.coins == Lemonade_Globals.totalCoins) { #if !__ANDROID__ FlxU.openURL("http://initials.itch.io/slf2/download/Y9wdBOHe7a92Qpo9t5UJdz05HhZR5p10F0L6wfdP"); #endif } follower.velocity.X = -250; } if (follower.x < 0) { FlxG.transition.startFadeOut(0.15f, -90, 150); follower.x = 1; follower.velocity.X = 1; } if (FlxG.transition.complete) { FlxG.state = new IntroState(); FlxG.transition.resetAndStop(); return; } }
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); }
protected void onDanny() { FlxU.openURL("http://dbsoundworks.com"); }