public Level(World _world, string backgroundName, Character[] personnages, ContentManager content) { nextItemSpawn = ((OptionsCombat.itemSpawnMin + OptionsCombat.itemSpawnMax) / 2) * 1000; //init des premier spawn bonusSpawnMax = (int)(OptionsCombat.itemSpawnMax * 1.5f); bonusSpawnMin = (int)(OptionsCombat.itemSpawnMin * 1.5f); nextBonusSpawn = ((bonusSpawnMax + bonusSpawnMin) / 2) * 1000; this.world = _world; this.personnages = personnages; background = new Sprite(); background.Load(content, backgroundName); football.Load(TurkeySmashGame.content, "Jeu\\level2\\football"); caisseSprite.Load(TurkeySmashGame.content, "Jeu\\Objets\\caisse"); blocSwag.Load(TurkeySmashGame.content, "Jeu\\level2\\blocSwag"); pingpong.Load(TurkeySmashGame.content, "Jeu\\Objets\\PingPong"); baguette.Load(TurkeySmashGame.content, "Jeu\\Objets\\baguette"); pneu.Load(TurkeySmashGame.content, "Jeu\\Objets\\pneu"); pq.Load(TurkeySmashGame.content, "Jeu\\Objets\\rouleauPQ"); tv.Load(TurkeySmashGame.content, "Jeu\\Objets\\télé"); dinde.Load(TurkeySmashGame.content, "Jeu\\Objets\\dinde"); hamburger.Load(TurkeySmashGame.content, "Jeu\\Objets\\hamburger"); raquette.Load(TurkeySmashGame.content, "Jeu\\Objets\\raquette"); invincible.Load(TurkeySmashGame.content, "Jeu\\Objets\\invincible"); animSortie = new AnimatedSpriteDef() { AssetName = "Jeu\\effets\\Ejection", FrameRate = 60, FrameSize = new Point(81, 100), Loop = false, NbFrames = new Point(7, 1), }; Init(backgroundName); }
public void Load(Character[] players) { timerFont = new Font(TurkeySmashGame.WindowSize.X / 2, TurkeySmashGame.WindowSize.Y / 10); timerFont.NameFont = "Pourcent"; timerFont.Load(TurkeySmashGame.content); timerFont.SizeText = 1.0f; if (SelectionNiveau.niveauSelect == "level1") timerFont.Color = Color.Black; else timerFont.Color = Color.White; if (OptionsCombat.TypePartieSelect == "temps") timer = OptionsCombat.TempsPartie * 60000 ; //60*1000 = 1 min en millisecond else timer = 0; for (int i = 0; i < players.Length; i++) { if (players[i] != null) { pourcentages[i] = new Font((i + 1) * (TurkeySmashGame.manager.PreferredBackBufferWidth / 5), (7 * TurkeySmashGame.manager.PreferredBackBufferHeight / 8)); pourcentages[i].NameFont = "Pourcent"; pourcentages[i].Load(TurkeySmashGame.content); pourcentages[i].SizeText = 1.3f; icone[i] = new Sprite((i + 1) * (TurkeySmashGame.manager.PreferredBackBufferWidth / 5) - 250, (7 * TurkeySmashGame.manager.PreferredBackBufferHeight / 8 - 120)); if (OptionsCombat.TypePartieSelect == "vie") { xlife[i] = new Font((i + 1) * (TurkeySmashGame.manager.PreferredBackBufferWidth / 5), 4 * TurkeySmashGame.manager.PreferredBackBufferHeight / 5); iconeLife[i] = new Sprite((i + 1) * (TurkeySmashGame.manager.PreferredBackBufferWidth / 5) - 50 ,TurkeySmashGame.manager.PreferredBackBufferHeight * 0.78f); xlife[i].NameFont = "Pourcent"; xlife[i].Load(TurkeySmashGame.content); xlife[i].SizeText = 0.5f; } if (OptionsCombat.TypePartieSelect == "temps") { scores[i] = new Font((i + 1) * (TurkeySmashGame.manager.PreferredBackBufferWidth / 5), 4 * TurkeySmashGame.manager.PreferredBackBufferHeight / 5); scores[i].NameFont = "Pourcent"; scores[i].Load(TurkeySmashGame.content); scores[i].SizeText = 0.6f; } if (players[i].definition.AssetName == "Jeu\\naruto") { icone[i].Load(TurkeySmashGame.content, "HUD\\HUDnaruto"); if (OptionsCombat.TypePartieSelect == "vie") iconeLife[i].Load(TurkeySmashGame.content, "HUD\\HUDnarutoLifeIcone"); } if (players[i].definition.AssetName == "Jeu\\sakura") { icone[i].Load(TurkeySmashGame.content, "HUD\\HUDSakura"); if (OptionsCombat.TypePartieSelect == "vie") iconeLife[i].Load(TurkeySmashGame.content, "HUD\\HUDsakuraLifeIcone"); } if (players[i].definition.AssetName == "Jeu\\sai") { icone[i].Load(TurkeySmashGame.content, "HUD\\HUDsai"); if (OptionsCombat.TypePartieSelect == "vie") iconeLife[i].Load(TurkeySmashGame.content, "HUD\\HUDsaiLifeIcone"); } if (players[i].definition.AssetName == "Jeu\\suigetsu") { icone[i].Load(TurkeySmashGame.content, "HUD\\HUDsuigetsu"); if (OptionsCombat.TypePartieSelect == "vie") iconeLife[i].Load(TurkeySmashGame.content, "HUD\\HUDsuigetsuLifeIcone"); } if (players[i].definition.AssetName == "Jeu\\turkey") { icone[i].Load(TurkeySmashGame.content, "HUD\\HUDTurkey"); if (OptionsCombat.TypePartieSelect == "vie") iconeLife[i].Load(TurkeySmashGame.content, "HUD\\HUDTurkeyLifeIcone"); } } } }
public void Update(GameTime gameTime, Character[] players) { for (int i = 0; i < players.Length; i++) { if (players[i] != null) { pourcentages[i].Texte = players[i].pourcent + " %"; int gradationRatio = 255 - (255 * players[i].pourcent / 250); pourcentages[i].Color = Color.FromNonPremultiplied(255, gradationRatio, gradationRatio, 255); if (OptionsCombat.TypePartieSelect == "vie") { xlife[i].Texte = "x" + (players[i].vie).ToString(); xlife[i].Color = Color.White; } if (OptionsCombat.TypePartieSelect == "temps") { scores[i].Texte = players[i].score.ToString(); scores[i].Color = Color.White; } } else { pourcentages[i] = null; icone[i] = null; if (OptionsCombat.TypePartieSelect == "vie") { iconeLife[i] = null; xlife[i] = null; } if (OptionsCombat.TypePartieSelect == "temps") { scores[i] = null; } } } if (OptionsCombat.TypePartieSelect == "temps") timer -= (decimal)gameTime.ElapsedGameTime.TotalMilliseconds; else timer += (decimal)gameTime.ElapsedGameTime.TotalMilliseconds; timerFont.Texte = (Math.Truncate((Math.Round((timer / 1000), 0)) / 60)).ToString() + " : " + (Math.Round((timer / 1000), 0) % 60).ToString(); }
private void scoring(Character personnage) { FarseerBodyUserData userData = (FarseerBodyUserData)personnage.body.UserData; if (userData.LastHit <= 0) { personnage.score -= 2; tabScores[Convert.PlayerIndex2Int(personnage.playerindex) - 1][2]++; } else { if (personnages[userData.LastHit - 1] != null) personnages[userData.LastHit - 1].score++; personnage.score--; tabScores[userData.LastHit - 1][Convert.PlayerIndex2Int(personnage.playerindex) + 2]++; //+1 au kill du joueur mort } for (int i = 0; i < personnages.Length; i++) if (personnages[i] != null) tabScores[i][1] = personnages[i].score; }
void respawn(Character personnage) { FarseerBodyUserData userData = (FarseerBodyUserData)personnage.body.UserData; scoring(personnage); if (personnage.vie == 1 & OptionsCombat.TypePartieSelect == "vie") personnage.vie = 0; if (!personnage.Mort) { personnage.bodyPosition = ConvertUnits.ToSimUnits(respawnPoint); if (OptionsCombat.TypePartieSelect != "temps") personnage.vie--; } else { if (OptionsCombat.TypePartieSelect == "vie") scoresLife[Convert.PlayerIndex2Int(personnage.playerindex) - 1][3] = (int)timer; } userData.LastHit = 0; userData.Pourcent = 0; personnage.body.ResetDynamics(); }
void gameFinished(Character personnage) { if (compteur > tempsAffichageFinDePartie) Basic.SetScreen(new EndGameScreen()); else if (isFinish) { finDePartie = new Sprite(); finDePartie.Load(TurkeySmashGame.content, "Menu1\\FR-PartieTerminée"); finDePartie.Position = new Vector2(TurkeySmashGame.WindowMid.X, TurkeySmashGame.WindowMid.Y); if (gameOver) { gameOver = false; gameOverSound.Play(); } } if (OptionsCombat.TypePartieSelect == "temps") { if (timer >= OptionsCombat.TempsPartie * 1000 * 60) { isFinish = true; timer = 0; Results.SaveResults(tabScores, "temps"); } } if (OptionsCombat.TypePartieSelect == "vie") { if (personnages[0] != null & personnages[1] == null & personnages[2] == null & personnages[3] == null | personnages[0] == null & personnages[1] != null & personnages[2] == null & personnages[3] == null | //braaufganzuiafgnzfpuiazgfpauzfpaizfayi personnages[0] == null & personnages[1] == null & personnages[2] != null & personnages[3] == null | personnages[0] == null & personnages[1] == null & personnages[2] == null & personnages[3] != null) { for (int i = 0; i < 4; i++) { scoresLife[i][1] = tabScores[i][1]; scoresLife[i][2] = tabScores[i][2]; } for (int i = 0; i < personnages.Length; i++) if (personnages[i] != null) Results.SaveResults(scoresLife, "vie"); isFinish = true; } } }
public void UpdatePosition(Character[] personnages) { int i = 0; foreach (Character perso in personnages) { if ((perso != null) && (playerindex != perso.playerindex)) { posPerso[i] = perso.bodyPosition; i = i + 1; } } }