예제 #1
0
        /// <summary>
        /// ワールドの更新,衝突判定,入力値の取得,オーディオの再生などの
        /// ゲーム ロジックを,実行します.
        /// </summary>
        /// <param name="gameTime">ゲームの瞬間的なタイミング情報</param>
        protected override void Update(GameTime gameTime)
        {
            // ゲームの終了条件をチェックします.
            if (scenenum == -1)
            {
                this.Exit();
            }
            // TODO: ここにゲームのアップデート ロジックを追加します.

            if (scenenum == 0)
            {
                //タイトルシーンの操作
                title.update();
                scenenum = title.scenenum();
            }
            if (scenenum == 1)
            {
                //ゲームプレイ画面の操作
                gamescene.update();
                GameUpdate();
            }

            if (scenenum == 2)
            {
                gameoverscene.update();
                if (checkUserMessage(UserMessage.Shot))//スペースキー,エンターキー,ゲームパッドボタンA
                {
                    flg1 = -1;
                }
                else if (flg1 == -1)        //キーを押してから,離したときに実行(連続で画面が遷移するのを防ぐ)
                {
                    KillAllObject();        //フィールド内に残ってる機を消す
                    scenenum        = 0;    //タイトル画面へ戻る
                    syokaiyobidashi = true; //初回呼び出しのフラグを立てる
                    base.Initialize();      //初期化
                }
            }

            if (scenenum == 3)
            {
                clearscene.update();
                if (checkUserMessage(UserMessage.Shot))//スペースキー,エンターキー,ゲームパッドボタンA
                {
                    flg1 = -1;
                }
                else if (flg1 == -1)        //
                {
                    KillAllObject();        //フィールド内に残ってる機を消す
                    scenenum        = 0;    //タイトル画面へ戻る
                    syokaiyobidashi = true; //初回呼び出しのフラグを立てる
                    title           = new Titlescene(textureTitle, textureArrow);
                    base.Initialize();
                }
            }
            base.Update(gameTime);
        }
예제 #2
0
파일: Game1.cs 프로젝트: TeamSahigashi/BF
        /// <summary>
        /// ワールドの更新,衝突判定,入力値の取得,オーディオの再生などの
        /// ゲーム ロジックを,実行します.
        /// </summary>
        /// <param name="gameTime">ゲームの瞬間的なタイミング情報</param>
        protected override void Update(GameTime gameTime)
        {
            // ゲームの終了条件をチェックします.
            if (scenenum == -1)
                this.Exit();
            // TODO: ここにゲームのアップデート ロジックを追加します.

            if (scenenum == 0)
            {
                //タイトルシーンの操作
                title.update();
                scenenum = title.scenenum();
            }
            if (scenenum == 1)
            {
                //ゲームプレイ画面の操作
                gamescene.update();
                GameUpdate();
            }

            if (scenenum == 2)
            {
                gameoverscene.update();
                if (checkUserMessage(UserMessage.Shot))//スペースキー,エンターキー,ゲームパッドボタンA
                {
                    flg1 = -1;
                }
                else if (flg1 == -1)//キーを押してから,離したときに実行(連続で画面が遷移するのを防ぐ)
                {
                    KillAllObject();//フィールド内に残ってる機を消す
                    scenenum = 0;//タイトル画面へ戻る
                    syokaiyobidashi = true;//初回呼び出しのフラグを立てる
                    base.Initialize();//初期化
                }
            }

            if (scenenum == 3)
            {
                clearscene.update();
                if (checkUserMessage(UserMessage.Shot))//スペースキー,エンターキー,ゲームパッドボタンA
                {
                    flg1 = -1;
                }
                else if (flg1 == -1)//
                {
                    KillAllObject();//フィールド内に残ってる機を消す
                    scenenum = 0;//タイトル画面へ戻る
                    syokaiyobidashi = true;//初回呼び出しのフラグを立てる
                    title = new Titlescene(textureTitle, textureArrow);
                    base.Initialize();
                }
            }
            base.Update(gameTime);
        }
