Beispiel #1
0
        protected override void OnStart()
        {
            var scene = new asd.Scene();
            var layer = new asd.Layer2D();
            var obj = new asd.MapObject2D();

            Assert.AreNotEqual<asd.Scene>(scene, null);
            Assert.AreNotEqual<asd.Layer>(layer, null);
            Assert.AreNotEqual<asd.MapObject2D>(obj, null);

            asd.Engine.ChangeScene(scene);
            scene.AddLayer(layer);
            layer.AddObject(obj);

            var g = asd.Engine.Graphics;
            var texture = g.CreateTexture2D("Data/Map/MapTest.png");

            var chip1 = new asd.Chip2D();
            chip1.Texture = texture;
            chip1.Position = new asd.Vector2DF(0, 0);
            obj.AddChip(chip1);

            var chip2 = new asd.Chip2D();
            chip2.Texture = texture;
            chip2.Position = new asd.Vector2DF(300, 0);
            obj.AddChip(chip2);

            obj.Position = new asd.Vector2DF(0, 0);
        }
Beispiel #2
0
        protected override void OnStart()
        {
            var scene = new asd.Scene();
            var layer = new asd.Layer2D();
            var obj   = new asd.MapObject2D();

            Assert.AreNotEqual <asd.Scene>(scene, null);
            Assert.AreNotEqual <asd.Layer>(layer, null);
            Assert.AreNotEqual <asd.MapObject2D>(obj, null);

            asd.Engine.ChangeScene(scene);
            scene.AddLayer(layer);
            layer.AddObject(obj);

            var g       = asd.Engine.Graphics;
            var texture = g.CreateTexture2D("Data/Map/MapTest.png");

            var chip1 = new asd.Chip2D();

            chip1.Texture  = texture;
            chip1.Position = new asd.Vector2DF(0, 0);
            obj.AddChip(chip1);

            var chip2 = new asd.Chip2D();

            chip2.Texture  = texture;
            chip2.Position = new asd.Vector2DF(300, 0);
            obj.AddChip(chip2);

            obj.Position = new asd.Vector2DF(0, 0);
        }
Beispiel #3
0
 public Graph(Graph graph)
 {
     foreach (var e in graph.Charas)
     {
         var chip = new asd.Chip2D();
         chip.Texture = Resource.Font;
         chip.Scale   = new asd.Vector2DF(
             Consts.CharSize.X / Consts.FontSize.X,
             Consts.CharSize.Y / Consts.FontSize.Y);
         chip.Color    = e.Value.Color;
         chip.Position = new asd.Vector2DF(e.Key.Item1 * Consts.CharSize.X, e.Key.Item2 * Consts.CharSize.Y);
         chip.Src      = e.Value.Src;
         Charas.Add(new Tuple <int, int>(e.Key.Item1, e.Key.Item2), chip);
     }
     this.Position = graph.Position;
     this.Parent   = graph.Parent;
 }
Beispiel #4
0
            private void AddChip(int x, int y, asd.Color color, int c)
            {
                var chip = new asd.Chip2D();

                chip.Texture = Resource.Font;
                chip.Scale   = new asd.Vector2DF(
                    Consts.CharSize.X / Consts.FontSize.X,
                    Consts.CharSize.Y / Consts.FontSize.Y);
                chip.Color    = color;
                chip.Position = new asd.Vector2DF(x * Consts.CharSize.X, y * Consts.CharSize.Y);
                c            -= ' ';
                float diffX = (c % 16) * Consts.FontSize.X;
                float diffY = (c / 16) * Consts.FontSize.Y;

                chip.Src = new asd.RectF(diffX, diffY, Consts.FontSize.X, Consts.FontSize.Y);
                Charas.Add(new Tuple <int, int>(x, y), chip);
            }
