Beispiel #1
0
        public override void Init()
        {
            camera = new Libraries.Camera(TurkeySmashGame.manager);

            #region player1
            dude1 = new Joueur(PlayerIndex.Two, MathHelper.ToRadians(-90), MathHelper.ToRadians(180));
            dude1.Load("Models\\dude", TurkeySmashGame.content);
            walk = new AnimatedModel();
            walk.Load("Models\\dude-walk", TurkeySmashGame.content);
            AnimationClip clip1 = walk.Clips[0];
            AnimationPlayer player1 = dude1.PlayClip(clip1);
            player1.Looping = true;
            dude1.Size = new Vector2(50, 350);

            elements[0] = dude1;
            #endregion

            #region player2
            dude2 = new Joueur(PlayerIndex.Two, MathHelper.ToRadians(-90), MathHelper.ToRadians(180));
            dude2.Load("Models\\dude", TurkeySmashGame.content);
            walk = new AnimatedModel();
            walk.Load("Models\\dude-walk", TurkeySmashGame.content);
            AnimationClip clip2 = walk.Clips[0];
            AnimationPlayer player2 = dude2.PlayClip(clip2);
            player2.Looping = true;
            dude2.Size = new Vector2(50, 350);

            elements[1] = dude2;
            #endregion

            if (SelectionNiveau.niveauSelect == "spacefarm")
                level = new Level("Jeu\\space", "Models\\farm", elements, TurkeySmashGame.content);
            else
                level = new Level("Jeu\\citybackground", "Models\\MapCity2", elements, TurkeySmashGame.content);

            hud.Load(elements);
            camera.Initialize();

            sonInstance.Volume = 0.5f;
            sonInstance.IsLooped = true;
            sonInstance.Resume();
        }
