コード例 #1
0
ファイル: Game1.cs プロジェクト: alainmaniak/Projet_reversi
        /// <summary>
        /// LoadContent will be called once per game and is the place to load
        /// all of your content.
        /// </summary>
        protected override void LoadContent()
        {
            // Create a new SpriteBatch, which can be used to draw textures.
            spriteBatch = new SpriteBatch(GraphicsDevice);
            Main = new GameMain();

            myMap = new TileMap(
                           Content.Load<Texture2D>(@"Textures\TileSets\mousemap"),
                           Content.Load<Texture2D>(@"Textures\TileSets\part9_slopemaps"));

            hilight = Content.Load<Texture2D>(@"Textures\TileSets\hilight");

            Tile.TileSetTexture = Content.Load<Texture2D>(@"Textures\TileSets\part4_tileset");

            pericles6 = Content.Load<SpriteFont>(@"Fonts\Pericles6");

            Camera.ViewWidth = this.graphics.PreferredBackBufferWidth;
            Camera.ViewHeight = this.graphics.PreferredBackBufferHeight;
            Camera.WorldWidth = ((myMap.MapWidth - 2) * Tile.TileStepX);
            Camera.WorldHeight = ((myMap.MapHeight - 2) * Tile.TileStepY);
            Camera.DisplayOffset = new Vector2(baseOffsetX, baseOffsetY);

            //animation du joueur
            #region
            vlad = new SpriteAnimation(Content.Load<Texture2D>(@"Textures\Characters\T_Vlad_Sword_Walking_48x48"));

            vlad.AddAnimation("WalkEast", 0, 48 * 0, 48, 48, 8, 0.1f);
            vlad.AddAnimation("WalkNorth", 0, 48 * 1, 48, 48, 8, 0.1f);
            vlad.AddAnimation("WalkNorthEast", 0, 48 * 2, 48, 48, 8, 0.1f);
            vlad.AddAnimation("WalkNorthWest", 0, 48 * 3, 48, 48, 8, 0.1f);
            vlad.AddAnimation("WalkSouth", 0, 48 * 4, 48, 48, 8, 0.1f);
            vlad.AddAnimation("WalkSouthEast", 0, 48 * 5, 48, 48, 8, 0.1f);
            vlad.AddAnimation("WalkSouthWest", 0, 48 * 6, 48, 48, 8, 0.1f);
            vlad.AddAnimation("WalkWest", 0, 48 * 7, 48, 48, 8, 0.1f);

            vlad.AddAnimation("IdleEast", 0, 48 * 0, 48, 48, 1, 0.2f);
            vlad.AddAnimation("IdleNorth", 0, 48 * 1, 48, 48, 1, 0.2f);
            vlad.AddAnimation("IdleNorthEast", 0, 48 * 2, 48, 48, 1, 0.2f);
            vlad.AddAnimation("IdleNorthWest", 0, 48 * 3, 48, 48, 1, 0.2f);
            vlad.AddAnimation("IdleSouth", 0, 48 * 4, 48, 48, 1, 0.2f);
            vlad.AddAnimation("IdleSouthEast", 0, 48 * 5, 48, 48, 1, 0.2f);
            vlad.AddAnimation("IdleSouthWest", 0, 48 * 6, 48, 48, 1, 0.2f);
            vlad.AddAnimation("IdleWest", 0, 48 * 7, 48, 48, 1, 0.2f);

            vlad.Position = new Vector2(100, 100);
            vlad.DrawOffset = new Vector2(-24, -38);
            vlad.CurrentAnimation = "WalkEast";
            vlad.IsAnimating = true;
            #endregion

            //son du jeu
            song = Content.Load<Song>(@"Songs\sonjeu");
            MediaPlayer.Play(song);
            Volume = 0.1f;

            MediaPlayer.Volume = Volume;
            MediaPlayer.IsRepeating = true;

            //Menu..
            graphics.PreferredBackBufferWidth = screenWidth;
            graphics.PreferredBackBufferHeight = screenHeight;
            btnPlay = new Button(Content.Load<Texture2D>(@"Buttons\Play"), graphics.GraphicsDevice);
            btnPlay.setPosition(new Vector2(330, 300));

            btnQuit = new Button(Content.Load<Texture2D>(@"Buttons\Exit"), graphics.GraphicsDevice);
            btnQuit.setPosition(new Vector2(330, 400));

            btnOptions = new Button(Content.Load<Texture2D>(@"Buttons\Options"), graphics.GraphicsDevice);
            btnOptions.setPosition(new Vector2(330, 350));

            btnMenu = new Button(Content.Load<Texture2D>(@"Buttons\ReversiMenu"), graphics.GraphicsDevice);
            btnMenu.setPosition(new Vector2(330, 450));
        }
コード例 #2
0
 public MobileSprite(Texture2D texture)
 {
     asSprite = new SpriteAnimation(texture);
 }
コード例 #3
0
 public MobileSprite(Texture2D texture)
 {
     asSprite = new SpriteAnimation(texture);
 }