Beispiel #5
0
        public void Run()
        {
            // aceを初期化する
            asd.Engine.Initialize("MapObject2D_Simple", 640, 480, new asd.EngineOption());

            {
                //マップオブジェクトを生成する。
                var mapObject = new asd.MapObject2D();

                var texture = asd.Engine.Graphics.CreateTexture2D("Data/Texture/Sample2.png");

                //マップオブジェクトに16*12=184個のチップを登録する。
                for (int i = 0; i < 16; ++i)
                {
                    for (int j = 0; j < 12; ++j)
                    {
                        //チップを生成する。
                        var chip = new asd.Chip2D();

                        //チップにテクスチャを設定する。
                        chip.Texture = texture;

                        //チップの描画先を指定する。
                        chip.Position = new asd.Vector2DF(i * 40, j * 40);

                        //マップオブジェクトにチップを追加する。
                        mapObject.AddChip(chip);
                    }
                }

                //レイヤーにマップオブジェクトを追加する。
                asd.Engine.AddObject2D(mapObject);
            }

            // aceが進行可能かチェックする。
            while (asd.Engine.DoEvents())
            {
                // aceを更新する。
                asd.Engine.Update();
            }

            // aceを終了する。
            asd.Engine.Terminate();
        }
        protected override void OnRegistered()
        {
            GameLayer       = new asd.Layer2D();
            TextLayer       = new asd.Layer2D();
            BackGroundLayer = new asd.Layer2D();
            AddLayer(BackGroundLayer);
            AddLayer(GameLayer);
            AddLayer(TextLayer);
            var back = new BackGround();

            back.Position = new asd.Vector2DF(25 * CellLarge, back.Position.Y);
            BackGroundLayer.AddObject(back);
            var mapObject = new asd.MapObject2D();

            //背景制作
            for (int i = 0; i < 25; ++i)
            {
                for (int j = 0; j < 18; ++j)
                {
                    var chip = new asd.Chip2D();
                    chip.Texture        = asd.Engine.Graphics.CreateTexture2D("kusa.png");
                    chip.CenterPosition = new asd.Vector2DF(chip.Texture.Size.X / 2, chip.Texture.Size.Y / 2);
                    chip.Scale          = new asd.Vector2DF((float)CellLarge / (float)chip.Texture.Size.X, (float)CellLarge / (float)chip.Texture.Size.Y);
                    chip.Position       = new asd.Vector2DF(i * CellLarge, j * CellLarge);
                    mapObject.AddChip(chip);
                }
            }
            BackGroundLayer.AddObject(mapObject);
            for (int i = 0; i < 25; ++i)
            {
                GameLayer.AddObject(new Wall(new asd.Vector2DF(i * CellLarge + CellLarge / 2, 0 * CellLarge + CellLarge / 2)));
                GameLayer.AddObject(new Wall(new asd.Vector2DF(i * CellLarge + CellLarge / 2, 17 * CellLarge + CellLarge / 2)));
            }
            for (int i = 1; i < 17; i++)
            {
                GameLayer.AddObject(new Wall(new asd.Vector2DF(0 * CellLarge + CellLarge / 2, i * CellLarge + CellLarge / 2)));
                GameLayer.AddObject(new Wall(new asd.Vector2DF(24 * CellLarge + CellLarge / 2, i * CellLarge + CellLarge / 2)));
            }
        }