예제 #3
0
        /// <summary>
        /// LoadContent はゲームごとに 1 回呼び出され,ここですべてのコンテンツを
        /// 読み込みます.
        /// </summary>
        protected override void LoadContent()
        {
            // 新規の SpriteBatch を作成します.これはテクスチャーの描画に使用できます.
            spriteBatch = new SpriteBatch(GraphicsDevice);
            //シーンのロード
            textureTitle = Content.Load <Texture2D>("title");
            sceneTextureList.Add(textureTitle);
            textureGameScene = Content.Load <Texture2D>("stage1");
            sceneTextureList.Add(textureTitle);
            textureClear = Content.Load <Texture2D>("clear");
            sceneTextureList.Add(textureClear);
            textureGameover = Content.Load <Texture2D>("gameover");
            sceneTextureList.Add(textureGameover);

            //オブジェクトのロード
            textureArrow = Content.Load <Texture2D>("arrow");

            title = new Titlescene(textureTitle, textureArrow);
            SceneList.Add(title);
            gamescene = new Gamescene(textureGameScene);
            SceneList.Add(title);
            clearscene = new Gamescene(textureClear);
            SceneList.Add(clearscene);
            gameoverscene = new Gamescene(textureGameover);
            SceneList.Add(gameoverscene);

            textureEnemy1 = Content.Load <Texture2D>("watermelon");
            enemyTextureList.Add(textureEnemy1);
            textureEnemy1 = Content.Load <Texture2D>("melon");
            enemyTextureList.Add(textureEnemy1);
            textureEnemy1 = Content.Load <Texture2D>("kingyo");
            enemyTextureList.Add(textureEnemy1);
            textureEnemy1 = Content.Load <Texture2D>("stagbeetle");
            enemyTextureList.Add(textureEnemy1);
            textureEnemy1 = Content.Load <Texture2D>("pantsu");
            enemyTextureList.Add(textureEnemy1);
            textureEnemy1 = Content.Load <Texture2D>("bura");
            enemyTextureList.Add(textureEnemy1);

            textureTama = Content.Load <Texture2D>("tamatate");
            tamaTextureList.Add(textureTama);
            textureTama = Content.Load <Texture2D>("tama1");
            tamaTextureList.Add(textureTama);
            textureTama = Content.Load <Texture2D>("tama2");
            tamaTextureList.Add(textureTama);
            textureTama = Content.Load <Texture2D>("tama3");
            tamaTextureList.Add(textureTama);
            textureTama = Content.Load <Texture2D>("tama4");
            tamaTextureList.Add(textureTama);
            textureTama = Content.Load <Texture2D>("tama5");
            tamaTextureList.Add(textureTama);
            textureTama = Content.Load <Texture2D>("tama6");
            tamaTextureList.Add(textureTama);

            textureItem = Content.Load <Texture2D>("item1");
            itemTextureList.Add(textureItem);
            textureItem = Content.Load <Texture2D>("item2");
            itemTextureList.Add(textureItem);
            textureItem = Content.Load <Texture2D>("item3");
            itemTextureList.Add(textureItem);
            textureItem = Content.Load <Texture2D>("item4");
            itemTextureList.Add(textureItem);
            textureItem = Content.Load <Texture2D>("item5");
            itemTextureList.Add(textureItem);
            textureItem = Content.Load <Texture2D>("item6");
            itemTextureList.Add(textureItem);


            textureEffect = Content.Load <Texture2D>("effect1");
            EffectSp      = new sprite(textureEffect, new Vector2(0, 0), new Point(100, 100), new Point(2, 1), 200);
            effectspriteList.Add(EffectSp);
            textureEffect = Content.Load <Texture2D>("effect2");
            EffectSp      = new sprite(textureEffect, new Vector2(0, 0), new Point(50, 50), new Point(4, 1), 400);
            effectspriteList.Add(EffectSp);

            texturePlayer = Content.Load <Texture2D>("beetle");
            playerSp      = new sprite(texturePlayer, new Vector2(0, 0), new Point(40, 60), new Point(3, 1), 5000);

            soundeffect = Content.Load <SoundEffect>("soundclear");          //0
            soundeffectList.Add(soundeffect);
            soundeffect = Content.Load <SoundEffect>("soundgameover");       //1
            soundeffectList.Add(soundeffect);
            soundeffect = Content.Load <SoundEffect>("soundhpreduce");       //2
            soundeffectList.Add(soundeffect);
            soundeffect = Content.Load <SoundEffect>("soundgetitem");        //3
            soundeffectList.Add(soundeffect);
            soundeffect = Content.Load <SoundEffect>("soundenemypowerdown"); //4
            soundeffectList.Add(soundeffect);
            soundeffect = Content.Load <SoundEffect>("soundshoot1");         //5
            soundeffectList.Add(soundeffect);
            soundeffect = Content.Load <SoundEffect>("soundshoot2");         //6
            soundeffectList.Add(soundeffect);
            soundeffect = Content.Load <SoundEffect>("soundshoot3");         //7
            soundeffectList.Add(soundeffect);
            soundeffect = Content.Load <SoundEffect>("soundshoot4");         //8
            soundeffectList.Add(soundeffect);
            soundeffect = Content.Load <SoundEffect>("soundshoot5");         //9
            soundeffectList.Add(soundeffect);
            soundeffect = Content.Load <SoundEffect>("soundshoot6");         //10
            soundeffectList.Add(soundeffect);
            soundeffect = Content.Load <SoundEffect>("soundshoot7");         //11
            soundeffectList.Add(soundeffect);
            soundeffect = Content.Load <SoundEffect>("soundshoot8");         //12
            soundeffectList.Add(soundeffect);
            soundeffect = Content.Load <SoundEffect>("soundshoot9");         //13
            soundeffectList.Add(soundeffect);
            soundeffect = Content.Load <SoundEffect>("soundshoot10");        //14
            soundeffectList.Add(soundeffect);

            //bgm = Content.Load<Song>("bgm");

            //敵のステータスのロード
            EnemyStatus ene;

            ene = new EnemyStatus(1, 1, 10, 1);    //スイカ
            enemyStatusList.Add(ene);
            ene = new EnemyStatus(2, 1, 20, 1);    //メロン
            enemyStatusList.Add(ene);
            ene = new EnemyStatus(3, 1, 100, 1);   //金魚
            enemyStatusList.Add(ene);
            ene = new EnemyStatus(4, 1, 1000, 10); //クワガタ
            enemyStatusList.Add(ene);
            ene = new EnemyStatus(5, 1, 100, 10);  //パンツ
            enemyStatusList.Add(ene);
            ene = new EnemyStatus(5, 1, 100, 10);  //ブラ
            enemyStatusList.Add(ene);

            // TODO: this.Content クラスを使用して,ゲームのコンテンツを読み込みます.
        }
