/// <summary> /// Adds an event to the appropriate list for its type; returns the event. /// </summary> public Event Add(Event evnt) { switch (evnt) { case Event.Light e: Lights.Add(e); break; case Event.Sound e: Sounds.Add(e); break; case Event.SFX e: SFX.Add(e); break; case Event.Wind e: Wind.Add(e); break; case Event.Treasure e: Treasures.Add(e); break; case Event.Generator e: Generators.Add(e); break; case Event.Message e: Messages.Add(e); break; case Event.ObjAct e: ObjActs.Add(e); break; case Event.SpawnPoint e: SpawnPoints.Add(e); break; case Event.MapOffset e: MapOffsets.Add(e); break; case Event.Navmesh e: Navmeshes.Add(e); break; case Event.Environment e: Environments.Add(e); break; case Event.PseudoMultiplayer e: PseudoMultiplayers.Add(e); break; default: throw new ArgumentException($"Unrecognized type {evnt.GetType()}.", nameof(evnt)); } return(evnt); }
/// <summary> /// Adds a region to the appropriate list for its type; returns the region. /// </summary> public Region Add(Region region) { switch (region) { case Region.InvasionPoint r: InvasionPoints.Add(r); break; case Region.EnvironmentMapPoint r: EnvironmentMapPoints.Add(r); break; case Region.Sound r: Sounds.Add(r); break; case Region.SFX r: SFX.Add(r); break; case Region.WindSFX r: WindSFX.Add(r); break; case Region.SpawnPoint r: SpawnPoints.Add(r); break; case Region.Message r: Messages.Add(r); break; case Region.PatrolRoute r: PatrolRoutes.Add(r); break; case Region.MovementPoint r: MovementPoints.Add(r); break; case Region.WarpPoint r: WarpPoints.Add(r); break; case Region.ActivationArea r: ActivationAreas.Add(r); break; case Region.Event r: Events.Add(r); break; case Region.Logic r: Logic.Add(r); break; case Region.EnvironmentMapEffectBox r: EnvironmentMapEffectBoxes.Add(r); break; case Region.WindArea r: WindAreas.Add(r); break; case Region.MufflingBox r: MufflingBoxes.Add(r); break; case Region.MufflingPortal r: MufflingPortals.Add(r); break; case Region.Other r: Others.Add(r); break; default: throw new ArgumentException($"Unrecognized type {region.GetType()}.", nameof(region)); } return(region); }
/// <summary> /// Adds an event to the appropriate list for its type; returns the event. /// </summary> public Event Add(Event evnt) { switch (evnt) { case Event.Light e: Lights.Add(e); break; case Event.Sound e: Sounds.Add(e); break; case Event.SFX e: SFX.Add(e); break; case Event.Wind e: Wind.Add(e); break; case Event.Treasure e: Treasures.Add(e); break; case Event.Generator e: Generators.Add(e); break; case Event.Message e: Messages.Add(e); break; default: throw new ArgumentException($"Unrecognized type {evnt.GetType()}.", nameof(evnt)); } return(evnt); }
/// <summary> /// Adds the SFX. /// </summary> /// <param name="sfx">The SFX.</param> public void AddSFX(IEnumerator sfx) { SFX.Add(sfx); }
public override void LoadContent() { base.LoadContent(); camera = new Camera2D(Vector2.Zero); camera.Zoom = (float)Graphics.PreferredBackBufferHeight * 2.45f / 600f; // the ideal zoom is 2.45 at 600px of screen height font = content.Load <SpriteFont>("Font"); tilemapTexture = this.content.Load <Texture2D>("SpriteSheet"); song = content.Load <Song>("InkStuff"); MediaPlayer.Volume = 0.3f; MediaPlayer.Play(song); MediaPlayer.IsRepeating = true; /* * A single pixel to draw lines and stuff */ pixel = new Texture2D(Graphics.GraphicsDevice, 1, 1); DrawMe.Fill(pixel, Color.White); /* * Load sfx */ SFX.Add("bubble", content.Load <SoundEffect>("sfx_bubble")); SFX.Add("bubble_noise_single", content.Load <SoundEffect>("BubbleNoisesSingle")); SFX.Add("anchor", content.Load <SoundEffect>("Anchor3")); SFX.Add("fall", content.Load <SoundEffect>("Falling")); SFX.Add("enemyDeath", content.Load <SoundEffect>("EnemyDeath")); /* * Player init */ player = new Player(this, tilemapTexture, Vector2.Zero, 32, 32, true); /*player.Animations.CurrentFrame = new Frame(96, 176, 16, 32);*/ // woman player.Animations.CurrentFrame = new Frame(16, 64, 32, 32); // actual player //player.Animations.Add("shooting", new int[] { 147, 149, 151, 153, 155}, 6, true); //player.Animations.Add("woman-run", new int[] { 183, 184, 185, 186, 187, 188 }, 12, true); player.Body.X = 16 * 440; /*330*/ //spawn x player.Body.Y = 16 * 3; //spawn y player.Body.SetSize(16, 32, 0, 0); // woman player.Body.SetSize(10, 26, 11, 3); // actual player //player.Animations.Play("woman-run"); /* * Level init */ XMLLevelLoader XMLloader = new XMLLevelLoader(); level = XMLloader.LoadLevel(this, @"Content\Level1.tmx", tilemapTexture); level.SetCollisionTiles(new int[] { 2, 33, 34, 35, 47, 66, }); /* * parse objects */ foreach (TiledObject obj in level.Objects) { Console.WriteLine("parsing " + obj.Name); if (obj.Name.ToLower() == "jellyfish") { Vector2 center = new Vector2(obj.X + obj.Width / 2, obj.Y + obj.Height / 2); Vector2 radius = new Vector2(obj.Width / 2, obj.Height / 2); float speed = float.Parse(obj.GetProperty("speed")); JellyFish j = new JellyFish(this, tilemapTexture, Vector2.Zero, 16, 32, center, radius, speed); // make it start on the right side of its path if (obj.GetProperty("start_rotation") == "right") { j.FacingDirection = 1; } else { j.FacingDirection = -1; } Console.WriteLine(obj.GetProperty("start_rotation")); enemies.Add(j); Console.WriteLine("added jelly"); } else if (obj.Name.ToLower() == "pufferfish") { Vector2 position = new Vector2(obj.X, obj.Y); float speed = float.Parse(obj.GetProperty("speed")); PufferFish p = new PufferFish(this, tilemapTexture, position, 32, 32, obj.Width, speed); // make it start on the right side of its path if (obj.GetProperty("start_side") == "right") { p.Body.X = obj.X + obj.Width; p.CurrentDistance = obj.Width - 33; } enemies.Add(p); Console.WriteLine("added puffer"); } else if (obj.Name.ToLower() == "goldfish") { goldenFishs.Add(new GoldFish(this, tilemapTexture, new Vector2(obj.X, obj.Y), 16, 16)); } else if (obj.Name.ToLower() == "particles") { ParticleEmitter particleEmitter = new ParticleEmitter(this, obj.X, obj.Y, 256); particleEmitter.EmitterBox.Resize(obj.Width, obj.Height); particleEmitter.MakeParticles(tilemapTexture, 16, 16); particleEmitter.ParticleVelocity = new Vector2(0, -0.01f); particleEmitter.SetAcceleration(0, -0.005f); particleEmitter.XVelocityVariationRange = new Vector2(-20f, 20f); particleEmitter.YVelocityVariationRange = new Vector2(-20f, 0f); particleEmitter.SetTextureCropRectangle(new Rectangle(0, 78, 16, 16)); particleEmitter.SpawnRate = 250f; particleEmitter.ParticleLifespanMilliseconds = 5000f; particleEmitter.ParticleLifespanVariationMilliseconds = 1000f; particleEmitter.InitialScale = 0.1f; particleEmitter.FinalScale = 1.5f; particleEmitter.ForEachParticle(ChangeSpriteTintBlue); backgroundParticles.Add(particleEmitter); Console.WriteLine("added particles"); } else if (obj.Name.ToLower() == "player_spawn") { player.Body.X = obj.X; player.Body.Y = obj.Y; } else if (obj.Name.ToLower() == "change_state_trigger") { triggers.Add(new Trigger(obj.X, obj.Y, obj.Width, obj.Height, obj.GetProperty("value"))); } } // build spikes tiles list spikesPointingDown = level.GetTilesListByID(new int[] { 514 }); spikesPointingUp = level.GetTilesListByID(new int[] { 515 }); foreach (Tile spike in spikesPointingDown) { spike.Body.SetSize(12, 6, 1, 0); } foreach (Tile spike in spikesPointingUp) { spike.Body.SetSize(12, 6, 2, 10); } topWaterTiles = level.GetTilesListByID(new int[] { 97, 98, 99 }); /* * UI Elements init */ healthBar = new EnergyBar(Graphics, new Vector2(16, 16), 256, 16, new Color(0, 255, 0)); energyBar = new EnergyBar(Graphics, new Vector2(16, 32 + 4), 256, 16, new Color(255, 0, 0)); /* * Build Background Gradient */ backgroundWaterGradientStrip = new Texture2D(Graphics.GraphicsDevice, 1, level.Height * level.TileHeight); Color startColor = new Color(57, 92, 181); Color finishColor = new Color(17, 43, 104); Color currentColor; for (int i = 0; i < backgroundWaterGradientStrip.Height; i++) { float ratio = Math2.Map(i, 0f, backgroundWaterGradientStrip.Height, 0f, 1.0f); currentColor = Color.Lerp(startColor, finishColor, ratio); DrawMe.Pixel(backgroundWaterGradientStrip, 0, i, currentColor); } /* * Build Background Gradient */ backgroundSkyGradientStrip = new Texture2D(Graphics.GraphicsDevice, 1, Graphics.PreferredBackBufferHeight / 2); startColor = new Color(61, 28, 111); finishColor = new Color(158, 98, 123); for (int i = 0; i < backgroundSkyGradientStrip.Height; i++) { float ratio = Math2.Map(i, 0f, backgroundSkyGradientStrip.Height, 0f, 1.0f); currentColor = Color.Lerp(startColor, finishColor, ratio); DrawMe.Pixel(backgroundSkyGradientStrip, 0, i, currentColor); } ContentLoaded = true; }
public override void LoadContent() { base.LoadContent(); MediaPlayer.Stop(); camera = new Camera2D(Vector2.Zero); camera.Zoom = (float)Graphics.PreferredBackBufferHeight * 2.45f / 600f; // the ideal zoom is 2.45 at 600px of screen height font = content.Load <SpriteFont>("Font"); tilemapTexture = this.content.Load <Texture2D>("spritesheet-jn"); /* * Player Health & Energy */ texturePlayerHealth = this.content.Load <Texture2D>("HeartDraft"); texturePlayerEnergy = this.content.Load <Texture2D>("EnergyBar"); /* * A single pixel to draw lines and stuff */ pixel = new Texture2D(Graphics.GraphicsDevice, 1, 1); DrawMe.Fill(pixel, Color.White); /* * Load sfx */ SFX.Add("bubble", content.Load <SoundEffect>("sfx_bubble")); SFX.Add("bubble_noise_single", content.Load <SoundEffect>("BubbleNoisesSingle")); SFX.Add("anchor", content.Load <SoundEffect>("Anchor3")); SFX.Add("fall", content.Load <SoundEffect>("Falling")); SFX.Add("enemyDeath", content.Load <SoundEffect>("EnemyDeath")); /* * Player init */ player = new Player(this, tilemapTexture, Vector2.Zero, 32, 32, true); player.Animations.CurrentFrame = new Frame(96, 176, 16, 32); // woman player.Animations.CurrentFrame = new Frame(0, 144, 32, 32); // actual player //player.Animations.Add("robot-idle", new int[] { 177, 178, 179, 180, 181, 182 }, 6, false, true); //player.Animations.Add("woman-run", new int[] { 183, 184, 185, 186, 187, 188 }, 12, true); player.Body.X = 16 * 7; player.Body.Y = 16 * 5; player.Body.SetSize(16, 32, 0, 0); // woman player.Body.SetSize(10, 26, 11, 3); // actual player Karma.maxKarma = 0; Karma.playerShotsFired = 0; Karma.playerTotalDamage = 0f; Karma.playerCollect = 0; //player.Animations.Play("woman-run"); /* * Level init */ XMLLevelLoader XMLloader = new XMLLevelLoader(); level = XMLloader.LoadLevel(this, @"Content\featureTestMap.tmx", tilemapTexture); level.SetCollisionTiles(new int[] { 1, 2, 17, 18, 33, 34 }); /* * parse objects */ foreach (TiledObject obj in level.Objects) { Console.WriteLine("parsing " + obj.Name); if (obj.Name.ToLower() == "jellyfish") { Vector2 center = new Vector2(obj.X + obj.Width / 2, obj.Y + obj.Height / 2); Vector2 radius = new Vector2(obj.Width / 2, obj.Height / 2); float speed = float.Parse(obj.GetProperty("speed")); JellyFish j = new JellyFish(this, tilemapTexture, Vector2.Zero, 16, 32, center, radius, speed); j.Animations.CurrentFrame = new Frame(48, 112, 16, 32); enemies.Add(j); Karma.maxKarma = Karma.DefineMaxKarma(Karma.maxKarma, j.Health); Console.WriteLine("added jelly"); } else if (obj.Name.ToLower() == "pufferfish") { Vector2 position = new Vector2(obj.X, obj.Y); float speed = float.Parse(obj.GetProperty("speed")); PufferFish p = new PufferFish(this, tilemapTexture, position, 32, 32, obj.Width, speed); p.Animations.CurrentFrame = new Frame(0, 112, 32, 32); enemies.Add(p); Karma.maxKarma = Karma.DefineMaxKarma(Karma.maxKarma, p.Health); Console.WriteLine("added puffer"); } else if (obj.Name.ToLower() == "turtlex") { Vector2 position = new Vector2(obj.X, obj.Y); float speed = float.Parse(obj.GetProperty("speed")); TurtleX p = new TurtleX(this, tilemapTexture, position, 32, 32, 64, obj.Width, speed); p.Animations.CurrentFrame = new Frame(96, 112, 32, 32); enemies.Add(p); Karma.maxKarma = Karma.DefineMaxKarma(Karma.maxKarma, p.Health); Console.WriteLine("added turtlex"); } else if (obj.Name.ToLower() == "goldfish") { goldenFishs.Add(new GoldFish(this, tilemapTexture, new Vector2(obj.X, obj.Y), 16, 16)); } else if (obj.Name.ToLower() == "particles") { ParticleEmitter particleEmitter = new ParticleEmitter(this, obj.X, obj.Y, 256); particleEmitter.EmitterBox.Resize(obj.Width, obj.Height); particleEmitter.MakeParticles(tilemapTexture, 16, 16); particleEmitter.ParticleVelocity = new Vector2(0, -0.01f); particleEmitter.SetAcceleration(0, -0.005f); particleEmitter.XVelocityVariationRange = new Vector2(-20f, 20f); particleEmitter.YVelocityVariationRange = new Vector2(-20f, 0f); particleEmitter.SetTextureCropRectangle(new Rectangle(3 * 16, 6 * 16, 16, 16)); particleEmitter.SpawnRate = 250f; particleEmitter.ParticleLifespanMilliseconds = 5000f; particleEmitter.ParticleLifespanVariationMilliseconds = 1000f; particleEmitter.InitialScale = 0.1f; particleEmitter.FinalScale = 1.5f; particleEmitter.ForEachParticle(ChangeSpriteTintBlue); backgroundParticles.Add(particleEmitter); Console.WriteLine("added particles"); } else if (obj.Name.ToLower() == "player_spawn") { player.Body.X = obj.X; player.Body.Y = obj.Y; } else if (obj.Name.ToLower() == "change_state_trigger") { triggers.Add(new Trigger(obj.X, obj.Y, obj.Width, obj.Height, obj.GetProperty("value"))); } } // build spikes tiles list spikesPointingDown = level.GetTilesListByID(new int[] { 97 }); spikesPointingUp = level.GetTilesListByID(new int[] { 98 }); foreach (Tile spike in spikesPointingDown) { spike.Body.SetSize(12, 6, 2, 0); } foreach (Tile spike in spikesPointingUp) { spike.Body.SetSize(12, 6, 2, 10); } topWaterTiles = level.GetTilesListByID(new int[] { 49, 50, 51 }); /* * UI Elements init */ energyBar = new EnergyBar(Graphics, new Vector2(16, 32 + 4), 64, 8, new Color(255, 0, 0)); Karma.karma = Karma.maxKarma; /* * Build Background Gradient */ backgroundWaterGradientStrip = new Texture2D(Graphics.GraphicsDevice, 1, level.Height * level.TileHeight); Color startColor = new Color(57, 92, 181); Color finishColor = new Color(17, 43, 104); Color currentColor; for (int i = 0; i < backgroundWaterGradientStrip.Height; i++) { float ratio = Math2.Map(i, 0f, backgroundWaterGradientStrip.Height, 0f, 1.0f); currentColor = Color.Lerp(startColor, finishColor, ratio); DrawMe.Pixel(backgroundWaterGradientStrip, 0, i, currentColor); } /* * Build Background Gradient */ backgroundSkyGradientStrip = new Texture2D(Graphics.GraphicsDevice, 1, Graphics.PreferredBackBufferHeight / 2); startColor = new Color(61, 28, 111); finishColor = new Color(158, 98, 123); for (int i = 0; i < backgroundSkyGradientStrip.Height; i++) { float ratio = Math2.Map(i, 0f, backgroundSkyGradientStrip.Height, 0f, 1.0f); currentColor = Color.Lerp(startColor, finishColor, ratio); DrawMe.Pixel(backgroundSkyGradientStrip, 0, i, currentColor); } ContentLoaded = true; }
public override void LoadContent() { base.LoadContent(); camera = new Camera2D(Vector2.Zero); camera.Zoom = (float)Graphics.PreferredBackBufferHeight * 2.45f / 600f; // the ideal zoom is 2.45 at 600px of screen height font = content.Load <SpriteFont>("Font"); tilemapTexture = this.content.Load <Texture2D>("SpriteSheet"); MediaPlayer.Volume = 0.3f; MediaPlayer.Play(Globals.LevelSong); MediaPlayer.IsRepeating = true; /* * A single pixel to draw lines and stuff */ pixel = new Texture2D(Graphics.GraphicsDevice, 1, 1); DrawMe.Fill(pixel, Color.White); /* * Load sfx */ SFX.Add("bubble", content.Load <SoundEffect>("sfx_bubble")); SFX.Add("bubble_noise_single", content.Load <SoundEffect>("BubbleNoisesSingle")); SFX.Add("anchor", content.Load <SoundEffect>("Anchor3")); SFX.Add("fall", content.Load <SoundEffect>("Falling")); SFX.Add("enemyDeath", content.Load <SoundEffect>("EnemyDeath")); SFX.Add("goldenFish", content.Load <SoundEffect>("GoldenFish2")); SFX.Add("energyWarning", content.Load <SoundEffect>("EnergyEmpty")); //done SFX.Add("turtleExplosion", content.Load <SoundEffect>("TurtleExplosion")); //done SFX.Add("playerHurt", content.Load <SoundEffect>("Player hurt")); //done SFX.Add("playerDeath", content.Load <SoundEffect>("Player Death3")); //done faltar esperar uns segundos antes de fazer reload de state /* * Player init */ player = new Player(this, tilemapTexture, Vector2.Zero, 32, 32, true); /* * Level init */ XMLLevelLoader XMLloader = new XMLLevelLoader(); // se o load do mapa falhar, well shit. vai para o menu. try { level = XMLloader.LoadLevel(this, @"Content\" + Globals.CurrentLevel + ".tmx", tilemapTexture); } catch (Exception e) { Console.WriteLine("Error Loading Map. Error message: " + e.Message); StateManager.Instance.StartGameState("MenuState"); } level.SetCollisionTiles(new int[] { 2, 33, 34, 35, 47, 66, 15, 79 }); /* * parse objects */ foreach (TiledObject obj in level.Objects) { Console.WriteLine("parsing " + obj.Name); if (obj.Name.ToLower() == "jellyfish") { Vector2 center = new Vector2(obj.X + obj.Width / 2, obj.Y + obj.Height / 2); Vector2 radius = new Vector2(obj.Width / 2, obj.Height / 2); float speed = float.Parse(obj.GetProperty("speed")); JellyFish j = new JellyFish(this, tilemapTexture, Vector2.Zero, 16, 32, center, radius, speed); Karma.maxKarma += j.Health; // make it start on the right side of its path if (obj.GetProperty("start_rotation") == "right") { j.FacingDirection = 1; } else { j.FacingDirection = -1; } Console.WriteLine(obj.GetProperty("start_rotation")); enemies.Add(j); } else if (obj.Name.ToLower() == "pufferfish") { Vector2 position = new Vector2(obj.X, obj.Y); float speed = float.Parse(obj.GetProperty("speed")); PufferFish p = new PufferFish(this, tilemapTexture, position, 32, 32, obj.Width, speed); Karma.maxKarma += p.Health; // make it start on the right side of its path if (obj.GetProperty("start_side") == "right") { p.Body.X = obj.X + obj.Width; p.CurrentDistance = obj.Width - 33; } enemies.Add(p); } else if (obj.Name.ToLower() == "turtlex") { Vector2 position = new Vector2(obj.X, obj.Y); float speed = float.Parse(obj.GetProperty("speed")); TurtleX p = new TurtleX(this, tilemapTexture, position, 32, 32, 64, obj.Width, speed); p.Animations.CurrentFrame = new Frame(96, 112, 32, 32); Karma.maxKarma += p.Health; // make it start on the right side of its path if (obj.GetProperty("start_side") == "right") { p.Body.X = obj.X + obj.Width; p.CurrentDistance = obj.Width - 33; } enemies.Add(p); } else if (obj.Name.ToLower() == "goldfish") { goldenFishs.Add(new GoldFish(this, tilemapTexture, new Vector2(obj.X, obj.Y), 16, 16)); } else if (obj.Name.ToLower() == "particles") { if (obj.GetProperty("type") == "dark_ambient") { ParticleEmitter particleEmitter = new ParticleEmitter(this, obj.X, obj.Y, 256); particleEmitter.EmitterBox.Resize(obj.Width, obj.Height); particleEmitter.MakeRandomParticles(tilemapTexture, new Rectangle[] { new Rectangle(128, 257, 3, 3), new Rectangle(132, 257, 3, 3), new Rectangle(136, 257, 3, 3) }); particleEmitter.ParticleVelocity = new Vector2(0, 0); particleEmitter.SetAcceleration(0, 0); particleEmitter.XVelocityVariationRange = new Vector2(-20f, 20f); particleEmitter.YVelocityVariationRange = new Vector2(-20f, 20f); particleEmitter.SpawnRate = 100f; particleEmitter.ParticleLifespanMilliseconds = 5000f; particleEmitter.ParticleLifespanVariationMilliseconds = 1000f; particleEmitter.InitialScale = 1.5f; particleEmitter.FinalScale = 0.5f; backgroundParticles.Add(particleEmitter); } else { ParticleEmitter particleEmitter = new ParticleEmitter(this, obj.X, obj.Y, 256); particleEmitter.EmitterBox.Resize(obj.Width, obj.Height); particleEmitter.MakeParticles(tilemapTexture, 16, 16); particleEmitter.ParticleVelocity = new Vector2(0, -0.01f); particleEmitter.SetAcceleration(0, -0.005f); particleEmitter.XVelocityVariationRange = new Vector2(-20f, 20f); particleEmitter.YVelocityVariationRange = new Vector2(-20f, 0f); particleEmitter.SetTextureCropRectangle(new Rectangle(0, 78, 16, 16)); particleEmitter.SpawnRate = 250f; particleEmitter.ParticleLifespanMilliseconds = 5000f; particleEmitter.ParticleLifespanVariationMilliseconds = 1000f; particleEmitter.InitialScale = 0.1f; particleEmitter.FinalScale = 1.5f; particleEmitter.ForEachParticle(ChangeSpriteTintBlue); backgroundParticles.Add(particleEmitter); } } else if (obj.Name.ToLower() == "player_spawn") { player.Body.X = obj.X; player.Body.Y = obj.Y; } else if (obj.Name.ToLower() == "change_state_trigger") { triggers.Add(new Trigger(obj.X, obj.Y, obj.Width, obj.Height, obj.GetProperty("value"))); } else if (obj.Name.ToLower() == "speedbox") { SpeedBox s = new SpeedBox(obj.X, obj.Y, obj.Width, obj.Height, float.Parse(obj.GetProperty("speedX")), float.Parse(obj.GetProperty("speedY"))); ParticleEmitter particleEmitter = new ParticleEmitter(this, obj.X, obj.Y, 512); particleEmitter.EmitterBox.Resize(obj.Width, obj.Height); particleEmitter.MakeRandomParticles(tilemapTexture, new Rectangle[] { new Rectangle(128, 257, 3, 3), new Rectangle(132, 257, 3, 3), new Rectangle(136, 257, 3, 3), new Rectangle(128 - 16, 257, 3, 3), new Rectangle(132 - 16, 257, 3, 3), new Rectangle(136 - 16, 257, 3, 3) }); particleEmitter.ParticleVelocity = new Vector2(s.SpeedIncrease.X * 10, s.SpeedIncrease.Y * 10); particleEmitter.XVelocityVariationRange = new Vector2(-20f, 20f); particleEmitter.YVelocityVariationRange = new Vector2(-20f, 20f); particleEmitter.SpawnRate = 60f; particleEmitter.ParticleLifespanMilliseconds = 5000f; particleEmitter.ParticleLifespanVariationMilliseconds = 1000f; particleEmitter.InitialScale = 1.0f; particleEmitter.FinalScale = 0.5f; backgroundParticles.Add(particleEmitter); speedBoxes.Add(s); } Console.WriteLine("added " + obj.Name); } // build spikes tiles list spikesPointingDown = level.GetTilesListByID(new int[] { 514 }); spikesPointingUp = level.GetTilesListByID(new int[] { 515 }); spikesPointingLeft = level.GetTilesListByID(new int[] { 516 }); spikesPointingRight = level.GetTilesListByID(new int[] { 517 }); foreach (Tile spike in spikesPointingDown) { spike.Body.SetSize(12, 6, 1, 0); } foreach (Tile spike in spikesPointingUp) { spike.Body.SetSize(12, 6, 2, 10); } foreach (Tile spike in spikesPointingLeft) { spike.Body.SetSize(6, 12, 10, 2); } foreach (Tile spike in spikesPointingRight) { spike.Body.SetSize(6, 12, 0, 2); } topWaterTiles = level.GetTilesListByID(new int[] { 97, 98, 99 }); /* * UI Elements init */ //healthBar = new EnergyBar(Graphics, new Vector2(16, 16), 256, 16, new Color(0, 255, 0)); energyBar = new EnergyBar(Graphics, new Vector2(16 + 6, 16 + 25), 16 * 10 - 9, 16, new Color(255, 0, 0)); //16+2, 16 + 8, 16*10, 32+16 Karma.karma = Karma.maxKarma; Karma.maxCollectables = goldenFishs.Count; /* * Build Background Gradient */ backgroundWaterGradientStrip = new Texture2D(Graphics.GraphicsDevice, 1, level.Height * level.TileHeight); Color startColor = new Color(57, 92, 181); Color finishColor = new Color(17, 43, 104); Color currentColor; for (int i = 0; i < backgroundWaterGradientStrip.Height; i++) { float ratio = Math2.Map(i, 0f, backgroundWaterGradientStrip.Height, 0f, 1.0f); currentColor = Color.Lerp(startColor, finishColor, ratio); DrawMe.Pixel(backgroundWaterGradientStrip, 0, i, currentColor); } /* * Build Background Gradient */ backgroundSkyGradientStrip = new Texture2D(Graphics.GraphicsDevice, 1, Graphics.PreferredBackBufferHeight / 2); startColor = new Color(61, 28, 111); finishColor = new Color(158, 98, 123); for (int i = 0; i < backgroundSkyGradientStrip.Height; i++) { float ratio = Math2.Map(i, 0f, backgroundSkyGradientStrip.Height, 0f, 1.0f); currentColor = Color.Lerp(startColor, finishColor, ratio); DrawMe.Pixel(backgroundSkyGradientStrip, 0, i, currentColor); } ContentLoaded = true; }