Beispiel #7
0
    public void Run()
    {
        // Altseedを初期化する。
        asd.Engine.Initialize("Action2D_Camera", 640, 480, new asd.EngineOption());

        // カメラを設定する。
        var camera = new asd.CameraObject2D();

        camera.Src = new asd.RectI(0, 0, 640, 480);
        camera.Dst = new asd.RectI(0, 0, 640, 480);

        // エンジンにカメラオブジェクトを追加する。
        asd.Engine.AddObject2D(camera);

        {
            // マップオブジェクトを生成する。
            var mapObject = new asd.MapObject2D();

            var texture = asd.Engine.Graphics.CreateTexture2D("Data/Texture/Chip1.png");

            // マップオブジェクトに50*50=2500個のチップを登録する。
            for (int i = 0; i < 50; ++i)
            {
                for (int j = 0; j < 50; ++j)
                {
                    // チップを生成する。
                    var chip = new asd.Chip2D();

                    // チップにテクスチャを設定する。
                    chip.Texture = texture;

                    // チップの描画先を指定する。
                    chip.Position = new asd.Vector2DF(i * 40 - 1000, j * 40 - 1000);

                    // マップオブジェクトにチップを追加する。
                    mapObject.AddChip(chip);
                }
            }

            // マップオブジェクトのインスタンスをエンジンへ追加する。
            asd.Engine.AddObject2D(mapObject);
        }

        // キャラクターを設定する。
        var charactor = new asd.TextureObject2D();

        // キャラクターの画像を読み込む。
        charactor.Texture = asd.Engine.Graphics.CreateTexture2D("Data/Texture/Character1.png");

        // キャラクターをエンジンに追加する。
        asd.Engine.AddObject2D(charactor);

        // Altseedのウインドウが閉じられていないか確認する。
        while (asd.Engine.DoEvents())
        {
            // キャラクターを移動させる。
            if (asd.Engine.Keyboard.GetKeyState(asd.Keys.Up) == asd.ButtonState.Hold)
            {
                charactor.Position = charactor.Position + new asd.Vector2DF(0, -2);
            }
            if (asd.Engine.Keyboard.GetKeyState(asd.Keys.Down) == asd.ButtonState.Hold)
            {
                charactor.Position = charactor.Position + new asd.Vector2DF(0, +2);
            }
            if (asd.Engine.Keyboard.GetKeyState(asd.Keys.Left) == asd.ButtonState.Hold)
            {
                charactor.Position = charactor.Position + new asd.Vector2DF(-2, 0);
            }
            if (asd.Engine.Keyboard.GetKeyState(asd.Keys.Right) == asd.ButtonState.Hold)
            {
                charactor.Position = charactor.Position + new asd.Vector2DF(+2, 0);
            }

            //カメラをキャラクターの位置に合わせる。
            var pos = camera.Src;
            pos.X      = (int)charactor.Position.X - 640 / 2;
            pos.Y      = (int)charactor.Position.Y - 480 / 2;
            camera.Src = pos;

            // Altseedを更新する。
            asd.Engine.Update();

            Recorder.TakeScreenShot("Action2D_Camera", 20);
        }

        // Altseedの終了処理をする。
        asd.Engine.Terminate();
    }
