public override void knockBack(Vector2 direction, float magnitude, int damage, Entity attacker) { if (disable_movement_time == 0.0) { disable_movement = true; current_skeleton.Animation = current_skeleton.Skeleton.Data.FindAnimation("hurt"); if (Math.Abs(direction.X) > (Math.Abs(direction.Y))) { if (direction.X < 0) { velocity = new Vector2(-2.0f * magnitude, direction.Y / 100 * magnitude); direction_facing = GlobalGameConstants.Direction.Right; } else { velocity = new Vector2(2.0f * magnitude, direction.Y / 100 * magnitude); direction_facing = GlobalGameConstants.Direction.Left; } } else { if (direction.Y < 0) { velocity = new Vector2(direction.X / 100f * magnitude, -2.0f * magnitude); direction_facing = GlobalGameConstants.Direction.Down; } else { velocity = new Vector2((direction.X / 100f) * magnitude, 2.0f * magnitude); direction_facing = GlobalGameConstants.Direction.Up; } } enemy_life = enemy_life - damage; state = SquadLeaderState.Patrol; } if (attacker == null) { return; } else if (attacker.Enemy_Type != enemy_type && attacker.Enemy_Type != EnemyType.NoType) { enemy_found = true; entity_found = attacker; if (enemy_life < 1 && !death && attacker != null & attacker is Player) { GameCampaign.AlterAllegiance(-0.05f); } switch (attacker.Direction_Facing) { case GlobalGameConstants.Direction.Right: direction_facing = GlobalGameConstants.Direction.Left; break; case GlobalGameConstants.Direction.Left: direction_facing = GlobalGameConstants.Direction.Right; break; case GlobalGameConstants.Direction.Up: direction_facing = GlobalGameConstants.Direction.Down; break; default: direction_facing = GlobalGameConstants.Direction.Up; break; } } }
private void loadContent2() { #if XBOX Thread.CurrentThread.SetProcessorAffinity(3); #endif backGroundPic = Content.Load <Texture2D>("titleScreenPic"); frostTreeLogo = Content.Load <Texture2D>("FrostTreeLogo"); testArrow = Content.Load <Texture2D>("gfx/testArrow"); laserPic = Content.Load <Texture2D>("gfx/laser"); healthBar = Content.Load <Texture2D>("bg"); healthColor = Content.Load <Texture2D>("healthTexture"); energyColor = Content.Load <Texture2D>("ammoTexture"); energyOverlay = Content.Load <Texture2D>("overlay"); popUpBackground = Content.Load <Texture2D>("popUpBackground"); greyBar = Content.Load <Texture2D>("grayTexture"); creditImage = Content.Load <Texture2D>("EndCredits"); heartPic = Content.Load <Texture2D>("heartSheet"); guardIcon = Content.Load <Texture2D>("guard"); prisonerIcon = Content.Load <Texture2D>("prisoner"); p2Icon = Content.Load <Texture2D>("P2Icon"); TextureLib ts = new TextureLib(GraphicsDevice); TextureLib.loadFromManifest(); aspectRatio = graphics.GraphicsDevice.Viewport.AspectRatio; bloomFilter = Content.Load <Effect>("BloomShader"); BackGroundAudio music = new BackGroundAudio(Content); music.addSong("Menu"); music.addSong("RPG Game"); AudioLib lb = new AudioLib(); tenbyFive8 = Content.Load <SpriteFont>("tenbyFive/tenbyFive8"); tenbyFive10 = Content.Load <SpriteFont>("tenbyFive/tenbyFive10"); tenbyFive14 = Content.Load <SpriteFont>("tenbyFive/tenbyFive14"); tenbyFive24 = Content.Load <SpriteFont>("tenbyFive/tenbyFive24"); tenbyFive72 = Content.Load <SpriteFont>("tenbyFive/tenbyFive72"); font = tenbyFive14; testComputerFont = tenbyFive24; levelExitVideo = Content.Load <Video>("fmv/elevatorExit"); levelEnterVideo = Content.Load <Video>("fmv/levelStart"); titleScreenVideo = Content.Load <Video>("fmv/menu"); introCutScene = Content.Load <Video>("fmv/intro"); introCutSceneCoop = Content.Load <Video>("fmv/intro COOP"); levelEnterVideoCoop = Content.Load <Video>("fmv/levelStartCOOP"); levelExitVideoCoop = Content.Load <Video>("fmv/elevatorExitCOOP"); guardEndCutScene = Content.Load <Video>("fmv/endGuardSingle"); alienEndCutScene = Content.Load <Video>("fmv/endAlienSingle"); prisonerEndCutScene = Content.Load <Video>("fmv/endPrisonerSingle"); guardEndCutSceneCoop = Content.Load <Video>("fmv/endGuardCoop"); alienEndCutSceneCoop = Content.Load <Video>("fmv/endAlienCoop"); prisonerEndCutSceneCoop = Content.Load <Video>("fmv/endPrisonerCoop"); videoPlayer = new VideoPlayer(); ChunkLib cs = new ChunkLib(); AnimationLib.loadFrameFromManifest(); GlobalGameConstants.WeaponDictionary.InitalizePriceData(); GameCampaign.InitalizeCampaignData(); GameCampaign.ResetPlayerValues("INIT", 0); // lol so many game screens currentGameScreen = new TitleScreen(TitleScreen.titleScreens.logoScreen); //currentGameScreen = new CutsceneVideoState(testVideo, ScreenState.ScreenStateType.LevelReviewState); //currentGameScreen = new CampaignLobbyState(); //currentGameScreen = new HighScoresState(true); // DANIEL UNCOMMMENT THIS LINE BEFORE YOU MERGE WITH MASTER preloadedAssets = true; }
public override void knockBack(Vector2 direction, float magnitude, int damage, Entity attacker) { if (!death) { if (disable_movement_time == 0.0) { if (state != ChargerState.windUp && state != ChargerState.charge) { disable_movement = true; animation_time = 0; AudioLib.playSoundEffect("fleshyKnockBack"); if (Math.Abs(direction.X) > (Math.Abs(direction.Y))) { if (direction.X < 0) { velocity = new Vector2(-5.51f * magnitude, direction.Y / 100 * magnitude); } else { velocity = new Vector2(5.51f * magnitude, direction.Y / 100 * magnitude); } } else { if (direction.Y < 0) { velocity = new Vector2(direction.X / 100f * magnitude, -5.51f * magnitude); } else { velocity = new Vector2((direction.X / 100f) * magnitude, 5.51f * magnitude); } } } enemy_life = enemy_life - damage; if (enemy_life < 1 && !death) { if (attacker != null & attacker is Player) { GameCampaign.AlterAllegiance(0.1f); } } } if (attacker == null) { return; } if (attacker.Enemy_Type != enemy_type && attacker.Enemy_Type != EnemyType.NoType) { enemy_found = true; entity_found = attacker; switch (attacker.Direction_Facing) { case GlobalGameConstants.Direction.Right: direction_facing = GlobalGameConstants.Direction.Left; break; case GlobalGameConstants.Direction.Left: direction_facing = GlobalGameConstants.Direction.Right; break; case GlobalGameConstants.Direction.Up: direction_facing = GlobalGameConstants.Direction.Down; break; default: direction_facing = GlobalGameConstants.Direction.Up; break; } } } parentWorld.Particles.pushBloodParticle(CenterPoint); parentWorld.Particles.pushBloodParticle(CenterPoint); parentWorld.Particles.pushBloodParticle(CenterPoint); }
public override void knockBack(Vector2 direction, float magnitude, int damage, Entity attacker) { if (guardState == PatrolGuardState.KnockBack) { return; } health -= damage; if (health <= 0 && guardState != PatrolGuardState.Dying) { if (attacker is Player) { GameCampaign.AlterAllegiance(-0.01f); } guardState = PatrolGuardState.Dying; animation_time = 0; velocity = Vector2.Zero; dimensions /= 8; parentWorld.pushCoin(this); death = true; return; } else if (guardState == PatrolGuardState.Dying) { parentWorld.Particles.pushBloodParticle(CenterPoint); parentWorld.Particles.pushBloodParticle(CenterPoint); parentWorld.Particles.pushBloodParticle(CenterPoint); if (deadCushySoundTimer > 500f) { AudioLib.playSoundEffect("fleshyKnockBack"); deadCushySoundTimer = 0; } return; } direction.Normalize(); velocity = direction * (magnitude / 2); knockBackTime = 0.0f; guardState = PatrolGuardState.KnockBack; animation_time = 0; parentWorld.Particles.pushBloodParticle(CenterPoint); parentWorld.Particles.pushBloodParticle(CenterPoint); parentWorld.Particles.pushBloodParticle(CenterPoint); AudioLib.playSoundEffect("fleshyKnockBack"); //where you look in the entity's direction and start chasing them if (attacker != null && (attacker.Enemy_Type != EnemyType.NoType && attacker.Enemy_Type != enemy_type)) { target = attacker; } }
public override void knockBack(Vector2 direction, float magnitude, int damage, Entity attacker) { if (death == false) { if (molotovState == MolotovState.KnockedBack) { return; } if (molotovState == MolotovState.Dying) { parentWorld.Particles.pushBloodParticle(CenterPoint); parentWorld.Particles.pushBloodParticle(CenterPoint); parentWorld.Particles.pushBloodParticle(CenterPoint); return; } direction.Normalize(); velocity = direction * magnitude; health -= damage; if (health < 1 && !death && attacker != null & attacker is Player) { GameCampaign.AlterAllegiance(0.015f); } knockBackTime = 0.0f; animation_time = 0; parentWorld.Particles.pushBloodParticle(CenterPoint); parentWorld.Particles.pushBloodParticle(CenterPoint); parentWorld.Particles.pushBloodParticle(CenterPoint); AudioLib.playSoundEffect("fleshyKnockBack"); if (health > 0) { molotovState = MolotovState.KnockedBack; } else { molotovState = MolotovState.Dying; death = true; //parentWorld.pushCoin(CenterPoint, Coin.DropItemType.CoinDrop, (int)Coin.CoinValue.Laurier); //parentWorld.pushCoin(CenterPoint, Coin.DropItemType.CoinDrop, (int)Coin.CoinValue.MacDonald); dimensions /= 8; directionAnims[(int)direction_facing].Animation = directionAnims[(int)direction_facing].Skeleton.Data.FindAnimation(deathAnims[Game1.rand.Next() % 3]); parentWorld.pushCoin(this); } if (attacker == null) { return; } else if (attacker.Enemy_Type != enemy_type && attacker.Enemy_Type != EnemyType.NoType) { entity_found = attacker; enemy_found = true; } } }
public override void knockBack(Vector2 direction, float magnitude, int damage, Entity attacker) { if (death == false) { if (disable_movement_time == 0.0) { disable_movement = true; AudioLib.stopFlameSoundEffect(); if (Math.Abs(direction.X) > (Math.Abs(direction.Y))) { if (direction.X < 0) { velocity = new Vector2(-2.0f * magnitude, direction.Y / 100 * magnitude); } else { velocity = new Vector2(2.0f * magnitude, direction.Y / 100 * magnitude); } } else { if (direction.Y < 0) { velocity = new Vector2(direction.X / 100f * magnitude, -2.0f * magnitude); } else { velocity = new Vector2((direction.X / 100f) * magnitude, 2.0f * magnitude); } } enemy_life = enemy_life - damage; if (!death && enemy_life < 1 && attacker != null & attacker is Player) { AudioLib.stopFlameSoundEffect(); GameCampaign.AlterAllegiance(-0.01f); } } if (attacker == null) { return; } else if (attacker.Enemy_Type != enemy_type && attacker.Enemy_Type != EnemyType.NoType) { enemy_found = true; entity_found = attacker; switch (attacker.Direction_Facing) { case GlobalGameConstants.Direction.Right: direction_facing = GlobalGameConstants.Direction.Left; break; case GlobalGameConstants.Direction.Left: direction_facing = GlobalGameConstants.Direction.Right; break; case GlobalGameConstants.Direction.Up: direction_facing = GlobalGameConstants.Direction.Down; break; default: direction_facing = GlobalGameConstants.Direction.Up; break; } } } }