예제 #4
0
파일: Game1.cs 프로젝트: TeamSahigashi/BF
        /// <summary>
        /// LoadContent はゲームごとに 1 回呼び出され,ここですべてのコンテンツを
        /// 読み込みます.
        /// </summary>
        protected override void LoadContent()
        {
            // 新規の SpriteBatch を作成します.これはテクスチャーの描画に使用できます.
            spriteBatch = new SpriteBatch(GraphicsDevice);
            //シーンのロード
            textureTitle = Content.Load<Texture2D>("title");
            sceneTextureList.Add(textureTitle);
            textureGameScene = Content.Load<Texture2D>("stage1");
            sceneTextureList.Add(textureTitle);
            textureClear = Content.Load<Texture2D>("clear");
            sceneTextureList.Add(textureClear);
            textureGameover = Content.Load<Texture2D>("gameover");
            sceneTextureList.Add(textureGameover);

            //オブジェクトのロード
            textureArrow = Content.Load<Texture2D>("arrow");

            title = new Titlescene(textureTitle, textureArrow);
            SceneList.Add(title);
            gamescene = new Gamescene(textureGameScene);
            SceneList.Add(title);
            clearscene = new Gamescene(textureClear);
            SceneList.Add(clearscene);
            gameoverscene = new Gamescene(textureGameover);
            SceneList.Add(gameoverscene);

            textureEnemy1 = Content.Load<Texture2D>("watermelon");
            enemyTextureList.Add(textureEnemy1);
            textureEnemy1 = Content.Load<Texture2D>("melon");
            enemyTextureList.Add(textureEnemy1);
            textureEnemy1 = Content.Load<Texture2D>("kingyo");
            enemyTextureList.Add(textureEnemy1);
            textureEnemy1 = Content.Load<Texture2D>("stagbeetle");
            enemyTextureList.Add(textureEnemy1);
            textureEnemy1 = Content.Load<Texture2D>("pantsu");
            enemyTextureList.Add(textureEnemy1);
            textureEnemy1 = Content.Load<Texture2D>("bura");
            enemyTextureList.Add(textureEnemy1);
            
            textureTama = Content.Load<Texture2D>("tamatate");
            tamaTextureList.Add(textureTama);
            textureTama = Content.Load<Texture2D>("tama1");
            tamaTextureList.Add(textureTama);
            textureTama = Content.Load<Texture2D>("tama2");
            tamaTextureList.Add(textureTama);
            textureTama = Content.Load<Texture2D>("tama3");
            tamaTextureList.Add(textureTama);
            textureTama = Content.Load<Texture2D>("tama4");
            tamaTextureList.Add(textureTama);
            textureTama = Content.Load<Texture2D>("tama5");
            tamaTextureList.Add(textureTama);
            textureTama = Content.Load<Texture2D>("tama6");
            tamaTextureList.Add(textureTama);

            textureItem = Content.Load<Texture2D>("item1");
            itemTextureList.Add(textureItem);
            textureItem = Content.Load<Texture2D>("item2");
            itemTextureList.Add(textureItem);
            textureItem = Content.Load<Texture2D>("item3");
            itemTextureList.Add(textureItem);
            textureItem = Content.Load<Texture2D>("item4");
            itemTextureList.Add(textureItem);
            textureItem = Content.Load<Texture2D>("item5");
            itemTextureList.Add(textureItem);
            textureItem = Content.Load<Texture2D>("item6");
            itemTextureList.Add(textureItem);


            textureEffect = Content.Load<Texture2D>("effect1");
            EffectSp = new sprite(textureEffect, new Vector2(0, 0), new Point(100, 100), new Point(2, 1), 200);
            effectspriteList.Add(EffectSp);
            textureEffect = Content.Load<Texture2D>("effect2");
            EffectSp = new sprite(textureEffect, new Vector2(0, 0), new Point(50, 50), new Point(4, 1), 400);
            effectspriteList.Add(EffectSp);

            texturePlayer = Content.Load<Texture2D>("beetle");
            playerSp = new sprite(texturePlayer, new Vector2(0, 0), new Point(40, 60), new Point(3, 1), 5000);

            soundeffect = Content.Load<SoundEffect>("soundclear");//0
            soundeffectList.Add(soundeffect);
            soundeffect = Content.Load<SoundEffect>("soundgameover");//1
            soundeffectList.Add(soundeffect);
            soundeffect = Content.Load<SoundEffect>("soundhpreduce");//2
            soundeffectList.Add(soundeffect);
            soundeffect = Content.Load<SoundEffect>("soundgetitem");//3
            soundeffectList.Add(soundeffect);
            soundeffect = Content.Load<SoundEffect>("soundenemypowerdown");//4
            soundeffectList.Add(soundeffect);
            soundeffect = Content.Load<SoundEffect>("soundshoot1");//5
            soundeffectList.Add(soundeffect);
            soundeffect = Content.Load<SoundEffect>("soundshoot2");//6
            soundeffectList.Add(soundeffect);
            soundeffect = Content.Load<SoundEffect>("soundshoot3");//7
            soundeffectList.Add(soundeffect);
            soundeffect = Content.Load<SoundEffect>("soundshoot4");//8
            soundeffectList.Add(soundeffect);
            soundeffect = Content.Load<SoundEffect>("soundshoot5");//9
            soundeffectList.Add(soundeffect);
            soundeffect = Content.Load<SoundEffect>("soundshoot6");//10
            soundeffectList.Add(soundeffect);
            soundeffect = Content.Load<SoundEffect>("soundshoot7");//11
            soundeffectList.Add(soundeffect);
            soundeffect = Content.Load<SoundEffect>("soundshoot8");//12
            soundeffectList.Add(soundeffect);
            soundeffect = Content.Load<SoundEffect>("soundshoot9");//13
            soundeffectList.Add(soundeffect);
            soundeffect = Content.Load<SoundEffect>("soundshoot10");//14
            soundeffectList.Add(soundeffect);

            //bgm = Content.Load<Song>("bgm");

            //敵のステータスのロード
            EnemyStatus ene;
            ene = new EnemyStatus(1, 1, 10, 1); //スイカ
            enemyStatusList.Add(ene);
            ene = new EnemyStatus(2, 1, 20, 1); //メロン
            enemyStatusList.Add(ene);
            ene = new EnemyStatus(3, 1, 100, 1); //金魚
            enemyStatusList.Add(ene);
            ene = new EnemyStatus(4, 1, 1000, 10); //クワガタ
            enemyStatusList.Add(ene);
            ene = new EnemyStatus(5, 1, 100, 10); //パンツ
            enemyStatusList.Add(ene);
            ene = new EnemyStatus(5, 1, 100, 10); //ブラ
            enemyStatusList.Add(ene);

            // TODO: this.Content クラスを使用して,ゲームのコンテンツを読み込みます.

        }