Beispiel #8
0
        public GameMgr(int bestscore, bool isrestart)
        {
            //レイヤー登録
            {
                LayerOfBackGround = new asd.Layer2D();
                AddLayer(LayerOfBackGround);
                LayerOfBackGround_A = new asd.Layer2D();
                AddLayer(LayerOfBackGround_A);
                LayerOfMain = new asd.Layer2D();
                AddLayer(LayerOfMain);
                CameraOfMain     = new asd.CameraObject2D();
                CameraOfMain.Src = new asd.RectI(0, 0, asd.Engine.WindowSize.X, asd.Engine.WindowSize.Y);
                CameraOfMain.Dst = new asd.RectI(0, 0, asd.Engine.WindowSize.X, asd.Engine.WindowSize.Y);
                LayerOfMain.AddObject(CameraOfMain);
                LayerOfStatus = new asd.Layer2D();
                AddLayer(LayerOfStatus);
            }

            //オブジェクト配置

            //背景
            {
                BackGround         = new asd.TextureObject2D();
                BackGround.Texture = asd.Engine.Graphics.CreateTexture2D("Image/BackGround.png");
                LayerOfBackGround.AddObject(BackGround);

                BackGround_A = new asd.MapObject2D();
                for (int i = 0; i < 200; i++)
                {
                    asd.Chip2D chip = new asd.Chip2D();
                    chip.Texture  = asd.Engine.Graphics.CreateTexture2D("Image/Back_A.png");
                    chip.Position = new asd.Vector2DF(i * 640.0f, 0.0f);
                    BackGround_A.AddChip(chip);
                }
                CameraOfBackGround_A     = new asd.CameraObject2D();
                CameraOfBackGround_A.Src = new asd.RectI(0, 0, 640, 480);
                CameraOfBackGround_A.Dst = new asd.RectI(0, 0, 640, 480);
                LayerOfBackGround_A.AddObject(BackGround_A);
                LayerOfBackGround_A.AddObject(CameraOfBackGround_A);
            }

            //メイン
            {
                Airplane = new Player();
                LayerOfMain.AddObject(Airplane);
                BestScoreLine                 = new asd.GeometryObject2D();
                BoxOfBestScore                = new asd.RectangleShape();
                BoxOfBestScore.DrawingArea    = new asd.RectF(bestscore * 50.0f, 0, 5, 480);
                BestScoreLine.Shape           = BoxOfBestScore;
                BestScoreLine.Color           = new asd.Color(255, 255, 0);
                BestScoreLine.DrawingPriority = 3;
                LayerOfMain.AddObject(BestScoreLine);
                Walls   = new List <Wall>();
                Clouds  = new List <Cloud>();
                Rains   = new List <Rain>();
                Healers = new List <Healer>();
                Winds   = new List <Wind>();
            }

            //ステータス
            {
                HPBar                  = new asd.GeometryObject2D();
                BoxOfHPBar             = new asd.RectangleShape();
                BoxOfHPBar.DrawingArea = new asd.RectF(120, 440, Airplane.HP / Airplane.MaxHP * WidthOfHPBar, 20);
                HPBar.Shape            = BoxOfHPBar;
                HPBar.Color            = new asd.Color(255, 255, 255, 100);

                TextOfHP                = new asd.TextObject2D();
                TextOfHP.Font           = asd.Engine.Graphics.CreateDynamicFont("", 20, new asd.Color(255, 255, 255, 100), 0, new asd.Color(255, 255, 255, 100));
                TextOfHP.Text           = "HP";
                TextOfHP.Color          = new asd.Color(255, 255, 255, 100);
                TextOfHP.CenterPosition = TextOfHP.Font.CalcTextureSize(TextOfHP.Text, asd.WritingDirection.Horizontal).To2DF() / 2.0f;
                TextOfHP.Position       = new asd.Vector2DF(70.0f, 450.0f);

                TextOfScore          = new asd.TextObject2D();
                TextOfScore.Font     = asd.Engine.Graphics.CreateDynamicFont("", 20, new asd.Color(255, 255, 255), 0, new asd.Color(0, 0, 0));
                TextOfScore.Text     = "SCORE : 0";
                TextOfScore.Position = new asd.Vector2DF(10.0f, 10.0f);

                LayerOfStatus.AddObject(HPBar);
                LayerOfStatus.AddObject(TextOfHP);
                LayerOfStatus.AddObject(TextOfScore);
            }

            //スタート
            {
                LayerOfStart               = new asd.Layer2D();
                TextOfTitle                = new asd.TextObject2D();
                TextOfTitle.Font           = asd.Engine.Graphics.CreateDynamicFont("", 60, new asd.Color(255, 255, 255), 0, new asd.Color(255, 255, 255));
                TextOfTitle.Text           = "KAMI HIKOKI";
                TextOfTitle.CenterPosition = TextOfTitle.Font.CalcTextureSize(TextOfTitle.Text, asd.WritingDirection.Horizontal).To2DF() / 2.0f;
                TextOfTitle.Position       = new asd.Vector2DF(asd.Engine.WindowSize.X / 2.0f, asd.Engine.WindowSize.Y / 2.0f);
                TextOfPAK                = new asd.TextObject2D();
                TextOfPAK.Font           = asd.Engine.Graphics.CreateDynamicFont("", 20, new asd.Color(255, 255, 255), 0, new asd.Color(255, 255, 255));
                TextOfPAK.Text           = "Press Any Key";
                TextOfPAK.CenterPosition = TextOfPAK.Font.CalcTextureSize(TextOfPAK.Text, asd.WritingDirection.Horizontal).To2DF() / 2.0f;
                TextOfPAK.Position       = new asd.Vector2DF(asd.Engine.WindowSize.X / 2.0f, 430);
                LayerOfStart.AddObject(TextOfTitle);
                LayerOfStart.AddObject(TextOfPAK);
            }

            //ゲームオーバー
            {
                LayerOfGameOver               = new asd.Layer2D();
                TextOfGameOver                = new asd.TextObject2D();
                TextOfGameOver.Font           = asd.Engine.Graphics.CreateDynamicFont("", 100, new asd.Color(0, 0, 0), 0, new asd.Color(255, 255, 255));
                TextOfGameOver.Text           = "Game Over";
                TextOfGameOver.CenterPosition = TextOfGameOver.Font.CalcTextureSize(TextOfGameOver.Text, asd.WritingDirection.Horizontal).To2DF() / 2.0f;
                TextOfGameOver.Position       = new asd.Vector2DF(320.0f, 600.0f);

                LayerOfGameOver.AddObject(TextOfGameOver);

                CountOfGameOver = 0;
            }

            PairsOfWall = new SortedList <float, float>();
            Level       = 1;
            Count       = 0;
            Score       = 0;
            BestScore   = bestscore;
            IsRestart   = isrestart;

            if (!IsRestart)
            {
                AddLayer(LayerOfStart);
                LayerOfStatus.IsDrawn         = false;
                LayerOfMain.IsUpdated         = false;
                LayerOfBackGround_A.IsUpdated = false;
            }
            else
            {
                LayerOfStart.IsUpdated = false;

                // 音声ファイルを読み込む。BGMの場合、第2引数を false に設定することで、再生しながらファイルを解凍することが推奨されている。
                BGM = asd.Engine.Sound.CreateSoundSource("Sound/PaperPlane_Stage0.ogg", false);

                // 音声のループを有効にする。
                BGM.IsLoopingMode = true;

                // 音声のループ始端を1秒に、ループ終端を6秒に設定する。
                BGM.LoopStartingPoint = 2.0f;
                BGM.LoopEndPoint      = 15.714f;

                // 音声を再生する。
                id_BGM = asd.Engine.Sound.Play(BGM);
            }

            //LoadMap("MapData/Map.csv");
            MakeMap(100.0f);
        }
