/// <summary> /// Allows the game to perform any initialization it needs to before starting to run. /// This is where it can query for any required services and load any non-graphic /// related content. Calling base.Initialize will enumerate through any components /// and initialize them as well. /// </summary> protected override void Initialize() { // TODO: Add your initialization logic here mBackground = new Sprite(); mPlayer = new Player(); base.Initialize(); }
/// <summary> /// Allows the game to perform any initialization it needs to before starting to run. /// This is where it can query for any required services and load any non-graphic /// related content. Calling base.Initialize will enumerate through any components /// and initialize them as well. /// </summary> protected override void Initialize() { // TODO: Add your initialization logic here player1 = new Player(new Vector2(Window.ClientBounds.Width/4, Window.ClientBounds.Height - 114), Keys.D, 1); player2 = new Player(new Vector2(Window.ClientBounds.Width * 3 / 4, Window.ClientBounds.Height - 114), Keys.S, -1); base.Initialize(); }
public PlayerPrism(Level Parent, Vector2 Position, Player player) { parent = Parent; position = Position; bounds = new BoundingBox(new Vector3(position.X - 20, position.Y - 20, -1), new Vector3(position.X + 20, position.Y + 20, 1)); player_color = player.Color; }
public ScriptHandler(Maps newmap, Player newplayer, Itemhandler newitems, Game1 newgame = null) { activescript = new Script("null"); map = newmap; player = newplayer; items = newitems; game = newgame; IFstack = new List<bool>(); }
/// <summary> /// Allows the game to perform any initialization it needs to before starting to run. /// This is where it can query for any required services and load any non-graphic /// related content. Calling base.Initialize will enumerate through any components /// and initialize them as well. /// </summary> protected override void Initialize() { // TODO: Add your initialization logic here ScreenWidth = GraphicsDevice.Viewport.Width; ScreenHeight = GraphicsDevice.Viewport.Height; //Init player player = new Player(graphics); base.Initialize(); }
public Menu(LevelManager Parent, Player Player) { parent = Parent; player = Player; font = parent.font; current_index = 0; x_position = 400; y_position = 400; y_spacing = 20; x_spacing = 0; }
Texture2D yellowTile; //Gul brikke - level ferdig #endregion Fields #region Constructors public Game1() { graphics = new GraphicsDeviceManager(this); Content.RootDirectory = "Content"; //Setter høyde og bredde. graphics.PreferredBackBufferWidth = 800; graphics.PreferredBackBufferHeight = 600; graphics.ApplyChanges(); player = new Player(new Vector2(32, 544)); }
/// <summary> /// Allows the game to perform any initialization it needs to before starting to run. /// This is where it can query for any required services and load any non-graphic /// related content. Calling base.Initialize will enumerate through any components /// and initialize them as well. /// </summary> protected override void Initialize() { // TODO: Add your initialization logic here W = Window.ClientBounds.Width; H = Window.ClientBounds.Height; _ground1 = new Ground(0, (H - 20)); _ground2 = new Ground(0, 0); _goku = new Player(); base.Initialize(); }
public void AddEgg(Player player, Color tint) { var egg = new Egg(player.playerIndex); egg.Tint = tint; egg.SourceRect = egg.DestinationRect = new Rectangle(666, 818, 50, 59); egg.DestinationRect.X = player.DestinationRect.X; egg.DestinationRect.Y = player.DestinationRect.Y; eggs.Add(egg); effectFall.Play(); }
public Card(Card c) { this.id = c.id; selected = false; mouseOver = false; texture = c.texture; z = x = y = 0; size = new Rectangle(x, y, 0, 0); owner = null; this.name = c.name; this.cost = c.cost; this.points = c.points; this.world = c.world; this.startingWorld = c.startingWorld; this.military = c.military; this.windfall = c.windfall; this.explore = c.explore; this.develop = c.develop; this.settle = c.settle; this.trade = c.trade; this.consume = c.consume; this.produce = c.produce; this.produceColor = c.produceColor; this.tempMilitary = c.tempMilitary; this.freeWorld = c.freeWorld; this.tradeThis = c.tradeThis; this.produceThisDraw = c.produceThisDraw; }
public Card(int id,string name,int cost,int points,bool world,bool startingWorld,bool military,string windfall,string explore,string develop,string settle,string trade,string consume,string produce) { this.id = id; texture = null; selected = false; z = x = y = 0; size=new Rectangle(x,y,0,0); mouseOver = false; owner = null; this.name = name; this.cost = cost; this.points = points; this.world = world; this.startingWorld = startingWorld; this.military = military; this.windfall = windfall; this.explore = explore; this.develop = develop; this.settle = settle; this.trade = trade; this.consume = consume; this.produce = produce; tempMilitary = 0; }
public GameEngine(int w, int h) { player = new Player(); weapon = new Weapon(52, 54, -52, 54); weapon.standing_dt = 0.25f; player.bound.Height = 50; player.bound.Width = 50; projectiles = new List<Projectile>(); zombies = new List<Zombie>(); width = w; height = h; tm = new TextureManager(); }
public GameSpace(Player p1) { m_WhichPlayer = p1; m_blocks = new List<FadeBlock>(); for (int i = 0; i < 6; ++i) { FadeBlock block = new FadeBlock(); m_blocks.Add(block); } m_Paddle = new Paddle(); m_PaddleBehind = new Paddle(); mFadeBlocks = new int[6]; for (int i = 0; i < mFadeBlocks.Length; ++i) { mFadeBlocks[i] = i + 1; } }
public void AddIntercepter(Player player) { var inter = new Intercepter(player.playerIndex); inter.SourceRect = texInter.Bounds; inter.DestinationRect = new Rectangle(0, 0, 36, 15); inter.DestinationRect.X = player.DestinationRect.X + (int)player.locMouth.X; inter.DestinationRect.Y = player.DestinationRect.Y + (int)player.locMouth.Y; inters.Add(inter); effectShoot.Play(); }
// ---------------- public override void LoadContent(Rectangle screenBounds) { base.LoadContent(screenBounds); effectShoot = TheGame.Content.Load<SoundEffect>("spit"); // --- NEW CODE --- effectFall = TheGame.Content.Load<SoundEffect>("fall"); effectSnort = TheGame.Content.Load<SoundEffect>("snort"); effectSqueal = TheGame.Content.Load<SoundEffect>("squeal"); effectSquawk = TheGame.Content.Load<SoundEffect>("squawk"); fontScore = TheGame.Content.Load<SpriteFont>("scores"); // ---------------- texSprites = TheGame.Content.Load<Texture2D>("sprites"); texBirds = TheGame.Content.Load<Texture2D>("ingamebirds1"); texClouds = TheGame.Content.Load<Texture2D>("clouds"); texCarrier = TheGame.Content.Load<Texture2D>("CarrierSide"); texInter = TheGame.Content.Load<Texture2D>("Interceptorjetpack"); texPlasma = TheGame.Content.Load<Texture2D>("plasma"); maxX = 2 * bounds.Width / 3; restingX = (maxX - 10) / 5 + 10; Rectangle rect = new Rectangle(10, 10, 92, 93); maxY = bounds.Height - rect.Height - 10; thePlayer1 = new Player(PlayerIndex.One, restingX-25, maxX, maxY); thePlayer1.DestinationRect = rect; //thePlayer1.SourceRect = new Rectangle(400, 545, 92, 93); thePlayer1.SourceRect = texCarrier.Bounds; thePlayer1.DestinationRect.Width = thePlayer1.SourceRect.Width; thePlayer1.DestinationRect.Height = thePlayer1.SourceRect.Height; thePlayer1.locMouth.X = rect.Width / 2; thePlayer1.locMouth.Y = rect.Height / 2; rect = new Rectangle(10, 75, 100, 100); maxY = bounds.Height - rect.Height - 10; thePlayer2 = new Player(PlayerIndex.Two, restingX+25, maxX, maxY); thePlayer2.DestinationRect = rect; thePlayer2.SourceRect = new Rectangle(142,405, 100, 100); thePlayer2.locMouth.X = rect.Width / 2; thePlayer2.locMouth.Y = rect.Height / 2; // green 285,430,104,75 rect = new Rectangle(10, 150, 104, 75); maxY = bounds.Height - rect.Height - 10; thePlayer3 = new Player(PlayerIndex.Three, restingX-25, maxX, maxY); thePlayer3.DestinationRect = rect; thePlayer3.SourceRect = new Rectangle(285, 430, 104, 75); thePlayer3.locMouth.X = rect.Width / 2; thePlayer3.locMouth.Y = rect.Height / 2; // black 430,430,65,75 rect = new Rectangle(10, 225, 65, 75); maxY = bounds.Height - rect.Height - 10; thePlayer4 = new Player(PlayerIndex.Four, restingX+25, maxX, maxY); thePlayer4.DestinationRect = rect; thePlayer4.SourceRect = new Rectangle(430, 430, 65, 75); thePlayer4.locMouth.X = rect.Width / 2; thePlayer4.locMouth.Y = rect.Height / 2; // --- NEW CODE --- //rectClouds = texClouds.Bounds; songMusic = TheGame.Content.Load<Song>("music"); MediaPlayer.Play(songMusic); MediaPlayer.IsRepeating = true; MediaPlayer.Volume = 0.25f; texParallax = TheGame.Content.Load<Texture2D>("parallax"); beHillFront = new BackgroundElement( new Rectangle(0, 646, 1024, 378), new Rectangle(0, bounds.Height - 350, 1024, 378), -2.1f); beHillFront.Tint = new Color(0.9f, 0.9f, 1.0f); beHillBack = new BackgroundElement( new Rectangle(0, 646, 1024, 378), new Rectangle(0, bounds.Height - 390, 1536, 378), -0.5f); beHillMid = new BackgroundElement( new Rectangle(0, 353, 1024, 292), new Rectangle(0, bounds.Height - 385, 1536, 292), -1.4f); beSky = new BackgroundElement( texClouds.Bounds, texClouds.Bounds, -0.2f); // ---------------- }
public void AddSeed(Player player) { var seed = new Seed(player.playerIndex); seed.SourceRect = new Rectangle(3, 825, 38, 10); seed.DestinationRect = new Rectangle(3, 825, 38, 10); seed.DestinationRect.X = player.DestinationRect.X + (int)player.locMouth.X; seed.DestinationRect.Y = player.DestinationRect.Y + (int)player.locMouth.Y; seeds.Add(seed); effectShoot.Play(); }
public void AddLaser(Player player, Color tint) { var laser = new Laser(player.playerIndex); laser.Tint = tint; laser.SourceRect = texPlasma.Bounds; laser.DestinationRect = texPlasma.Bounds; laser.DestinationRect.X = player.DestinationRect.X; laser.DestinationRect.Y = player.DestinationRect.Y; lasers.Add(laser); effectFall.Play(); }
public void setupSettlePhase(Player player) { //TODO: Give player power to draw card for choosing this phase if (!phasesSelected[2]) { phaseMessage = "Settle phase not chosen. Moving to next phase."; allSections[4] = new Section(4, 0, this); allSections[4].minSelectable = 0; skipPhase = true; return; } phaseMessage = settlePhaseMessage;//"Settle phase: Choose one world from your hand. Then select cards to pay for it."; //Clear out phaseSection until we've chosen a thing to build allSections[4] = new Section(4, 0, this); allSections[4].resetSection(); //player can choose one card from hand to develop player.hand.isSelectable = true; player.hand.maxSelectable = 1; player.hand.minSelectable = 0; //Give player temp card draw if (player.phaseSelected.Equals("III")) player.settleDrawAfter++; }
public void setupSelectionPhase(Player player) { //Need user to select exactly 1 card before this is ok to hit allSections[7].isSelectable = false; allSections[4].isSelectable = true; allSections[4].minSelectable = 1; allSections[4].maxSelectable = 1; }
public void Draw(SpriteBatch spriteBatch, Player player) { foreach (Blocks block in Blocks.BlockList) { if (block.IsActive) { if (player.GetType() == typeof(Jekyll) && player.IsActiveVision) { if (block.IsJekyllVisible) spriteBatch.Draw(block.Texture, block.HitBox, Color.Yellow); else spriteBatch.Draw(block.Texture, block.HitBox, Color.Blue); } else if (player.GetType() == typeof(Hide) && player.IsActiveVision) { if (block.IsHideVisible) spriteBatch.Draw(block.Texture, block.HitBox, Color.Yellow); else spriteBatch.Draw(block.Texture, block.HitBox, Color.Red); } else if (!player.Statut && player.IsActiveObject && InventoryCase.InventoryCaseList[0].Status) { spriteBatch.Draw(block.Texture, block.HitBox, Color.LightGreen); } else { spriteBatch.Draw(block.Texture, block.HitBox, Color.White); } } } foreach (Camera cam in Camera.CamerasBlockList) { if (cam.IsActive) cam.Draw(spriteBatch); } foreach (MovableEnnemyBlock block in MovableEnnemyBlock.MovableEnnemyList) { if (block.IsActive) block.Draw(spriteBatch); } if (puzzle0 != null) puzzle0.Draw(spriteBatch); else if (puzzle1 != null) puzzle1.Draw(spriteBatch); if (player.IsThrowing) { if (player.ThrowId == 1) spriteBatch.Draw(cible.Texture, cible.HitBox, Color.White); } if (cible.IsItemThrow) { cible.TimerThrow++; if (cible.TimerThrow == 4) { cible.TimerThrow = 0; if (!cible.IsItemCrash) { if (cible.ItemColumn < 7) cible.ItemColumn++; else cible.ItemColumn = 0; } else { if (cible.ItemColumn < 1) cible.ItemColumn++; else cible.IsItemThrow = false; } } Texture2D text; text = cible.IsItemCrash ? Ressources.bottle_crash : Ressources.bottle; spriteBatch.Draw(text, cible.ItemBox, new Rectangle((cible.ItemColumn * 15), 0, 15, 15), Color.White, 0f, new Vector2(0, 0), SpriteEffects.None, 0f); cible.CheckMove(); } if (cible.IsBoxThrow) { if (!cible.IsBoxCrash && cible.IsBoxLaunch) { Texture2D text = Ressources.boxH; spriteBatch.Draw(text, cible.BoxBox, new Rectangle(0, 0, 40, 70), Color.White, 0f, new Vector2(0, 0), SpriteEffects.None, 0f); cible.CheckBoxMove(); } } }
public void setupExplorePhase(Player player) { if (!phasesSelected[0]) { phaseMessage = "Explore phase not chosen. Moving to next phase."; allSections[4] = new Section(4, 0, this); allSections[4].minSelectable = 0; skipPhase = true; return; } if (player.phaseSelected.Equals("I")) { int drawCards = 3 + player.exploreDraw; int keepCards = 2 + player.exploreKeep; //draw 3, discard 1 allSections[4] = new Section(4, drawCards, this); allSections[4].maxSelectable = keepCards;//how many can be selected to keep allSections[4].minSelectable = keepCards;//how many can be selected to keep } else if (player.phaseSelected.Equals("I:2")) { int drawCards = 7 + player.exploreDraw; int keepCards = 1 + player.exploreKeep; //draw 7,discard 6 allSections[4] = new Section(4, drawCards, this); allSections[4].maxSelectable = keepCards;//how many can be selected to keep allSections[4].minSelectable = keepCards;//how many can be selected to keep } else { int drawCards=2 + player.exploreDraw; int keepCards=1 + player.exploreKeep; //draw 2,discard 1 allSections[4] = new Section(4, drawCards, this); allSections[4].maxSelectable = keepCards;//how many can be selected to keep allSections[4].minSelectable = keepCards;//how many can be selected to keep } //populate section with cards from deck for (int i = 0; i < allSections[4].Capacity; i++) { allSections[4].AddCard(deck.Dequeue()); } explorePhaseMessage = "Explore phase: Select " + allSections[4].minSelectable + " cards to keep."; phaseMessage = explorePhaseMessage; allSections[4].isSelectable = true; allSections[4].resetSection(); allSections[7].isSelectable = false; }
public void setupDevelopPhase(Player player) { //TODO: Give player discount for choosing this phase if (!phasesSelected[1]) { phaseMessage = "Develop phase not chosen. Moving to next phase."; allSections[4] = new Section(4, 0, this); allSections[4].minSelectable = 0; skipPhase = true; return; } phaseMessage = developPhaseMessage;//"Develop phase: Choose one building from your hand. Then select cards to pay for it."; //Clear out phaseSection until we've chosen a thing to build allSections[4] = new Section(4, 0, this); allSections[4].resetSection(); //drawCards if have special power for (int i = 0; i < player.developDraw; i++) { player.addCardToHand(deck.Dequeue()); } //player can choose one card from hand to develop allSections[6].isSelectable = true; allSections[6].maxSelectable = 1; allSections[6].minSelectable = 0; //Give player temp cost reduction if(player.phaseSelected.Equals("II")) player.developReduce++; }
public void setupConsumePhase(Player player) { if (!phasesSelected[3]) { phaseMessage = "Consume phase not chosen. Moving to next phase."; allSections[4] = new Section(4, 0, this); allSections[4].minSelectable = 0; skipPhase = true; return; } bool canConsume = false; foreach(Card c in allSections[5]) { if (c.consumeAll || c.consumePower != null) { canConsume = true; c.hasBorder = true; } } if (canConsume) { canConsume = !playerConsumeComplete(player); } if (!canConsume) { phaseMessage = "No available consume powers. Mobing to bext phae"; allSections[4] = new Section(4, 0, this); allSections[4].minSelectable = 0; skipPhase = true; return; } //Set up regular consume phase phaseMessage = "Choose a card with a consume power you wish to use."; allSections[5].minSelectable = 1; allSections[5].maxSelectable = 1; allSections[5].isSelectable = true; allSections[7].AddCard(deck.Dequeue()); allSections[7].isSelectable = true; allSections[7].resetSection(); }
public bool playerConsumeComplete(Player player) { if (player.myConsumePowers.Count > 0) return true; //TODO check if 'all' has been used - aka check if any goods are left return false; }
public void setupWaitPhase(Player player) { //Need clear out other sections allSections[4] = new Section(4, 0, this); allSections[4].minSelectable = 0; allSections[4].maxSelectable = 0; allSections[6].isSelectable = false; allSections[5].isSelectable = false; }
public void Slide(int i, Player player) { foreach (Blocks block in Blocks.BlockList) { if (player.IsJumping) block.DecreaseCoordBlockX(i); else block.DecreaseCoordBlockX(i); } foreach (Camera cam in Camera.CamerasBlockList) { if (player.IsJumping) cam.DecreaseSpotCoordBlockX(i); else cam.DecreaseSpotCoordBlockX(i); } foreach (MovableEnnemyBlock block in MovableEnnemyBlock.MovableEnnemyList) { if (player.IsJumping) block.DecreaseCoordBlockX(i); else block.DecreaseCoordBlockX(i); } }
public void SetPlayerAccelMode(GameTime gameTime, Player player) { if (player.Statut) { if (!player.IsJumping && !player.IsAttacking && player.CanMove && player.Speed <= 3) player.Speed += 0.01f; if (player.Speed <= 2) { player.AccelMode = 1; } else if (player.Speed > 2 && player.Speed <= 3.1f) { player.AccelMode = 2; } else if (player.Speed == 9) { player.AccelMode = 3; } } else { if (player.CanMove && player.Speed <= 3) player.Speed += 0.01f; if (player.Speed <= 2) { player.AccelMode = 1; } else if (player.Speed > 2 && player.Speed <= 3) { player.AccelMode = 2; } } }
public void setupProducePhase(Player player) { if (!phasesSelected[4]) { phaseMessage = "Produce phase not chosen. Moving to next phase."; allSections[4] = new Section(4, 0, this); allSections[4].minSelectable = 0; skipPhase = true; return; } }
public void setupTradePhase(Player player) { //TODO: Don't show anything if player didn't choose trade power //If we didn't pick trade, move to regular consume if (!player.phaseSelected.Equals("$")) { phaseMessage = "Didn't pick Trade. Moving to Consume phase."; allSections[4] = new Section(4, 0, this); allSections[4].minSelectable = 0; skipPhase = true; return; } allSections[4] = new Section(4, 2, this); //Move all cards from tableau, with goods, to section 4 foreach (Card c in allSections[5]) { if (c.hasGood) { allSections[4].AddCard(new Card(c)); } } if (allSections[4].Count < 1) { phaseMessage = "You chose trade phase but have no goods. You can't do anything. Doofus"; allSections[7].isSelectable = true; //nextPhase(); return; } phaseMessage = "Choose one good to trade in for cards."; allSections[4].minSelectable = 1; allSections[4].maxSelectable = 1; allSections[4].isSelectable = true; allSections[4].resetSection(); return; }
public void Update(KeyboardState keyboard, GamePadState pad, MouseState mouse, GameTime gameTime, Player player) { if (FirstGame.checkpoint && !slide) { this.Slide(600, player); slide = true; } if (GameMain.Status != "inventory") { if (player.GetType() == typeof(Jekyll)) { foreach (InteractZoneBlockWithPuzzle interBlock in InteractZoneBlockWithPuzzle.InteractZoneBlockList) { if (player.HitBox.Intersects(interBlock.HitBox)) { if (interBlock.IsActivate) { if (interBlock.Id == 0) { if (puzzle0 == null) puzzle0 = new Puzzle0(); else puzzle0.Update(pad, gameTime); } else if (interBlock.Id == 1) { if (puzzle1 == null) puzzle1 = new Puzzle1(); else puzzle1.Update(pad, gameTime); } if (puzzle0 != null && !puzzle0.Status) { interBlock.IsActivate = false; if (puzzle0.Success) { MovableNeutralBlock.MovableNeutralList[0].Activate = true; } puzzle0 = null; puzzle1 = null; GameMain.Status = "on"; } } else { if (pad.IsButtonDown(Buttons.A) && oldPad.IsButtonUp(Buttons.A)) { interBlock.IsActivate = true; GameMain.Status = "pause"; } } } } } } if (GameMain.Status == "on") { futurePos = player.HitBox; if (!player.IsAttacking) player.CheckMove(); // Animation des blocs mouvants foreach (EndZoneBlock endzone in EndZoneBlock.EndZoneBlockList) { if (player.HitBox.Intersects(endzone.HitBox)) { FirstGame.start = false; FirstGame.end = true; FirstGame.Hp = AlignementGUI._value/4; FirstGame.Jp = 100 - FirstGame.Hp; } } foreach (SkillPointsBonusBlock bonus in SkillPointsBonusBlock.SkillPointsBonusList) { if (bonus.HitBox.Intersects(player.HitBox) && bonus.IsActive) { bonus.IsActive = false; if (bonus.Status) Hide._hskillPoints += bonus.Value; else Jekyll._jskillsPoints += bonus.Value; } } foreach (MovableNeutralBlock block in MovableNeutralBlock.MovableNeutralList) { if (block.IsActive) block.Update(gameTime); } foreach (MovableEnnemyBlock block in MovableEnnemyBlock.MovableEnnemyList) { if (block.IsActive) { block.Update(gameTime, player, keyboard); if (player.HitBox.Intersects(block.SpotZone) && !player.IsHiding) { block.HaveSpotted = true; } } } foreach (BulletBlock bullet in BulletBlock.BulletBlockList) { bullet.Update(); if (bullet.HitBox.Intersects(player.HitBox) && bullet.IsActive) { bullet.IsActive = false; player.Health -= bullet.Strength + 1; if (player.Health <= 0) { FirstGame.reload = true; } } } foreach (ItemBlock item in ItemBlock.ItemBlockList) { if (item.IsActive) { if (item.HitBox.Intersects(player.HitBox) && item.IsActive && !player.Statut) { item.IsActive = false; InventoryCase.InventoryCaseList[item.Id].IsEmpty = false; } } } foreach (Camera cam in Camera.CamerasBlockList) { if (cam.IsActive) { cam.Update(gameTime); if (!player.Statut && !player.IsHiding && player.HitBox.Intersects(cam.Spot_rec)) { FirstGame.reload = true; } } } foreach (InfectedZoneBlock zone in InfectedZoneBlock.InfectedZoneBlockList) { if (player.HitBox.Intersects(zone.HitBox)) { if (player.Statut) { player.Health--; if (player.Health <= 0) FirstGame.reload = true; } else if(!player.Statut && (!InventoryCase.InventoryCaseList[0].Status || !player.IsActiveObject)) { player.Health--; if (player.Health <= 0) FirstGame.reload = true; } } } if (!ClimbableBlock.ClimbableBlockList[0].IsActive && !ClimbableBlock.ClimbableBlockList[1].IsActive) { grueTimer++; if (grueTimer < 240/3) { StaticNeutralBlock.StaticNeutralList[0].Y -= 2; StaticNeutralBlock.StaticNeutralList[1].Y -= 2; StaticNeutralBlock.StaticNeutralList[2].Y += 3; StaticNeutralBlock.StaticNeutralList[3].Y += 3; player.DecreaseCoordY(2); LaunchableBlock.LaunchableBlockList[0].Y += 3; } } //Déplacements joueurs/cartes if (pad.IsButtonUp(Buttons.LeftThumbstickLeft) && pad.IsButtonUp(Buttons.LeftThumbstickRight) && !player.IsJumping) { player.AccelMode = 1; player.Speed = 1.5f; accelTimer = 0; player.SetAccelSpeed(); player.BlockPLayer(); } else if (pad.IsButtonDown(Buttons.LeftThumbstickLeft)) { if (player.CanMove && player.EndAttack) { this.SetPlayerAccelMode(gameTime, player); this.Move(Keys.Left, player); } } else if (pad.IsButtonDown(Buttons.LeftThumbstickRight)) { if (player.CanMove && player.EndAttack) { this.SetPlayerAccelMode(gameTime, player); this.Move(Keys.Right, player); } } if (pad.IsButtonDown(Buttons.LeftThumbstickUp) && player.FallingSpeed == 0) { bool lad = false; foreach (Ladder ladder in Ladder.LadderList) { if (player.GetType() == typeof(Jekyll)) { if (player.HitBox.Intersects(ladder.HitBox) && !player.IsCrouch) { Rectangle left = new Rectangle(player.HitBox.X, player.HitBox.Y, 5, player.HitBox.Height); Rectangle right = new Rectangle(player.HitBox.X + player.HitBox.Width - 5, player.HitBox.Y, 5, player.HitBox.Height); if (ladder.HitBox.Intersects(left) && ladder.HitBox.Intersects(right)) { lad = true; player.DecreaseCoordY(1); } } } } if (!lad && !player.PlayerMove) { this.LookUp(true, gameTime, player); } } else if (pad.IsButtonUp(Buttons.LeftThumbstickUp) && showCount > 0) { this.LookUp(false, gameTime, player); player.LookUpDownPhase = true; } else if (pad.IsButtonDown(Buttons.LeftThumbstickUp)) { foreach (Ladder ladder in Ladder.LadderList) { if (player.HitBox.Intersects(ladder.HitBox) && !player.IsCrouch) { Rectangle left = new Rectangle(player.HitBox.X, player.HitBox.Y, 5, player.HitBox.Height); Rectangle right = new Rectangle(player.HitBox.X + player.HitBox.Width - 5, player.HitBox.Y, 5, player.HitBox.Height); if (ladder.HitBox.Intersects(left) && ladder.HitBox.Intersects(right)) { player.DecreaseCoordY(1); } } } } else { player.LookUpDownPhase = false; } if (pad.IsButtonDown(Buttons.LeftThumbstickDown) && player.FallingSpeed == 0) { foreach (Ladder ladder in Ladder.LadderList) { if (player.GetType() == typeof(Jekyll)) { if (player.HitBox.Intersects(ladder.HitBox)) { Rectangle feet = new Rectangle(player.HitBox.X, player.HitBox.Y + player.HitBox.Height - 1, player.HitBox.Width, 1); Rectangle feetplus = feet; feetplus.Y++; if (feet.Intersects(ladder.HitBox) || feetplus.Intersects(ladder.HitBox) && !player.IsCrouch) { Rectangle left = new Rectangle(player.HitBox.X, player.HitBox.Y, 5, player.HitBox.Height); Rectangle right = new Rectangle(player.HitBox.X + player.HitBox.Width - 5, player.HitBox.Y, 5, player.HitBox.Height); if (ladder.HitBox.Intersects(left) && ladder.HitBox.Intersects(right)) { player.IncreaseCoordY(1); } } } } } } if (pad.IsButtonDown(Buttons.LeftThumbstickDown) && player.FallingSpeed == 0 && oldPad.IsButtonUp(Buttons.LeftThumbstickDown)) { var lad = false; foreach (Ladder ladder in Ladder.LadderList) { if (player.GetType() == typeof(Jekyll)) { if (player.HitBox.Intersects(ladder.HitBox)) { lad = true; break; } } } if (!player.Statut && !lad && !player.IsJumping) player.stoop(1); } else if (pad.IsButtonUp(Buttons.LeftThumbstickDown) && oldPad.IsButtonDown(Buttons.LeftThumbstickDown)) { if (!player.Statut) player.stoop(0); } if (pad.IsButtonDown(Buttons.A) && oldPad.IsButtonUp(Buttons.A) && !player.IsJumping) { if (player.Statut && player.CanJump && player.EndAttack) { if (pad.IsButtonDown(Buttons.LeftThumbstickLeft)) jumpInitKey = Keys.Left; else if (pad.IsButtonDown(Buttons.LeftThumbstickRight)) jumpInitKey = Keys.Right; else if (pad.IsButtonDown(Buttons.LeftThumbstickRight) && pad.IsButtonDown(Buttons.LeftThumbstickLeft)) jumpInitKey = 0; else jumpInitKey = 0; player.JumpPlayer(); } else if (!player.Statut && player.CanClimb) { if (pad.IsButtonDown(Buttons.LeftThumbstickRight)) { futurePos.X += (int)player.Speed; foreach (ClimbableBlock block in ClimbableBlock.ClimbableBlockList) { if (block.HitBox.Intersects(futurePos)) { if (block.IsActive && block.IsClimbable) player.ClimbBox(block, 0); } } } else if (pad.IsButtonDown(Buttons.LeftThumbstickLeft)) { futurePos.X -= (int)player.Speed; foreach (ClimbableBlock block in ClimbableBlock.ClimbableBlockList) { if (block.HitBox.Intersects(futurePos)) { if (block.IsActive && block.IsClimbable) player.ClimbBox(block, 1); } } } } else { if (pad.IsButtonDown(Buttons.LeftThumbstickRight)) { futurePos.X += (int)player.Speed; foreach (Door block in Door.DoorList) { if (block.HitBox.Intersects(futurePos) && !block.IsOpen) { block.IsOpen = true; block.Texture = Ressources.door_open; block.HitBox = new Rectangle(block.HitBox.X+10, block.HitBox.Y, block.Texture.Width, block.Texture.Height); block.IsCollidable = false; } } } else if (pad.IsButtonDown(Buttons.LeftThumbstickLeft)) { futurePos.X -= (int)player.Speed; foreach (Door block in Door.DoorList) { if (block.HitBox.Intersects(futurePos) && !block.IsOpen) { block.IsOpen = true; block.Texture = Ressources.door_open; block.HitBox = new Rectangle(block.HitBox.X + 10, block.HitBox.Y, block.Texture.Width, block.Texture.Height); block.IsCollidable = false; } } } } } if (pad.IsButtonDown(Buttons.RightShoulder) && oldPad.IsButtonUp(Buttons.RightShoulder)) { if (player.Statut) { if (player.CanHVision) { if (player.IsActiveVision) player.IsActiveVision = false; else player.IsActiveVision = true; } } else { if (player.CanJVision) { if (player.IsActiveVision) player.IsActiveVision = false; else player.IsActiveVision = true; } } } if (player.IsCrouch) { player.CrouchAnime(); } if (player.IsAttacking) { player.AttackAnime(); //player.BlockPLayer(); futurePos.Width = 70; /* * Test de collision quand on attaque sur les blocs grimpables */ foreach (ClimbableBlock block in ClimbableBlock.ClimbableBlockList) { if (block.HitBox.Intersects(futurePos)) { if (block.IsBreakable && player.HitAttack) { player.destroy(block); } } } foreach (MovableEnnemyBlock block in MovableEnnemyBlock.MovableEnnemyList) { if (block.HitBox.Intersects(futurePos)) { if (block.IsBreakable && player.HitAttack) { player.destroy(block); } } } } if (player.IsSwitch) { if (player.IsCrouch) player.stoop(0); if (player.IsThrowing) { cible.IsItemThrow = false; player.IsThrowing = false; } player.IsSwitch = false; } if ((pad.IsButtonDown(Buttons.RightTrigger) || pad.IsButtonDown(Buttons.LeftTrigger)) && oldPad.IsButtonUp(Buttons.RightTrigger) && oldPad.IsButtonUp(Buttons.LeftTrigger)) { if (player.Statut) { player.Speed = 9; player.IsSpriting = true; } } if (player.IsSpriting && pad.IsButtonUp(Buttons.RightTrigger) && pad.IsButtonUp(Buttons.LeftTrigger)) { if (player.Statut) { player.Speed = 3; player.IsSpriting = false; } } if (pad.IsButtonDown(Buttons.B) && oldPad.IsButtonUp(Buttons.B)) { if (player.Statut && player.EndAttack) { player.IsAttacking = true; player.BeginAttack = true; player.EndAttack = false; } else if (!player.Statut && player.CanHide) { foreach (HidingBlock block in HidingBlock.HidingBlockList) { if (block.HitBox.Intersects(futurePos)) { if (!block.IsHide) { player.hide(block, 0); } } } } } if (player.IsHiding) { if (!player.HideBlock.HitBox.Intersects(futurePos) && player.IsHiding) player.hide(player.HideBlock, 1); } if (pad.IsButtonDown(Buttons.Y) && oldPad.IsButtonUp(Buttons.Y)) { if (!player.Statut) { player.IsActiveObject = !player.IsActiveObject; } } if (pad.IsButtonDown(Buttons.X) && oldPad.IsButtonUp(Buttons.X)) { if (!player.Statut) { if (!player.IsThrowing) { if (player.DirectionPlayer == Direction.Left) cible = new Launch((player.HitBox.X - 50), (player.HitBox.Y + 56), Direction.Left); else if (player.DirectionPlayer == Direction.Right) cible = new Launch((player.HitBox.X + 50), (player.HitBox.Y + 56), Direction.Right); player.IsThrowing = true; player.BlockPLayer(); player.CanMove = false; } else { player.IsThrowing = false; if (cible.sens == Direction.Left) { int distance = player.HitBox.X - cible.HitBox.X; int ratio = 0; if (distance <= 100) { cible.Vitesse = 1; ratio = 3; } else if (distance > 100 && distance <= 300) { cible.Vitesse = 2; ratio = 2; } else if (distance > 300 && distance <= 410) cible.Vitesse = 3; cible.FSpeed = distance * 8f / 400 * -1 - ratio; } else if (cible.sens == Direction.Right) { int distance = cible.HitBox.X - player.HitBox.X; int ratio = 0; if (distance <= 100) { cible.Vitesse = 1; ratio = 3; } else if (distance > 100 && distance <= 300) { cible.Vitesse = 2; ratio = 2; } else if (distance > 300 && distance <= 410) cible.Vitesse = 3; cible.FSpeed = distance * 8f / 400 * -1 - ratio; } cible.IsItemThrow = true; } } else { futurePos = player.HitBox; futurePos.X = (int)(player.DirectionPlayer == Direction.Left ? futurePos.X - player.Speed : futurePos.X + player.Speed); if (!player.IsThrowing) { foreach (LaunchableBlock block in LaunchableBlock.LaunchableBlockList) { if (block.HitBox.Intersects(futurePos)) { if (block.IsActive) { if (player.DirectionPlayer == Direction.Left) cible = new Launch((player.HitBox.X - 50), (player.HitBox.Y + 56), Direction.Left); else if (player.DirectionPlayer == Direction.Right) cible = new Launch((player.HitBox.X + 50), (player.HitBox.Y + 56), Direction.Right); block.IsActive = false; player.ThrowId = 2; cible.IsBoxThrow = true; player.BlockLaunch = block; player.IsThrowBox = true; player.throwBox(block, pad); cible.Vitesse = 5; cible.FSpeed = 370*6f/400*-1; } } } } } } foreach (MovableNeutralBlock blocks in MovableNeutralBlock.MovableNeutralList) { Rectangle futurPos = player.HitBox; futurPos.Y++; if (futurPos.Intersects(blocks.HitBox) && blocks.IsActive) { player.takeElevators(blocks, _downSide, _upSide); } } if (player.IsJumping) player.JumpAnime(); if (!cible.IsBoxCrash && cible.IsBoxThrow) { player.LaunchAnime(cible); } if (cible.IsItemThrow && cible.IsItemCrash) { throwcount++; if (throwcount >= 6) { throwcount = 0; cible.EffetZone = new Rectangle(cible.HitBox.X-250, cible.HitBox.Y-50, 500, 50); foreach (MovableEnnemyBlock ennemy in MovableEnnemyBlock.MovableEnnemyList) { if (ennemy.HitBox.Intersects(cible.EffetZone) && !ennemy.IsOnAlert) { ennemy.IsOnAlert = true; int distance = ennemy.HitBox.X - cible.HitBox.X; if (distance > 0) ennemy.Side = true; else ennemy.Side = false; distance = Math.Abs(distance); ennemy.initDistance = distance; ennemy.Distance = distance; } } } } if (player.IsThrowing) { if (player.ThrowId == 1) { player.throwItem(cible, pad); player.BlockPLayer(); player.CanMove = false; player.Speed = 0; } else if (player.ThrowId == 2) { player.throwBox(LaunchableBlock.LaunchableBlockList[0], pad); player.BlockPLayer(); player.CanMove = false; player.Speed = 0; } } } oldKeyboard = keyboard; oldPad = pad; }