public BallParticleSystem(YellokillerGame game, int howManyEffects, Heros heros, Carte carte) : base(game, howManyEffects) { this.heros = heros; this.carte = carte; distance = heros.Distance_Hero_Mur(carte); }
public static void CreerLabyrintheQuadruple(Carte carte) { hauteur = 7; largeur = 10; cellules = new Cellule[largeur, hauteur]; InitialiserLabyrinthe(carte); for (int y = 0; y < Taille_Map.HAUTEUR_MAP / 8; y++) { for (int x = 0; x < Taille_Map.LARGEUR_MAP / 8; x++) { for (int j = 4; j < 8; j++) for (int i = 4; i < 8; i++) carte.Cases[8 * y + j, 8 * x + i].Type = TypeCase.buissonSurHerbe; if (y + 1 >= hauteur || !cellules[x, y].isLinked(cellules[x, y + 1])) for (int j = 4; j < 8; j++) for (int i = 0; i < 4; i++) carte.Cases[8 * y + j, 8 * x + i].Type = TypeCase.buissonSurHerbe; if (x + 1 >= largeur || !cellules[x, y].isLinked(cellules[x + 1, y])) for (int j = 0; j < 4; j++) for (int i = 4; i < 8; i++) carte.Cases[8 * y + j, 8 * x + i].Type = TypeCase.buissonSurHerbe; } } }
public void Update(GameTime gameTime, Carte carte) { rectangle.X = (int)position.X + 1; rectangle.Y = (int)position.Y + 1; tmpshuriken += gameTime.ElapsedGameTime.Milliseconds * 0.001f; if (position.X > 0 && position.X < 28 * Taille_Map.LARGEUR_MAP && position.Y > 0 && position.Y < 28 * Taille_Map.HAUTEUR_MAP && carte.Cases[Y, X].EstFranchissable) { ShurikenExists = true; position += 7 * direction; elapsed = (float)gameTime.ElapsedGameTime.TotalSeconds; Rotation += elapsed + 50; Rotation = Rotation % circle; } else ShurikenExists = false; if (tmpshuriken > 1) { ShurikenExists = false; tmpshuriken = 0; } }
public static void CreerLabyrintheDouble(Carte carte) { hauteur = 15; largeur = 20; cellules = new Cellule[largeur, hauteur]; InitialiserLabyrinthe(carte); for (int y = 0; y < Taille_Map.HAUTEUR_MAP / 4; y++) { for (int x = 0; x < Taille_Map.LARGEUR_MAP / 4; x++) { for (int j = 2; j < 4; j++) for (int i = 2; i < 4; i++) carte.Cases[4 * y + j, 4 * x + i].Type = TypeCase.murBlanc; if (y + 1 >= hauteur || !cellules[x, y].isLinked(cellules[x, y + 1])) for (int j = 2; j < 4; j++) for (int i = 0; i < 2; i++) carte.Cases[4 * y + j, 4 * x + i].Type = TypeCase.murBlanc; if (x + 1 >= largeur || !cellules[x, y].isLinked(cellules[x + 1, y])) for (int j = 0; j < 2; j++) for (int i = 2; i < 4; i++) carte.Cases[4 * y + j, 4 * x + i].Type = TypeCase.murBlanc; } } }
public void Update(GameTime gameTime, Carte carte, Heros heros1, Heros heros2, Rectangle camera, List<EnnemiMort> morts, Rectangle fumeeHeros1, Rectangle fumeeHeros2) { base.Update(gameTime, new Rectangle((int)Index * 24, 0, 19, 26), new Rectangle((int)Index * 24, 63, 19, 26), new Rectangle((int)Index * 24, 96, 19, 26), new Rectangle((int)Index * 24, 32, 19, 26), heros1, heros2, morts, fumeeHeros1, fumeeHeros2); if (parcours.Count > 1 && RetourneCheminNormal) if (Chemin == null || Chemin.Count == 0) { Etape++; Depart = carte.Cases[(int)positionDesiree.Y / 28, (int)positionDesiree.X / 28]; Arrivee = parcours[(Etape + 1) % parcours.Count]; Chemin = Pathfinding.CalculChemin(carte, Depart, Arrivee); } if (Collision(heros1.Rectangle, fumeeHeros1, fumeeHeros2)) { Depart = carte.Cases[(int)positionDesiree.Y / 28, (int)positionDesiree.X / 28]; Arrivee = carte.Cases[heros1.Y, heros1.X]; Chemin = Pathfinding.CalculChemin(carte, Depart, Arrivee); RetourneCheminNormal = false; } else if (heros2 != null && Collision(heros2.Rectangle, fumeeHeros1, fumeeHeros2)) { Depart = carte.Cases[(int)positionDesiree.Y / 28, (int)positionDesiree.X / 28]; Arrivee = carte.Cases[heros2.Y, heros2.X]; Chemin = Pathfinding.CalculChemin(carte, Depart, Arrivee); RetourneCheminNormal = false; } else if (this.Alerte && !RetourneCheminNormal && Chemin.Count == 0) { Depart = carte.Cases[(int)positionDesiree.Y / 28, (int)positionDesiree.X / 28]; Arrivee = parcours[Etape % parcours.Count]; Chemin = Pathfinding.CalculChemin(carte, Depart, Arrivee); RetourneCheminNormal = true; } }
public Garde(Vector2 position, Carte carte) : base(position, carte) { Position = position; SourceRectangle = new Rectangle(24, 64, 16, 24); Rectangle = new Rectangle((int)position.X + 1, (int)position.Y + 1, 16, 24); positionDesiree = position; }
public ExplosionParticleSystem(YellokillerGame game, int howManyEffects, Heros heros, Carte carte, int maxspeed) : base(game, howManyEffects) { this.maxspeed = maxspeed; this.heros = heros; this.carte = carte; distance = heros.Distance_Hero_Mur(carte); }
public Patrouilleur(Vector2 position, Carte carte, int id) : base(position, carte) { this.position = position; SourceRectangle = new Rectangle(24, 0, 19, 26); Etape = 0; parcours = new List<Case>(); Rectangle = new Rectangle((int)position.X + 1, (int)position.Y + 1, 19, 26); Identifiant = id; }
public Boss(Vector2 position, Carte carte) : base(position, carte) { Position = position; SourceRectangle = new Rectangle(26, 64, 18, 26); Rectangle = new Rectangle((int)position.X + 1, (int)position.Y + 1, 18, 26); MaxIndex = 0; positionDesiree = position; Vie = 5; Origine = new Vector2(X, Y); }
public Dark_Hero(Vector2 position, Carte carte) : base(position) { VitesseSprite = 0.25f; VitesseAnimation = 0.004f; Position = position; SourceRectangle = new Rectangle(24, 64, 16, 24); Rectangle = new Rectangle((int)position.X + 1, (int)position.Y + 1, 16, 24); positionDesiree = position; chemin = new List<Case>(); pseudoChrono = 0; }
public EditorScreen(string nomCarte, YellokillerGame game) { this.game = game; if (nomCarte == "") { nomSauvegarde = nomCarte; compteur = 1; } else { nomSauvegarde = nomCarte.Substring(0, nomCarte.Length - 5); compteur = nomCarte[nomCarte.Length - 6]; extension = nomCarte.Substring(nomCarte.Length - 5); } this.nomCarte = nomCarte; ligne = ""; enableSave = true; afficherMessageErreur = false; afficherMessageSauvegarde = false; camera = new Rectangle(0, 0, 33, 24); carte = new Carte(new Vector2(Taille_Map.LARGEUR_MAP, Taille_Map.HAUTEUR_MAP)); if (nomCarte == "") carte.Initialisation(new Vector2(Taille_Map.LARGEUR_MAP, Taille_Map.HAUTEUR_MAP)); else carte.OuvrirCarte(nomCarte, content); _originesGardes = carte.OriginesGardes; _originesPatrouilleurs = carte.OriginesPatrouilleurs; _originesPatrouilleursAChevaux = carte.OriginesPatrouilleursAChevaux; _origineDark_Hero = carte.OrigineDarkHero; _originesBoss = carte.OriginesBoss; _originesStatues = carte.OriginesStatues; rotationsDesStatues = carte.RotationsDesStatues; bonus = carte.Bonus; interrupteurs = carte.Interrupteurs; munitions = carte.Munitions; origine1 = carte.OrigineJoueur1; origine2 = carte.OrigineJoueur2; enableOrigine1 = (carte.OrigineJoueur1 == -Vector2.One); enableOrigine2 = (carte.OrigineJoueur2 == -Vector2.One); enableDH = (carte.OrigineDarkHero == -Vector2.One); }
//: base(position, carte) public Statue(Vector2 position, Carte carte, byte direction) : base(position) { this.position = position; this.direction = direction; if (direction == 0) // bas SourceRectangle = new Rectangle(0, 0, 112, 94); else if (direction == 1) // gauche SourceRectangle = new Rectangle(0, 123, 112, 94); else if (direction == 2) // haut SourceRectangle = new Rectangle(0, 357, 112, 94); else if (direction == 3) // droite SourceRectangle = new Rectangle(0, 243, 112, 94); Rectangle = new Rectangle((int)position.X + 1, (int)position.Y + 1, 112, 94); }
public void Update(GameTime gameTime, Carte carte, Heros heros1, Heros heros2, Rectangle camera, List<EnnemiMort> ennemisMorts, Rectangle fumeeHeros1, Rectangle fumeeHeros2) { if (Collision(heros1.Rectangle, fumeeHeros1, fumeeHeros2)) { Depart = carte.Cases[Y, X]; Arrivee = carte.Cases[heros1.Y, heros1.X]; Chemin = Pathfinding.CalculChemin(carte, Depart, Arrivee); } else if (heros2 != null && (Collision(heros2.Rectangle, fumeeHeros1, fumeeHeros2))) { Depart = carte.Cases[Y, X]; Arrivee = carte.Cases[heros2.Y, heros2.X]; Chemin = Pathfinding.CalculChemin(carte, Depart, Arrivee); } base.Update(gameTime, new Rectangle((int)Index * 24, 0, 16, 24), new Rectangle((int)Index * 24, 64, 16, 24), new Rectangle((int)Index * 24, 97, 16, 24), new Rectangle((int)Index * 24, 33, 16, 24), heros1, heros2, ennemisMorts, fumeeHeros1, fumeeHeros2); }
public static List<Case> CalculChemin(Carte carte, Case depart, Case arrivee) { List<Case> resultat = new List<Case>(); NodeList<Noeud> listeOuverte = new NodeList<Noeud>(); NodeList<Noeud> listeFermee = new NodeList<Noeud>(); List<Noeud> noeudsPossibles; int nombreNoeudsPossibles; listeOuverte.Add(new Noeud(depart, null, arrivee)); while (listeOuverte.Count > 0) { Noeud current = listeOuverte[0]; listeOuverte.RemoveAt(0); listeFermee.Add(current); if (current.Case == arrivee) { List<Case> solution = new List<Case>(); while (current.Parent != null) { solution.Add(current.Case); current = current.Parent; } return solution; } noeudsPossibles = current.NoeudsPossibles(carte, arrivee); nombreNoeudsPossibles = noeudsPossibles.Count; foreach (Noeud voisin in current.NoeudsPossibles(carte, arrivee)) if (!listeFermee.Contains(voisin)) { if (listeOuverte.Contains(voisin)) { if (voisin.Manhattan < listeOuverte[voisin].Manhattan) listeOuverte[voisin].Parent = current; } else listeOuverte.DichotomicInsertion(voisin); } } return null; }
public List<Noeud> NoeudsPossibles(Carte carte, Case destination) { List<Noeud> result = new List<Noeud>(); // Bas if (CaseValide(Case.X, Case.Y + 1) && carte.Cases[Case.Y + 1, Case.X].EstFranchissable) result.Add(new Noeud(carte.Cases[Case.Y + 1, Case.X], this, destination)); // Droite if (CaseValide(Case.X + 1, Case.Y) && carte.Cases[Case.Y, Case.X + 1].EstFranchissable) result.Add(new Noeud(carte.Cases[Case.Y, Case.X + 1], this, destination)); // Haut if (CaseValide(Case.X, Case.Y - 1) && carte.Cases[Case.Y - 1, Case.X].EstFranchissable) result.Add(new Noeud(carte.Cases[Case.Y - 1, Case.X], this, destination)); // Gauche if (CaseValide(Case.X - 1, Case.Y) && carte.Cases[Case.Y, Case.X - 1].EstFranchissable) result.Add(new Noeud(carte.Cases[Case.Y, Case.X - 1], this, destination)); return result; }
public void Update(GameTime gameTime, List<Shuriken> shuriken, Carte carte, Heros heros1, Heros heros2, Rectangle camera, List<EnnemiMort> morts, Rectangle fumeeHeros1, Rectangle fumeeHeros2) { base.Update(gameTime, new Rectangle((int)Index * 24, 0, 16, 24), new Rectangle((int)Index * 24, 64, 16, 24), new Rectangle((int)Index * 24, 97, 16, 24), new Rectangle((int)Index * 24, 33, 16, 24), heros1, heros2, morts, fumeeHeros1, fumeeHeros2); if (!RetourneCheminNormal && Collision(heros1.Rectangle, fumeeHeros1, fumeeHeros2)) { Depart = carte.Cases[Y, X]; Arrivee = carte.Cases[heros1.Y, heros1.X]; Chemin = Pathfinding.CalculChemin(carte, Depart, Arrivee); } else if (!RetourneCheminNormal && heros2 != null && (Collision(heros2.Rectangle, fumeeHeros1, fumeeHeros2))) { Depart = carte.Cases[Y, X]; Arrivee = carte.Cases[heros2.Y, heros2.X]; Chemin = Pathfinding.CalculChemin(carte, Depart, Arrivee); } if (Math.Abs(Origine.X - X) > 4 || Math.Abs(Origine.Y - Y) > 4) { RetourneCheminNormal = true; Depart = carte.Cases[Y, X]; Arrivee = carte.Cases[(int)Origine.Y, (int)Origine.X]; Chemin = Pathfinding.CalculChemin(carte, Depart, Arrivee); } else RetourneCheminNormal = false; IA.Esquive_Shuriken.Boss_Esquive_Shuriken(heros1, this, shuriken, carte, camera); if (Vie < 5 && Chemin.Count == 0) { if (heros1.Regarde_Bas && position.Y > heros1.position.Y) SourceRectangle = new Rectangle(26, 0, 16, 24); else if (heros1.Regarde_Gauche && position.X < heros1.position.X) SourceRectangle = new Rectangle(26, 33, 16, 24); else if (heros1.Regarde_Haut && position.Y < heros1.position.Y) SourceRectangle = new Rectangle(26, 64, 16, 24); else if (heros1.Regarde_Droite && position.X > heros1.position.X) SourceRectangle = new Rectangle(26, 97, 16, 24); } }
public static void CreerLabyrintheSimple(Carte carte) { hauteur = 30; largeur = 40; cellules = new Cellule[largeur, hauteur]; InitialiserLabyrinthe(carte); for (int y = 0; y < Taille_Map.HAUTEUR_MAP / 2; y++) { for (int x = 0; x < Taille_Map.LARGEUR_MAP / 2; x++) { carte.Cases[2 * y + 1, 2 * x + 1].Type = TypeCase.eau; if (y + 1 >= hauteur || !cellules[x, y].isLinked(cellules[x, y + 1])) carte.Cases[2 * y + 1, 2 * x].Type = TypeCase.eau; if (x + 1 >= largeur || !cellules[x, y].isLinked(cellules[x + 1, y])) carte.Cases[2 * y, 2 * x + 1].Type = TypeCase.eau; } } }
public Ennemi(Vector2 position, Carte carte) : base(position) { MaxIndex = 0; Index = 0; positionDesiree = position; VaEnHaut = true; VaEnBas = true; VaADroite = true; VaAGauche = true; Regarde_Droite = true; Regarde_Gauche = true; Regarde_Haut = true; Regarde_Bas = true; VitesseSprite = 2; VitesseAnimation = 0.008f; this.carte = carte; champDeVision1 = new Rectangle(28 * X - 28, 28 * Y + 28, 0, 0); champDeVision2 = new Rectangle(28 * X, 28 * Y + 28, 0, 0); champDeVision3 = new Rectangle(28 * X + 28, 28 * Y + 28, 0, 0); chemin = new List<Case>(); RetourneCheminNormal = true; }
public int Distance_Statue_Mur(Carte carte) { int distance = 0; if (direction == 2) for (int i = 0; this.Y - i > 0 && carte.Cases[this.Y - i, this.X].EstFranchissable; i++) distance++; else if (direction == 3) for (int i = 0; this.X + i < Taille_Map.LARGEUR_MAP && carte.Cases[this.Y, this.X + i].EstFranchissable; i++) distance++; else if (direction == 1) for (int i = 0; this.X - i > 0 && carte.Cases[this.Y, this.X - i].EstFranchissable; i++) distance++; else if (direction == 0) for (int i = 0; this.Y + i < Taille_Map.HAUTEUR_MAP && carte.Cases[this.Y + i, this.X].EstFranchissable; i++) distance++; if (distance < 8) return distance; else return 8; }
public static void Collisions_Heros_Interrupteurs(Heros heros1, Heros heros2, ref List<Interrupteur> interrupteurs, SoundBank soundBank, Carte carte) { foreach (Interrupteur bouton in interrupteurs) if (heros1.X == bouton.position.X && heros1.Y == bouton.position.Y || heros2 != null && heros2.X == bouton.position.X && heros2.Y == bouton.position.Y) bouton.OuvrirPorte(soundBank, carte); }
/// <summary> /// Constructor fills in the menu contents. /// </summary> public LevelSelectSolo(YellokillerGame game) { bool[] unlocked; List<string> storyMissions; List<string> fileEntries; this.game = game; storyMissions = new List<string>(); fileEntries = new List<string>(); foreach (string file in Directory.GetFiles(System.Windows.Forms.Application.StartupPath + "\\Story", "*.solo")) { storyMissions.Add(file); fileEntries.Add(file); } try { foreach (string file in Directory.GetFiles(System.Windows.Forms.Application.StartupPath + "\\Levels", "*.solo")) fileEntries.Add(file); } catch (DirectoryNotFoundException) { } unlocked = new bool[6]; unlocked[0] = Properties.Unlocked.Default.S1; unlocked[1] = Properties.Unlocked.Default.S2; unlocked[2] = Properties.Unlocked.Default.S3; unlocked[3] = Properties.Unlocked.Default.S4; unlocked[4] = Properties.Unlocked.Default.S5; unlocked[5] = Properties.Unlocked.Default.S6; foreach (string str in fileEntries) { string entryName = str.Substring(str.LastIndexOf('\\') + 1); Carte map = new Carte(new Vector2(Taille_Map.LARGEUR_MAP, Taille_Map.HAUTEUR_MAP)); map.OuvrirCartePourMenu(entryName); miniCartes.Add(map); entryName = entryName.Substring(0, entryName.LastIndexOf('.')); MenuEntry menuEntry = new MenuEntry(entryName); if (storyMissions.Contains(str)) menuEntry.IsLocked = !unlocked[(int.Parse(entryName[0].ToString())) - 1]; menuEntry.Selected += LevelMenuEntrySelected; levels.Add(menuEntry); } //Durée de la transition. TransitionOnTime = TimeSpan.FromSeconds(1.5); TransitionOffTime = TimeSpan.FromSeconds(0.5); // Create our menu entries. abortMenuEntry = new MenuEntry(Langue.tr("BckToMenu")); // Hook up menu event handlers. abortMenuEntry.Selected += AbortMenuEntrySelected; // Add entries to the menu. levels.Add(abortMenuEntry); maxpage = (levels.Count - 2) / 8; }
private void UpdateChampDeVision(Carte carte) { if (Regarde_Bas || Regarde_Haut) { champDeVision1.X = 28 * X - 28; champDeVision2.X = 28 * X; champDeVision3.X = 28 * X + 28; champDeVision1.Width = 28; champDeVision2.Width = 28; champDeVision3.Width = 28; champDeVision1.Height = 28 * DistanceToWall(carte, -1); champDeVision2.Height = 28 * DistanceToWall(carte, 0); champDeVision3.Height = 28 * DistanceToWall(carte, 1); champDeVision1.Y = 28 * Y + (Regarde_Bas ? 28 : -28 * DistanceToWall(carte, -1)); champDeVision2.Y = 28 * Y + (Regarde_Bas ? 28 : -28 * DistanceToWall(carte, 0)); champDeVision3.Y = 28 * Y + (Regarde_Bas ? 28 : -28 * DistanceToWall(carte, 1)); } else if (Regarde_Gauche || Regarde_Droite) { champDeVision1.Y = 28 * Y - 28; champDeVision2.Y = 28 * Y; champDeVision3.Y = 28 * Y + 28; champDeVision1.Height = 28; champDeVision2.Height = 28; champDeVision3.Height = 28; champDeVision1.Width = 28 * DistanceToWall(carte, -1); champDeVision2.Width = 28 * DistanceToWall(carte, 0); champDeVision3.Width = 28 * DistanceToWall(carte, 1); champDeVision1.X = 28 * X + (Regarde_Gauche ? -28 * DistanceToWall(carte, -1) : 28); champDeVision2.X = 28 * X + (Regarde_Gauche ? -28 * DistanceToWall(carte, 0) : 28); champDeVision3.X = 28 * X + (Regarde_Gauche ? -28 * DistanceToWall(carte, 1) : 28); } }
private int DistanceToWall(Carte carte, int pos) { int distance = 0; if (this.X + pos >= 0 && this.X + pos < Taille_Map.LARGEUR_MAP) { if (Regarde_Haut) for (int i = 0; i < 6 && this.Y - i >= 0 && carte.Cases[this.Y - i, this.X + pos].EstFranchissable; i++) distance++; else if (Regarde_Bas) for (int i = 0; i < 6 && this.Y + i < Taille_Map.HAUTEUR_MAP && carte.Cases[this.Y + i, this.X + pos].EstFranchissable; i++) distance++; } if (this.Y + pos >= 0 && this.Y + pos < Taille_Map.HAUTEUR_MAP) { if (Regarde_Droite) for (int i = 0; i < 6 && this.X + i < Taille_Map.LARGEUR_MAP && carte.Cases[this.Y + pos, this.X + i].EstFranchissable; i++) distance++; else if (Regarde_Gauche) for (int i = 0; i < 6 && this.X - i >= 0 && carte.Cases[this.Y + pos, this.X - i].EstFranchissable; i++) distance++; } return (distance < 6 ? distance - 1 : 5); }
public void CreerTrajet(Carte carte) { Chemin = Pathfinding.CalculChemin(carte, Parcours[Etape % Parcours.Count], Parcours[(Etape + 1) % Parcours.Count]); }
public static void CreerLabyrintheTriple(Carte carte) { hauteur = 10; largeur = 13; cellules = new Cellule[largeur, hauteur]; InitialiserLabyrinthe(carte); for (int y = 0; y < Taille_Map.HAUTEUR_MAP / 6; y++) { for (int x = 0; x < Taille_Map.LARGEUR_MAP / 6; x++) { for (int j = 3; j < 6; j++) for (int i = 3; i < 6; i++) carte.Cases[6 * y + j, 6 * x + i].Type = TypeCase.fondNoir; if (y + 1 >= hauteur || !cellules[x, y].isLinked(cellules[x, y + 1])) for (int j = 3; j < 6; j++) for (int i = 0; i < 3; i++) carte.Cases[6 * y + j, 6 * x + i].Type = TypeCase.fondNoir; if (x + 1 >= largeur || !cellules[x, y].isLinked(cellules[x + 1, y])) for (int j = 0; j < 3; j++) for (int i = 3; i < 6; i++) carte.Cases[6 * y + j, 6 * x + i].Type = TypeCase.fondNoir; } } }
public void Update(GameTime gameTime, Carte carte, Heros heros, Rectangle camera) { rectangle.X = (int)position.X + 1; rectangle.Y = (int)position.Y + 1; if (pseudoChrono < 10 && Math.Sqrt((this.X - heros.X) * (this.X - heros.X) + (this.Y - heros.Y) * (this.Y - heros.Y)) > 5) pseudoChrono += gameTime.ElapsedGameTime.TotalSeconds; else { pseudoChrono = 0; depart = carte.Cases[Y, X]; arrivee = carte.Cases[heros.Y, heros.X]; chemin = Pathfinding.CalculChemin(carte, depart, arrivee); } if (chemin != null && chemin.Count != 0) { if (VaEnHaut && VaEnBas && VaADroite && VaAGauche) { if ((int)chemin[chemin.Count - 1].X < X) { positionDesiree.X -= 28; VaAGauche = false; chemin.RemoveAt(chemin.Count - 1); } else if ((int)chemin[chemin.Count - 1].X > X) { positionDesiree.X += 28; VaADroite = false; chemin.RemoveAt(chemin.Count - 1); } else if ((int)chemin[chemin.Count - 1].Y < Y) { positionDesiree.Y -= 28; VaEnHaut = false; chemin.RemoveAt(chemin.Count - 1); } else if ((int)chemin[chemin.Count - 1].Y > Y) { positionDesiree.Y += 28; VaEnBas = false; chemin.RemoveAt(chemin.Count - 1); } else chemin.RemoveAt(chemin.Count - 1); } } if (SourceRectangle.Value.Y == 0) { SourceRectangle = new Rectangle((int)Index * 24, 0, 16, 24); Regarde_Haut = true; } else Regarde_Haut = false; if (SourceRectangle.Value.Y == 97) { SourceRectangle = new Rectangle((int)Index * 24, 97, 16, 24); Regarde_Gauche = true; } else Regarde_Gauche = false; if (SourceRectangle.Value.Y == 64) { SourceRectangle = new Rectangle((int)Index * 24, 64, 16, 24); Regarde_Bas = true; } else Regarde_Bas = false; if (SourceRectangle.Value.Y == 33) { SourceRectangle = new Rectangle((int)Index * 24, 33, 16, 24); Regarde_Droite = true; } else Regarde_Droite = false; if (!VaEnHaut) { if (position != positionDesiree) { position.Y -= VitesseSprite; SourceRectangle = new Rectangle((int)Index * 24, 0, 16, 24); Index += gameTime.ElapsedGameTime.Milliseconds * VitesseAnimation; if (Index >= MaxIndex) Index = 0f; } else { VaEnHaut = true; position = positionDesiree; Index = 0f; } } if (!VaEnBas) { if (position != positionDesiree) { position.Y += VitesseSprite; SourceRectangle = new Rectangle((int)Index * 24, 64, 16, 24); Index += gameTime.ElapsedGameTime.Milliseconds * VitesseAnimation; if (Index >= MaxIndex) Index = 0f; } else { VaEnBas = true; position = positionDesiree; Index = 0f; } } if (!VaAGauche) { if (position != positionDesiree) { position.X -= VitesseSprite; SourceRectangle = new Rectangle((int)Index * 24, 97, 16, 24); Index += gameTime.ElapsedGameTime.Milliseconds * VitesseAnimation; if (Index >= MaxIndex) Index = 0f; } else { VaAGauche = true; position = positionDesiree; Index = 0f; } } if (!VaADroite) { if (position != positionDesiree) { position.X += VitesseSprite; SourceRectangle = new Rectangle((int)Index * 24, 33, 16, 24); Index += gameTime.ElapsedGameTime.Milliseconds * VitesseAnimation; if (Index >= MaxIndex) Index = 0f; } else { VaADroite = true; position = positionDesiree; Index = 0f; } } }
private static void InitialiserLabyrinthe(Carte carte) { //carte.Initialisation(new Vector2(Taille_Map.LARGEUR_MAP, Taille_Map.HAUTEUR_MAP)); for (int y = 0; y < hauteur; y++) for (int x = 0; x < largeur; x++) cellules[x, y] = new Cellule(); for (int y = 0; y < hauteur; y++) { for (int x = 0; x < largeur; x++) { if (x - 1 >= 0) cellules[x, y].addNeighbor(cellules[x - 1, y]); if (y - 1 >= 0) cellules[x, y].addNeighbor(cellules[x, y - 1]); if (x + 1 < largeur) cellules[x, y].addNeighbor(cellules[x + 1, y]); if (y + 1 < hauteur) cellules[x, y].addNeighbor(cellules[x, y + 1]); } } generate(); }
public Fumigene(YellokillerGame game, int howManyEffects, Heros heros, Carte carte) : base(game, howManyEffects) { this.heros = heros; this.carte = carte; }