Beispiel #9
0
        protected override void OnRegistered()
        {
            ClickSystem     = new ClickSystem();
            BackLayer       = new asd.Layer2D();
            GameLayer       = new asd.Layer2D();
            UILayer         = new asd.Layer2D();
            UnitText        = new asd.TextObject2D();
            StageText       = new asd.TextObject2D();
            ModeText        = new asd.TextObject2D();
            EnemyExists     = false;
            IsSceneChanging = false;
            IsStageMoving   = true;
            IsClear         = false;
            DequeueCount    = 100;
            if (TitleScene.HardMode)
            {
                RestCount = 10;
            }
            else
            {
                RestCount = 500;
            }

            if (TitleScene.EasyMode)
            {
                Money = 1500;
            }
            else
            {
                Money = 700;
            }

            Unit.unitlist     = new List <Unit>();
            GameOverSound     = asd.Engine.Sound.CreateSoundSource("gameover.wav", true);
            BGM               = asd.Engine.Sound.CreateSoundSource("bgm.wav", false);
            BGM.IsLoopingMode = true;
            PlayingBgmId      = null;

            AddLayer(GameLayer);
            AddLayer(UILayer);
            AddLayer(BackLayer);
            BackLayer.DrawingPriority = -1;
            GameLayer.DrawingPriority = 0;
            UILayer.DrawingPriority   = 1;
            var moneyText = new Money();

            // 説明文を生成する。
            var font = asd.Engine.Graphics.CreateDynamicFont("font.ttf", 18, new asd.Color(255, 255, 255, 255), 1, new asd.Color(0, 0, 0, 255));

            UnitText.Font     = font;
            UnitText.Position = new asd.Vector2DF(100, 610);
            UnitText.Text     = "";

            var stageFont = asd.Engine.Graphics.CreateDynamicFont("font.ttf", 30, new asd.Color(55, 255, 255, 150), 1, new asd.Color(0, 0, 0, 255));

            StageText.Font     = stageFont;
            StageText.Position = new asd.Vector2DF(10, 10);
            StageText.Text     = "Stage0";

            var modeFont = asd.Engine.Graphics.CreateDynamicFont("font.ttf", 20, new asd.Color(55, 255, 255, 10), 1, new asd.Color(0, 0, 0, 255));

            ModeText.Font     = modeFont;
            ModeText.Position = new asd.Vector2DF(10, 600);

            if (TitleScene.HardMode)
            {
                ModeText.Text = "Hard";
            }
            else if (TitleScene.EasyMode)
            {
                ModeText.Text = "かんたんもーど";
            }
            else
            {
                ModeText.Text = "";
            }

            //背景画像やらの配置
            asd.TextureObject2D textframe = new asd.TextureObject2D();
            textframe.Texture  = asd.Engine.Graphics.CreateTexture2D("TextFrame.png");
            textframe.Position = new asd.Vector2DF(0, 600);

            asd.TextureObject2D UIback = new asd.TextureObject2D();
            UIback.Texture  = asd.Engine.Graphics.CreateTexture2D("ButtonBack.png");
            UIback.Position = new asd.Vector2DF(600, 0);

            UILayer.AddObject(textframe);
            UILayer.AddObject(StageText);
            UILayer.AddObject(UIback);
            UILayer.AddObject(moneyText);
            UILayer.AddObject(UnitText);
            UILayer.AddObject(ModeText);
            Background = new asd.MapObject2D();
            for (int i = 0; i < 12; i++)
            {
                for (int j = 0; j < 12; j++)
                {
                    var chip = new asd.Chip2D();
                    chip.Texture  = asd.Engine.Graphics.CreateTexture2D("kusa.png");
                    chip.Position = new asd.Vector2DF(50 * i, 50 * j);
                    Background.AddChip(chip);
                }
            }
            GameLayer.AddObject(ClickSystem);
            BackLayer.AddObject(Background);
            UILayer.AddObject(new PlayerHP());
            UILayer.AddObject(new ButtonTexture(new asd.Vector2DF(600, 0), 0, "1509886607944.png"));
            UILayer.AddObject(new ButtonTexture(new asd.Vector2DF(700, 0), 1, "1509885962687.png"));
            UILayer.AddObject(new ButtonTexture(new asd.Vector2DF(600, 100), 2, "1509882889252.png"));
            UILayer.AddObject(new ButtonTexture(new asd.Vector2DF(700, 100), 3, "1509888733365.png"));
            UILayer.AddObject(new ButtonTexture(new asd.Vector2DF(600, 200), 4, "1509884775448.png"));
            UILayer.AddObject(new ButtonTexture(new asd.Vector2DF(700, 200), 5, "1509888645166.png"));
            UILayer.AddObject(new ButtonTexture(new asd.Vector2DF(600, 300), 6, "1509883808660.png"));
            UILayer.AddObject(new ButtonTexture(new asd.Vector2DF(700, 300), 7, "1509883676004.png"));
            UILayer.AddObject(new ButtonTexture(new asd.Vector2DF(600, 400), 8, "1509885496761.png"));
            UILayer.AddObject(new ButtonTexture(new asd.Vector2DF(700, 400), 9, "1509875815401.png"));
            UILayer.AddObject(new ButtonTexture(new asd.Vector2DF(600, 500), 10, "WallTexture.png"));
            UILayer.AddObject(new ButtonTexture(new asd.Vector2DF(700, 500), 11, "YellowWallTexture.png"));
            initAllStage();
        }
