private void spawnPoisonParticles(float poisonAmt) { if (poisonAmt > 0) { //ensure speed boost particle baseline if (rand.NextDouble() < .1f) { ParticleArbitrary particle = new ParticleArbitrary(location + new Vector2(rand.Next(20) - 10, rand.Next(30) - 10), world, new Vector2(), 100, Game1.texture_particle_bubble); particle.startColor = world.decorator.colorManager.groundColor; particle.startColor = Color.Green; particle.width = 10; particle.height = 10; world.addEntity(particle); } for (int i = 0; i < rand.Next((int)poisonAmt); i++) { ParticleArbitrary particle = new ParticleArbitrary(location + new Vector2(rand.Next(20) - 10, rand.Next(30) - 10), world, new Vector2(), 100, Game1.texture_particle_bubble); particle.startColor = world.decorator.colorManager.groundColor; particle.startColor = Color.Green; particle.width = 10; particle.height = 10; world.addEntity(particle); } } }
/** * * Plays the sound associated with a character unlock. Sprays reward particles everywhere. * * */ public static void playUnlockCharacterAlert(int characterIndex, WorldBase world, Vector2 playerLocation) { SoundManager.getSound("char-unlock").play(SoundType.MONSTER); Random rand = new Random(); for (int i = 0; i < 7; i++) { ParticleArbitrary teleportParticle = new ParticleArbitrary(playerLocation + new Vector2(0, -100), world, new Vector2(), 100, Game1.texture_particle_blood); teleportParticle.gravityMultiplier = -.3f; teleportParticle.endColor = Color.White; world.addEntity(teleportParticle); } for (int i = 0; i < 7; i++) { ParticleArbitrary teleportParticle = new ParticleArbitrary(playerLocation + new Vector2(0, -100), world, new Vector2((float)(rand.NextDouble() - .5f) * 2, (float)(rand.NextDouble() - .5f) * 2), 200, Game1.texture_particle_blood); teleportParticle.gravityMultiplier = -.01f; teleportParticle.startColor = world.decorator.colorManager.groundColor; teleportParticle.endColor = Color.White; teleportParticle.width = 6; teleportParticle.height = 6; world.addEntity(teleportParticle); } ParticleArbitrary unlockParticle = new ParticleArbitrary(playerLocation + new Vector2(0, -100), world, new Vector2(), 300, PlayerKitRegistry.registry[characterIndex].animations.standTex); unlockParticle.gravityMultiplier = 0; world.addEntity(unlockParticle); }
private void vibrateGround(Vector2 loc) { for (int i = 0; i < 3; i++) { ParticleArbitrary dirtclod = new ParticleArbitrary(loc + new Vector2((float)rand.NextDouble() * 80 - 40, 0), world, new Vector2(0, -(float)rand.NextDouble() * 1.5f), 50, Game1.texture_item_stone); dirtclod.width = 10; dirtclod.height = 10; dirtclod.rotation = (float)(rand.NextDouble() * Math.PI * 2); dirtclod.deltaRotation = (float)(rand.NextDouble() * .1 - .05); dirtclod.gravityMultiplier = 1; world.addEntity(dirtclod); } }
private void sprayEarth() { for (int i = 0; i < 20; i++) { ParticleArbitrary dirtclod = new ParticleArbitrary(location, world, new Vector2((float)rand.NextDouble() * 4 - 2, -(float)rand.NextDouble() * 15), 200, Game1.texture_item_stone); dirtclod.width = 10; dirtclod.height = 10; dirtclod.rotation = (float)(rand.NextDouble() * Math.PI * 2); dirtclod.deltaRotation = (float)(rand.NextDouble() * .1 - .05); dirtclod.gravityMultiplier = 1; world.addEntity(dirtclod); } }
public override void update(GameTime time) { base.update(time); if (cutsceneDuration < 1100 && !hasMusicStarted) { musicInstance.Play(); hasMusicStarted = true; } if (!spawnedSisterTeleport && animatedSister.isDone()) { spawnedSisterTeleport = true; for (int i = 0; i < 300; i++) { ParticleArbitrary particle = new ParticleArbitrary(new Vector2(675 + rand.Next(20), 50 - rand.Next(40)), this, new Vector2((float)rand.NextDouble(), 0), 200, Game1.texture_particle_blood); particle.width = 4; particle.height = 4; particle.gravityMultiplier = (float)rand.NextDouble() * -.4f; particle.startColor = groundColor; particle.endColor = groundColor; this.addEntity(particle); } } if (!spawnedBrotherTeleport && animatedPlayer.isDone()) { spawnedBrotherTeleport = true; for (int i = 0; i < 300; i++) { ParticleArbitrary particle = new ParticleArbitrary(new Vector2(900 + rand.Next(20), 50 - rand.Next(40)), this, new Vector2((float)rand.NextDouble(), 0), 200, Game1.texture_particle_blood); particle.width = 4; particle.height = 4; particle.gravityMultiplier = (float)rand.NextDouble() * -.4f; particle.startColor = groundColor; particle.endColor = groundColor; this.addEntity(particle); } } if (Keyboard.GetState().IsKeyDown(Keys.Escape)) { this.finishCutscene(); } }
public override void prePhysicsUpdate(GameTime time) { base.prePhysicsUpdate(time); facing = velocity.X; state.update(this); if (timeRemainingForSpawnParticles > 0) { timeRemainingForSpawnParticles--; for (int i = 0; i < 3; i++) { ParticleArbitrary particle = new ParticleArbitrary(new Vector2(location.X + rand.Next(10) - rand.Next(5), location.Y + rand.Next(20)), world, new Vector2((float)rand.NextDouble() - .5f, 0), 200, Game1.texture_particle_blood); particle.width = 4; particle.height = 4; particle.gravityMultiplier = (float)rand.NextDouble() * -.4f; particle.startColor = world.groundColor; particle.endColor = world.groundColor; world.addEntity(particle); } } /*if (collideBottom && isRunning) * { * frameSwitcher--; * if (frameSwitcher <= 0) * { * currentRunFrame = (currentRunFrame + 1) % texture_run.Length; * frameSwitcher = frameSwitchPoint; * selectedFrame = texture_run[currentRunFrame]; * } * } * else if (collideBottom) * { * selectedFrame = texture_player_default_stand; * currentRunFrame = 0; * } * else * { * * //currentJumpFrame = 0; * //frameSwitcherJump * if(velocity.Y > 0) * { * frameSwitcherJump--; * if (frameSwitcherJump <= 0) * { * currentJumpFrame = Math.Min(currentJumpFrame + 1, texture_jump.Length - 1); * frameSwitcherJump = frameSwitchPoint; * selectedFrame = texture_jump[currentJumpFrame]; * } * }else * { * currentJumpFrame = 0; * } * * selectedFrame = texture_jump[currentJumpFrame]; * }*/ //isRunning = false; selectedFrame = state.getTexture(this); timePlayerWillNotGasp--; if (wereFeetOnGround && !collideBottom) { bool playSlipSound = true; for (int i = 0; i < 9; i++) { TileType tile = world.getBlock(location + new Vector2(0, i * Chunk.tileDrawWidth)); if (tile != null && tile.tags.Contains(TagReferencer.SOLID)) { playSlipSound = false; break; } } if (playSlipSound && timePlayerWillNotGasp <= 0) { timePlayerWillNotGasp = 700; SoundManager.getSound("player-slip").playWithVariance(0, .2f, 0, SoundType.MONSTER); for (int i = 0; i < 7; i++) { EntityDecorativeRock rock = new EntityDecorativeRock(location + new Vector2(0, 7), world); rock.velocity += new Vector2(0, -rand.Next(7)); world.addEntity(rock); } } } if (!wereFeetOnGround && collideBottom && lastVelocity.Y >= 14) { this.remainingDamageImmunityTime = 100; SoundManager.getSound("player-fall").playWithVariance(0, .45f, 0, SoundType.MONSTER); } if (timeNextToAFire >= 100) { timeNextToAFire = 100; if (currentControlManager != guitarControlManager) { guitarControlManager.switchTo(currentControlManager); currentControlManager = guitarControlManager; } } wereFeetOnGround = collideBottom; lastVelocity = velocity; }
public FindGirlCutscene(WorldBase returnTo) : base("Content\\Cutscene\\FindGirlCutscene\\cutsceneFindSisterWorld", returnTo) { decorator.ambientSoundManager.requestMusicStop(); SoundEffect music = content.Load <SoundEffect>("Sounds/Music/boy_finds_sister_0"); musicInstance = music.CreateInstance(); musicInstance.Volume = MetaData.audioSettingMusic; //set up the next world EntityGirl girl = new EntityGirl(new Vector2(100, ((World)returnTo).noise.octavePerlin1D(100) * returnTo.decorator.getTerrainMultiplier() * Chunk.tileDrawWidth), returnTo); girl.touchedPlayer = true; returnTo.addEntity(girl); cutsceneDuration = 800; cameraCommands.Add(new MovementCommand(new Vector2(200, 0), new Vector2(200, 0), 650));//pause on the scene to let the player process it animatedPlayer = new AnimatedEntity(); animatedSister = new AnimatedEntity(); animatedEntities.Add(animatedPlayer); animatedEntities.Add(animatedSister); animatedPlayer.animations.Add(new Animation(150, 150, new Texture2D[] { Game1.player_default_animations.standTex }, true)); animatedPlayer.animations[0].drawFlipped = true; animatedPlayer.movement.Add(new MovementCommand(new Vector2(0, 27), new Vector2(0, 27), 150)); animatedPlayer.animations.Add(new Animation(7 * 7, 100, Game1.player_default_animations.runTex, true)); animatedPlayer.animations[1].drawFlipped = true; animatedPlayer.movement.Add(new MovementCommand(new Vector2(0, 27), new Vector2(140, 27), 100)); animatedPlayer.animations.Add(new Animation(75, content.loadTextureRange("Cutscene/FindGirlCutscene/player_hug_", 3), false)); animatedPlayer.animations[2].drawFlipped = true; animatedPlayer.movement.Add(new MovementCommand(new Vector2(140, 27), new Vector2(140, 27), 75)); animatedPlayer.animations.Add(new Animation(100, new Texture2D[] { content.Load <Texture2D>("Cutscene/FindGirlCutscene/player_hug_3") }, false)); animatedPlayer.animations[3].drawFlipped = true; animatedPlayer.movement.Add(new MovementCommand(new Vector2(140, 27), new Vector2(140, 27), 100)); animatedPlayer.animations.Add(new Animation(7 * 7, 150, Game1.player_default_animations.runTex, true)); animatedPlayer.animations[4].drawFlipped = true; animatedPlayer.movement.Add(new MovementCommand(new Vector2(140, 27), new Vector2(475, 27), 150)); animatedSister.animations.Add(new Animation(150, 150, new Texture2D[] { Game1.player_girl_animations.standTex }, true)); animatedSister.animations[0].drawFlipped = false; animatedSister.movement.Add(new MovementCommand(new Vector2(300, 25), new Vector2(300, 25), 150)); animatedSister.animations.Add(new Animation(7 * 7, 100, Game1.player_girl_animations.runTex, true)); animatedSister.animations[1].drawFlipped = false; animatedSister.movement.Add(new MovementCommand(new Vector2(300, 25), new Vector2(160, 25), 100)); animatedSister.animations.Add(new Animation(75, content.loadTextureRange("Cutscene/FindGirlCutscene/girl_hug_", 3), false)); animatedSister.animations[2].drawFlipped = false; animatedSister.movement.Add(new MovementCommand(new Vector2(160, 25), new Vector2(160, 25), 75)); animatedSister.animations.Add(new Animation(100, new Texture2D[] { content.Load <Texture2D>("Cutscene/FindGirlCutscene/girl_hug_3") }, false)); animatedSister.animations[3].drawFlipped = false; animatedSister.movement.Add(new MovementCommand(new Vector2(160, 25), new Vector2(160, 25), 100)); animatedSister.animations.Add(new Animation(7 * 7, 200, Game1.player_girl_animations.runTex, true)); animatedSister.animations[4].drawFlipped = true; animatedSister.movement.Add(new MovementCommand(new Vector2(160, 25), new Vector2(475, 25), 200)); for (int i = 0; i < 300; i++) { ParticleArbitrary particle = new ParticleArbitrary(new Vector2(-10 + rand.Next(20), 50 - rand.Next(40)), this, new Vector2((float)rand.NextDouble(), 0), 300, Game1.texture_particle_blood); particle.width = 4; particle.height = 4; particle.gravityMultiplier = (float)rand.NextDouble() * -.4f; particle.startColor = groundColor; particle.endColor = groundColor; this.addEntity(particle); } }
public override void use(PlayerBase user, WorldBase world, Vector2 location, GameTime time, BinaryInputManager manager) { if (manager.click()) { if (charges > 0) { SoundManager.getSound("card-use-" + (level - 1)).playWithVariance(0, .5f, 0, SoundType.MONSTER); Vector2 teleportLoc = new Vector2(); Vector2 preTeleportLoc = user.location; if (location.X < user.location.X) { teleportLoc = new Vector2(user.location.X - level * 2 * Chunk.tileDrawWidth - Chunk.tileDrawWidth * 3, user.location.Y); TileType teleportTo = world.getBlock(teleportLoc); while (teleportTo != null && teleportTo.tags.Contains(TagReferencer.SOLID)) { teleportLoc += new Vector2(Chunk.tileDrawWidth, 0); teleportTo = world.getBlock(teleportLoc); } user.location = teleportLoc; charges--; } else if (location.X > user.location.X) { teleportLoc = new Vector2(user.location.X + level * 2 * Chunk.tileDrawWidth + Chunk.tileDrawWidth * 3, user.location.Y); TileType teleportTo = world.getBlock(teleportLoc); while (teleportTo != null && teleportTo.tags.Contains(TagReferencer.SOLID)) { teleportLoc += new Vector2(-Chunk.tileDrawWidth, 0); teleportTo = world.getBlock(teleportLoc); } user.location = teleportLoc; charges--; } for (int i = 0; i < 7; i++) { ParticleArbitrary teleportParticle = new ParticleArbitrary(preTeleportLoc + (teleportLoc - preTeleportLoc) * (float)i / 7, world, new Vector2(), (int)(75 * (1 - 1f / (i + 1))), ((Player)user).texture_run[0]); if (preTeleportLoc.X < teleportLoc.X) { teleportParticle.flip = true; } teleportParticle.gravityMultiplier = 0; teleportParticle.endColor = teleportParticle.endColor * .01f; world.addEntity(teleportParticle); } if (user.inventory.getItemOfType(new Item_Macuhatil(1)) != null) { for (int i = 0; i < 7; i++) { ParticleArbitrary teleportParticle = new ParticleArbitrary(preTeleportLoc + (teleportLoc - preTeleportLoc) * (float)i / 7 + new Vector2(0, -10), world, new Vector2(), (int)(75 * (1 - 1f / (i + 1))), Game1.texture_item_macuhatil); teleportParticle.gravityMultiplier = -.1f; teleportParticle.endColor = Color.Red; world.addEntity(teleportParticle); EntityMacuhatilSlash macuhatilSlash = new EntityMacuhatilSlash(preTeleportLoc + (teleportLoc - preTeleportLoc) * (float)i / 7, world, user); macuhatilSlash.velocity += Vector2.Normalize(location - user.location) * .1f; world.addEntity(macuhatilSlash); SoundManager.getSound("sword-slash").playWithVariance(-.5f, .4f, 0, SoundType.MONSTER); } } else if (user.inventory.getItemOfType(new Item_Sword(1)) != null) { for (int i = 0; i < 7; i++) { ParticleArbitrary teleportParticle = new ParticleArbitrary(preTeleportLoc + (teleportLoc - preTeleportLoc) * (float)i / 7 + new Vector2(0, -10), world, new Vector2(), (int)(75 * (1 - 1f / (i + 1))), Game1.texture_item_sword); teleportParticle.gravityMultiplier = -.1f; teleportParticle.endColor = Color.Red; world.addEntity(teleportParticle); EntitySwordSlash swordSlash = new EntitySwordSlash(preTeleportLoc + (teleportLoc - preTeleportLoc) * (float)i / 7, world, user); swordSlash.canUnlockWarrior = true; swordSlash.velocity += Vector2.Normalize(location - user.location) * .1f; world.addEntity(swordSlash); SoundManager.getSound("sword-slash").playWithVariance(0f, .4f, 0, SoundType.MONSTER); } } } else { user.speechManager.addSpeechBubble(Game1.texture_item_charmstone); } } else if (manager.isDown()) { if (charges > 0) { Vector2 teleportLoc = new Vector2(); Vector2 preTeleportLoc = user.location; if (location.X < user.location.X) { teleportLoc = new Vector2(user.location.X - level * 2 * Chunk.tileDrawWidth - Chunk.tileDrawWidth * 3, user.location.Y); TileType teleportTo = world.getBlock(teleportLoc); while (teleportTo != null && teleportTo.tags.Contains(TagReferencer.SOLID)) { teleportLoc += new Vector2(Chunk.tileDrawWidth, 0); teleportTo = world.getBlock(teleportLoc); } } else if (location.X > user.location.X) { teleportLoc = new Vector2(user.location.X + level * 2 * Chunk.tileDrawWidth + Chunk.tileDrawWidth * 3, user.location.Y); TileType teleportTo = world.getBlock(teleportLoc); while (teleportTo != null && teleportTo.tags.Contains(TagReferencer.SOLID)) { teleportLoc += new Vector2(-Chunk.tileDrawWidth, 0); teleportTo = world.getBlock(teleportLoc); } } ParticleArbitrary teleportParticle = new ParticleArbitrary(preTeleportLoc + (teleportLoc - preTeleportLoc), world, new Vector2(), 7, ((Player)user).texture_run[0]); if (preTeleportLoc.X < teleportLoc.X) { teleportParticle.flip = true; } teleportParticle.gravityMultiplier = 0; teleportParticle.startColor = Color.Lerp(teleportParticle.startColor, Color.White, .5f); teleportParticle.endColor = teleportParticle.endColor * .01f; world.addEntity(teleportParticle); } } }