Beispiel #2
0
        public override void Init()
        {
            world =new World(Vector2.UnitY * 20f);

            if (SelectionNiveau.niveauSelect == "level1")
            {
                level = new Level(world, "Jeu\\level1\\background1", personnages, TurkeySmashGame.content);
                Song song = TurkeySmashGame.content.Load<Song>("Sons\\Musiques\\MusicLvl1");
                MediaPlayer.Volume = 0.35f;
                MediaPlayer.Play(song);
            }
            else
            {
                if (SelectionNiveau.niveauSelect == "level2")
                {
                    level = new Level(world, "Jeu\\level2\\background2", personnages, TurkeySmashGame.content);
                    Song song = TurkeySmashGame.content.Load<Song>("Sons\\Musiques\\MusicLvl2");
                    MediaPlayer.Volume = 0.35f;
                    MediaPlayer.Play(song);
                }
                else
                {
                    if (SelectionNiveau.niveauSelect == "level3")
                    {
                        level = new Level(world, "Jeu\\level3\\background3", personnages, TurkeySmashGame.content);
                        Song song = TurkeySmashGame.content.Load<Song>("Sons\\Musiques\\MusicLvl3");
                        MediaPlayer.Volume = 0.35f;
                        MediaPlayer.Play(song);
                    }
                    else
                    {
                        level = new Level(world, "Jeu\\level4\\background4", personnages, TurkeySmashGame.content);
                        Song song = TurkeySmashGame.content.Load<Song>("Sons\\Musiques\\MusicLvl4");
                        MediaPlayer.Volume = 0.35f;
                        MediaPlayer.Play(song);
                    }
                }
            }

            #region loadPersonnage

            #region Selection persoonage

            foreach (string str in SelectionPersonnage.listPerso)
            {
                if (str != null)
                {
                    if (i <= ChoixNombrePersonnage.nombreJoueur - 1)
                    {
                        #region CreationJoueur;
                        if (str == "naruto")
                        {
                            personnages[i] = new Joueur(world, level.spawnPoints[i], 1f, new Vector2(42, 55), Convert.Int2PlayerIndex(i + 1), new AnimatedSpriteDef()
                            {
                                AssetName = "Jeu\\naruto",
                                FrameRate = 60,
                                FrameSize = new Point(88, 88),
                                Loop = true,
                                NbFrames = new Point(5, 1),
                            });
                        }
                        if (str == "sakura")
                        {
                            personnages[i] = new Joueur(world, level.spawnPoints[i], 1f, new Vector2(40, 50), Convert.Int2PlayerIndex(i + 1), new AnimatedSpriteDef()
                            {
                                AssetName = "Jeu\\sakura",
                                FrameRate = 60,
                                FrameSize = new Point(80, 80),
                                Loop = true,
                                NbFrames = new Point(6, 1),
                            });
                        }
                        if (str == "sai")
                        {
                            personnages[i] = new Joueur(world, level.spawnPoints[i], 1f, new Vector2(40, 50), Convert.Int2PlayerIndex(i + 1), new AnimatedSpriteDef()
                            {
                                AssetName = "Jeu\\sai",
                                FrameRate = 60,
                                FrameSize = new Point(80, 80),
                                Loop = true,
                                NbFrames = new Point(6, 1),
                            });
                        }
                        if (str == "suigetsu")
                        {
                            personnages[i] = new Joueur(world, level.spawnPoints[i], 1f, new Vector2(45, 58), Convert.Int2PlayerIndex(i + 1), new AnimatedSpriteDef()
                            {
                                AssetName = "Jeu\\suigetsu",
                                FrameRate = 60,
                                FrameSize = new Point(92, 92),
                                Loop = true,
                                NbFrames = new Point(6, 1),
                            });
                        }
                        if (str == "turkey")
                        {
                            personnages[i] = new Joueur(world, level.spawnPoints[i], 1f, new Vector2(25, 25), Convert.Int2PlayerIndex(i + 1), new AnimatedSpriteDef()
                            {
                                AssetName = "Jeu\\turkey",
                                FrameRate = 60,
                                FrameSize = new Point(46, 46),
                                Loop = true,
                                NbFrames = new Point(5, 1),
                            });
                        }
                        #endregion
                    }
                    else
                    {
                        #region CreationIA
                        if (str == "naruto")
                        {
                            personnages[i] = new IA(world, level.spawnPoints[i], 1f, new Vector2(42, 55), Convert.Int2PlayerIndex(i + 1), new AnimatedSpriteDef()
                            {
                                AssetName = "Jeu\\naruto",
                                FrameRate = 60,
                                FrameSize = new Point(88, 88),
                                Loop = true,
                                NbFrames = new Point(5, 1),
                            });
                        }
                        if (str == "sakura")
                        {
                            personnages[i] = new IA(world, level.spawnPoints[i], 1f, new Vector2(40, 50), Convert.Int2PlayerIndex(i + 1), new AnimatedSpriteDef()
                            {
                                AssetName = "Jeu\\sakura",
                                FrameRate = 60,
                                FrameSize = new Point(80, 80),
                                Loop = true,
                                NbFrames = new Point(6, 1),
                            });
                        }
                        if (str == "sai")
                        {
                            personnages[i] = new IA(world, level.spawnPoints[i], 1f, new Vector2(40, 50), Convert.Int2PlayerIndex(i + 1), new AnimatedSpriteDef()
                            {
                                AssetName = "Jeu\\sai",
                                FrameRate = 60,
                                FrameSize = new Point(80, 80),
                                Loop = true,
                                NbFrames = new Point(6, 1),
                            });
                        }
                        if (str == "suigetsu")
                        {
                            personnages[i] = new IA(world, level.spawnPoints[i], 1f, new Vector2(45, 58), Convert.Int2PlayerIndex(i + 1), new AnimatedSpriteDef()
                            {
                                AssetName = "Jeu\\suigetsu",
                                FrameRate = 60,
                                FrameSize = new Point(92, 92),
                                Loop = true,
                                NbFrames = new Point(6, 1),
                            });
                        }
                        if (str == "turkey")
                        {
                            personnages[i] = new Joueur(world, level.spawnPoints[i], 1f, new Vector2(25, 25), Convert.Int2PlayerIndex(i + 1), new AnimatedSpriteDef()
                            {
                                AssetName = "Jeu\\turkey",
                                FrameRate = 60,
                                FrameSize = new Point(46, 46),
                                Loop = true,
                                NbFrames = new Point(5, 1),
                            });
                        }
                        #endregion
                    }
                    FarseerBodyUserData userdata = (FarseerBodyUserData)personnages[i].body.UserData;
                    if (userdata.AssociatedName != "Jeu\\turkey")
                        personnages[i].body.Mass = fixedMass;
                    else
                        personnages[i].body.Mass = 0.18f;
                    i = i + 1;
                }
            }
            #endregion

            #endregion

            #region initCompteur

            compteur = new AnimatedSprite(TurkeySmashGame.WindowMid - new Vector2(256, 256), new AnimatedSpriteDef()
            {
                AssetName = "Jeu\\compteurDebutDePartie",
                FrameRate = 60,
                FrameSize = new Point(512, 512),
                Loop = false,
                NbFrames = new Point(3, 0),
            });
            compteur.TimeBetweenFrame = 1000;
            compteur.color = Color.Orange;

            #endregion

            hud.Load(personnages);
        }