Beispiel #10
0
        public void Run()
        {
            // aceを初期化する
            asd.Engine.Initialize("MapObject2D_Camera", 640, 480, new asd.EngineOption());

            //カメラを設定する。
            var camera = new asd.CameraObject2D();

            camera.Src = new asd.RectI(0, 0, 640, 480);
            camera.Dst = new asd.RectI(0, 0, 640, 480);

            {
                //マップオブジェクトを生成する。
                var mapObject = new asd.MapObject2D();

                var texture = asd.Engine.Graphics.CreateTexture2D("Data/Texture/Sample2.png");

                //マップオブジェクトに50*50=2500個のチップを登録する。
                for (int i = 0; i < 50; ++i)
                {
                    for (int j = 0; j < 50; ++j)
                    {
                        //チップを生成する。
                        var chip = new asd.Chip2D();

                        //チップにテクスチャを設定する。
                        chip.Texture = texture;

                        //チップの描画先を指定する。
                        chip.Position = new asd.Vector2DF(i * 40 - 1000, j * 40 - 1000);

                        //マップオブジェクトにチップを追加する。
                        mapObject.AddChip(chip);
                    }
                }

                //レイヤーにマップオブジェクトを追加する。
                asd.Engine.AddObject2D(mapObject);

                //レイヤーにカメラオブジェクトを追加する。
                asd.Engine.AddObject2D(camera);
            }

            // aceが進行可能かチェックする。
            while (asd.Engine.DoEvents())
            {
                //カメラを移動させる
                var pos = camera.Src;
                pos.X += 1;
                pos.Y += 1;
                pos.X %= 1000;
                pos.Y %= 1000;
                camera.Src = pos;

                // aceを更新する。
                asd.Engine.Update();
            }

            // aceを終了する。
            asd.Engine.Terminate();
        }