コード例 #1
0
ファイル: Game1.cs プロジェクト: AlexandreDuff/teka2
        /// <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);
            persoPrincipal           = new GameObjectAnime();
            persoPrincipal.estVivant = true;                                        //seulement pour l instant
            persoPrincipal.vitesse   = 0;                                           //c est la map qui bouge
            persoPrincipal.sprite    = Content.Load <Texture2D>("SpriteSheet.png"); // ajouter image de base
            persoPrincipal.position  = new Rectangle(0, 0, 50, 72);
            persoPrincipal.direction = Vector2.Zero;
            persoPrincipal.etat      = GameObjectAnime.Etat.AttenteBas;
            persoPrincipal.position.Offset(fenetre.Center.X + persoPrincipal.sprite.Width / 2, fenetre.Center.Y + persoPrincipal.sprite.Height / 2);  // sa a l air assez loin
            mapIntro           = new GameObject();
            mapIntro.estVivant = true;
            mapIntro.vitesse   = 10;
            mapIntro.sprite    = Content.Load <Texture2D>("MapIntro.png");
            mapIntro.position  = mapIntro.sprite.Bounds;
            mapIntro.position.Offset(mapIntro.sprite.Width / -4, mapIntro.sprite.Height / -4);



            // TODO: use this.Content to load your game content here
        }
コード例 #2
0
ファイル: Game1.cs プロジェクト: xXSSJXx/Teka
        /// <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);


            persoPrincipal = new GameObjectAnime();


            persoPrincipal.estVivant = true;                                        //seulement pour l'instant
            persoPrincipal.vitesse   = 0;                                           //c'est la map qui bouge
            persoPrincipal.sprite    = Content.Load <Texture2D>("SpriteSheet.png"); // SpriteSheet
            persoPrincipal.position  = new Rectangle(0, 0, 50, 72);
            persoPrincipal.direction = Vector2.Zero;
            persoPrincipal.etat      = GameObjectAnime.Etat.AttenteBas;
            persoPrincipal.position.Offset(fenetre.Width / 2 - 26, fenetre.Height / 2 - 36);


            mapIntro           = new GameObject();
            mapIntro.estVivant = true;
            mapIntro.vitesse   = 5;
            mapIntro.sprite    = Content.Load <Texture2D>("MapIntro.png");
            mapIntro.position  = mapIntro.sprite.Bounds;
            mapIntro.position.Offset(0, 0);

            maisonPrincipal           = new GameObject();
            maisonPrincipal.estVivant = true;
            maisonPrincipal.vitesse   = 0;
            maisonPrincipal.sprite    = Content.Load <Texture2D>("MaisonPrincipale.png");
            maisonPrincipal.position  = maisonPrincipal.sprite.Bounds;
            maisonPrincipal.position.Offset(mapIntro.position.X + 300, mapIntro.position.Y + 1150);

            maisonPrincipalOuverte           = new GameObject();
            maisonPrincipalOuverte.estVivant = true;
            maisonPrincipalOuverte.vitesse   = 0;
            maisonPrincipalOuverte.sprite    = Content.Load <Texture2D>("MaisonPrincipaleOuverte.png");
            maisonPrincipalOuverte.position  = maisonPrincipalOuverte.sprite.Bounds;
            maisonPrincipalOuverte.position.Offset(mapIntro.position.X + 300, mapIntro.position.Y + 1150);

            interieurMaison           = new GameObject();
            interieurMaison.estVivant = true;
            interieurMaison.vitesse   = 0;
            interieurMaison.sprite    = Content.Load <Texture2D>("InterieurMaison.png");
            interieurMaison.position  = interieurMaison.sprite.Bounds;
            interieurMaison.position.Offset(mapIntro.position.X + 300, mapIntro.position.Y + 470);

            transparente           = new GameObject();
            transparente.estVivant = true;
            transparente.vitesse   = 0;
            transparente.sprite    = Content.Load <Texture2D>("Transparente.png");
            transparente.position  = transparente.sprite.Bounds;
            transparente.position.Offset(mapIntro.position.X + 560, mapIntro.position.Y + 1680);

            sonAlex  = Content.Load <SoundEffect>("SongTeka");
            alexSong = sonAlex.CreateInstance();

            sonPorte   = Content.Load <SoundEffect>("Click");
            bruitPorte = sonPorte.CreateInstance();

            curseur          = new GameObject();
            curseur.sprite   = Content.Load <Texture2D>("SwordCursor.png");
            curseur.position = curseur.sprite.Bounds;
            curseur.position.Offset(-760, 235);

            buisson           = new GameObject();
            buisson.estVivant = true;
            buisson.sprite    = Content.Load <Texture2D>("Bushes.png");
            buisson.position  = buisson.sprite.Bounds;
            buisson.position.Offset(mapIntro.position.X + 1350, mapIntro.position.Y + 25);

            sceneBataille           = new GameObject();
            sceneBataille.estVivant = true;
            sceneBataille.sprite    = Content.Load <Texture2D>("FightingScene.png");
            sceneBataille.position  = sceneBataille.sprite.Bounds;
            sceneBataille.position.Offset(0, 0);

            flecheDroite1           = new GameObject();
            flecheDroite1.estVivant = true;
            flecheDroite1.sprite    = Content.Load <Texture2D>("FlecheDroiteUp");
            flecheDroite1.position  = flecheDroite1.sprite.Bounds;
            flecheDroite1.position.Offset(persoPrincipal.position.X + flecheDroite1.sprite.Width, persoPrincipal.position.Y);

            flecheDroite2           = new GameObject();
            flecheDroite2.estVivant = false;
            flecheDroite2.sprite    = Content.Load <Texture2D>("FlecheDroiteDown");
            flecheDroite2.position  = flecheDroite2.sprite.Bounds;
            flecheDroite2.position.Offset(persoPrincipal.position.X + flecheDroite2.sprite.Width, persoPrincipal.position.Y);

            flecheGauche1           = new GameObject();
            flecheGauche1.estVivant = true;
            flecheGauche1.sprite    = Content.Load <Texture2D>("FlecheGaucheUp");
            flecheGauche1.position  = flecheGauche1.sprite.Bounds;
            flecheGauche1.position.Offset(persoPrincipal.position.X - flecheGauche1.sprite.Width - 55, persoPrincipal.position.Y);

            flecheGauche2           = new GameObject();
            flecheGauche2.estVivant = false;
            flecheGauche2.sprite    = Content.Load <Texture2D>("FlecheGaucheDown");
            flecheGauche2.position  = flecheGauche2.sprite.Bounds;
            flecheGauche2.position.Offset(persoPrincipal.position.X - flecheGauche2.sprite.Width - 55, persoPrincipal.position.Y);

            introWall          = new GameObject();
            introWall.sprite   = Content.Load <Texture2D>("IntroWall");
            introWall.position = introWall.sprite.Bounds;
            introWall.position.Offset(fenetre.X, fenetre.Y);



            // TODO: use this.Content to load your game content here
        }