Example #1
0
 protected override void OnUpdate()
 {
     lastPosition = Position;
     Position = asd.Engine.Mouse.Position;
     velocity = (Position - lastPosition);
     if (velocity.Length > 5)
     {
         Angle = velocity.Degree;
     }
     direction.Degree = Angle;
     direction.Normalize();
 }
Example #2
0
        public PlayerRect()
        {
            width = 12;
            height = 60;

            rectShape = new asd.RectangleShape();
            rectShape.DrawingArea = new asd.RectF(-width/2, -height/2, width, height);

            Shape = rectShape;
            Color = new asd.Color(255, 255, 255, 128);
            direction = new asd.Vector2DF(1, 0);
            direction.Degree = Angle;
        }
Example #3
0
        public Circle(asd.Vector2DF position, asd.Vector2DF velocity, float diameter)
        {
            radius = diameter / 2;

            circleShape = new asd.CircleShape();
            circleShape.OuterDiameter = diameter;

            Shape = circleShape;
            Position = position;
            Color = new asd.Color(255, 255, 255, 128);

            this.velocity = velocity;
        }
Example #4
0
        protected override void OnUpdate()
        {
            if (isGravity)
            {
                velocity.Y += .3f;
                Position += velocity;
                if (Position.Y > asd.Engine.WindowSize.Y)
                {
                    velocity.Y *= -.7f;
                    Position = new asd.Vector2DF(Position.X, asd.Engine.WindowSize.Y);
                }
                else if (Position.Y < 0)
                {
                    velocity.Y *= -.7f;
                    Position = new asd.Vector2DF(Position.X, 0);
                }
                else if (Position.X < 0)
                {
                    velocity.X *= -.7f;
                    Position = new asd.Vector2DF(0, Position.Y);
                }
                else if (Position.X > asd.Engine.WindowSize.X)
                {
                    velocity.X *= -.7f;
                    Position = new asd.Vector2DF(asd.Engine.WindowSize.X, Position.Y);
                }

                if (Position.X < -circleShape.OuterDiameter || Position.X > asd.Engine.WindowSize.X + circleShape.OuterDiameter)
                {
                    // 終了処理
                    int count = Children.Count();
                    for (int i = 0; i < count; i++)
                    {
                        var buf = Children.First();
                        buf.Vanish();
                        RemoveChild(buf);
                    }
                    Vanish();
                }
            }

            // drag
            if (velocity.Length > 15)
            {
                velocity -= velocity*.05f;
            }
        }
    public void Run()
    {
        // Altseedを初期化する。
        asd.Engine.Initialize("GeometryObject2D_PolygonShape_Textured", 640, 480, new asd.EngineOption());

        // テクスチャとして図形に合成する画像を読み込む。
        var texture = asd.Engine.Graphics.CreateTexture2D("Data/Texture/Sample1.png");

        // 図形描画オブジェクトのインスタンスを生成する。
        var geometryObj = new asd.GeometryObject2D();

        // 図形描画オブジェクトのインスタンスをエンジンに追加する。
        asd.Engine.AddObject2D(geometryObj);

        // 多角形の図形クラスのインスタンスを生成する。
        var polygon = new asd.PolygonShape();

        // 多角形を構成する頂点を追加していく。(星形になるようにする。)
        for (int i = 0; i < 10; ++i)
        {
            asd.Vector2DF vec = new asd.Vector2DF(1, 0);
            vec.Degree = i * 36;
            vec.Length = (i % 2 == 0) ? 200 : 75;
            polygon.AddVertex(vec + new asd.Vector2DF(320, 240));

        }

        // 多角形を描画する図形として設定し、合成するテクスチャも設定する。
        geometryObj.Shape = polygon;
        geometryObj.Texture = texture;

        // Altseedのウインドウが閉じられていないか確認する。
        while (asd.Engine.DoEvents())
        {
            // Altseedを更新する。
            asd.Engine.Update();

            Recorder.TakeScreenShot("GeometryObject2D_PolygonShape_Textured", 30);
        }

        // Altseedを終了する。
        asd.Engine.Terminate();
    }
    public void Run()
    {
        // Altseedを初期化する。
        asd.Engine.Initialize("GeometryObject2D_PolygonShape", 640, 480, new asd.EngineOption());

        // 図形描画オブジェクトのインスタンスを生成する。
        var geometryObj = new asd.GeometryObject2D();

        // 図形描画オブジェクトのインスタンスをエンジンに追加する。
        asd.Engine.AddObject2D(geometryObj);

        // 多角形の図形クラスのインスタンスを生成する。
        var polygon = new asd.PolygonShape();

        // 多角形を構成する頂点を追加していく。(星形になるようにする。)
        for (int i = 0; i < 10; ++i)
        {
            asd.Vector2DF vec = new asd.Vector2DF(1, 0);
            vec.Degree = i * 36;
            vec.Length = (i % 2 == 0) ? 200 : 75;
            polygon.AddVertex(vec + new asd.Vector2DF(320, 240));
        }

        // 多角形を描画する図形として設定する。
        geometryObj.Shape = polygon;

        // Altseedのウインドウが閉じられていないか確認する。
        while (asd.Engine.DoEvents())
        {
            // Altseedを更新する。
            asd.Engine.Update();

            Recorder.TakeScreenShot("GeometryObject2D_PolygonShape", 30);
        }

        // Altseedの終了処理をする。
        asd.Engine.Terminate();
    }
Example #7
0
 public LeftArrow(asd.Vector2DF pos)
     : base(pos)
 {
     Angle = -90;
 }
Example #8
0
 public EnemyGreen(asd.Vector2DF pos)
     : base(pos)
 {
     Texture = asd.Engine.Graphics.CreateTexture2D("asobu/EnemyGreen.png");
 }
Example #9
0
 public void AddForce()
 {
     Velocity += Acceleration;
 }
Example #10
0
        protected override void OnUpdate()
        {
            // HPの表示

            // 表示するHPゲージの長さを計算する
            HPlength = (asd.Engine.WindowSize.X - 10) * HP / maxHP;

            // HPゲージの左端を設定する
            startHPLine = new asd.Vector2DF(5, 15);

            // HPゲージの右端を計算する
            destHPLine = startHPLine + new asd.Vector2DF(HPlength, 0);

            // HPゲージを描画する
            DrawLineAdditionally(startHPLine, destHPLine, red, diameterHPLine, asd.AlphaBlendMode.Blend, 30);

            // ボスの位置を更新
            Position += moveVelocity;

            // 一定の間隔で速度を更新する

            if (count % 60 == 0)
            {
                UpdateRandVelocity();
            }
            // ボスが画面外に出た場合に、速度を更新する
            else if (Position.Y < Texture.Size.Y / 2.0f ||
                     Position.Y > asd.Engine.WindowSize.Y - Texture.Size.Y / 2.0f ||
                     Position.X < Texture.Size.X / 2.0f ||
                     Position.X > asd.Engine.WindowSize.X - Texture.Size.X / 2.0f)
            {
                UpdateRandVelocity();
            }


            // HPの量で行動パターンを変える

            // HPが3/4になる前の状態で
            if (maxHP * 3 / 4 < HP)
            {
                // ここで、攻撃パターンを定義したメソッドを呼び出す
                if (count % 80 == 0)
                {
                    BossAroundShot();
                    BossLaser();
                }
            }

            // HPが半分になる前、かつ、HPが3/4を過ぎた状態で
            else if (maxHP / 2 < HP && HP <= maxHP * 3 / 4)
            {
                // ここで、攻撃パターンを定義したメソッドを呼び出す
                if (count % 80 == 0)
                {
                    BossAroundShot();
                }
                if (count % 5 == 0)
                {
                    BossVortexShot(count * 7);
                }
            }

            // HPが1/4になる前、かつ、HPが半分を過ぎた状態で
            else if (maxHP / 4 < HP && HP <= maxHP / 2)
            {
                // ここで、攻撃パターンを定義したメソッドを呼び出す
                if (count % 80 == 0)
                {
                    BossAroundShot();
                    BossLaser();
                }
                // レーザーをまだ出してない、または、前打ったレーザーが撃ち終わっている、ならば
                if (laserRef == null || !laserRef.IsAlive)
                {
                    // 一定の間隔で BossLaser をする
                    if (count % 300 == 0)
                    {
                        BossLaser();
                    }
                }
            }
            // HPが1/4を過ぎた状態で
            else
            {
                // ここで、攻撃パターンを定義したメソッドを呼び出す
                if (count % 40 == 0)
                {
                    BossAroundShot();
                    BossLaser();
                }
                if (count % 5 == 0)
                {
                    BossVortexShot(count * 7);
                }

                // レーザーをまだ出してない、または、前打ったレーザーが撃ち終わっている、ならば
                if (laserRef == null || !laserRef.IsAlive)
                {
                    // 一定の間隔で BossLaser をする
                    if (count % 300 == 0)
                    {
                        BossLaser();
                    }
                }
            }

            // HPが0以下ならば
            if (HP <= 0)
            {
                // Bossを消去する
                Dispose();
                // スコアを加算
                var scene = (GameScene)Layer.Scene;
                scene.Score += 5;
            }

            // カウンタの増加機能を使いまわすため基底(Enemy)クラスのOnUpdateを呼び出す。
            base.OnUpdate();
        }
Example #11
0
        /// <summary>
        /// 弾生成とリストに入れるメソッド
        /// </summary>
        /// <param name="firstpos">初期ベクトル</param>
        /// <param name="firstvel">初期スピード</param>
        /// <param name="attack">攻撃力</param>
        /// <param name="pos">回転中心</param>
        protected void AddBullet(asd.Vector2DF firstpos, asd.Vector2DF firstvel, int attack, asd.Vector2DF pos)
        {
            RotateBullet a = new RotateBullet(firstpos, firstvel, attack, pos);

            Layer.AddObject(a);
            BulletList.Add(a);
        }
Example #12
0
 public EnemyWhite(asd.Vector2DF pos)
     : base(pos)
 {
     Texture = asd.Engine.Graphics.CreateTexture2D("EnemyWhite.png");
 }
Example #13
0
        protected override void OnStart()
        {
            var scene = new asd.Scene();
            var layer = new asd.Layer2D();
            var texture = asd.Engine.Graphics.CreateTexture2D("Data/Texture/Sample1.png");
            var geometryObj1 = new asd.GeometryObject2D();
            var geometryObj2 = new asd.GeometryObject2D();
            var geometryObj3 = new asd.GeometryObject2D();
            var geometryObj4 = new asd.GeometryObject2D();
            var geometryObj5 = new asd.GeometryObject2D();
            var geometryObj6 = new asd.GeometryObject2D();

            layer.AddObject(geometryObj1);
            layer.AddObject(geometryObj2);
            layer.AddObject(geometryObj3);
            layer.AddObject(geometryObj4);
            layer.AddObject(geometryObj5);
            layer.AddObject(geometryObj6);

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

            {
                var circle = new asd.CircleShape();
                circle.OuterDiameter = 100.0f;
                circle.InnerDiameter = 10.0f;
                circle.NumberOfCorners = 96;
                circle.Position = new asd.Vector2DF(100, 50);

                geometryObj1.Shape = circle;
                geometryObj1.Texture = texture;
                geometryObj1.Position = new asd.Vector2DF(0, 0);
            }

            {
                var arc = new asd.ArcShape();
                arc.OuterDiameter = 100;
                arc.InnerDiameter = 10;
                arc.NumberOfCorners = 96;
                arc.Position = new asd.Vector2DF(300, 50);
                arc.StartingCorner = 90;
                arc.EndingCorner = 5;

                geometryObj2.Shape = arc;
                geometryObj2.Texture = texture;
                geometryObj2.Position = new asd.Vector2DF(0, 0);
            }

            {
                var line = new asd.LineShape();
                line.StartingPosition = new asd.Vector2DF(410, 50);
                line.EndingPosition = new asd.Vector2DF(630, 50);
                line.Thickness = 5.0f;

                geometryObj3.Shape = line;
                geometryObj3.Position = new asd.Vector2DF(0, 0);
            }

            {
                var rect = new asd.RectangleShape();
                rect.DrawingArea = new asd.RectF(10, 110, 300, 200);
                rect.UV = new asd.RectF(0.0f, 0.0f, 0.5f, 0.5f);

                geometryObj4.Shape = rect;
                geometryObj4.Texture = texture;
                geometryObj4.Position = new asd.Vector2DF(0, 0);
            }

            {
                var triangle = new asd.TriangleShape();
                triangle.SetPointByIndex(new asd.Vector2DF(320, 350), 0);
                triangle.SetPointByIndex(new asd.Vector2DF(100, 450), 1);
                triangle.SetPointByIndex(new asd.Vector2DF(540, 450), 2);

                triangle.SetUVByIndex(new asd.Vector2DF(0.5f, 0.2f), 0);
                triangle.SetUVByIndex(new asd.Vector2DF(0.1f, 0.5f), 1);
                triangle.SetUVByIndex(new asd.Vector2DF(0.9f, 0.7f), 2);

                geometryObj5.Shape = triangle;
                geometryObj5.Texture = texture;
                geometryObj5.Position = new asd.Vector2DF(0, 0);
            }

            {
                var polygon = new asd.PolygonShape();

                for (int i = 0; i < 10; ++i)
                {
                    asd.Vector2DF vec = new asd.Vector2DF(1, 0);
                    vec.Degree = i * 36;
                    vec.Length = (i % 2 == 0) ? 100 : 55;
                    polygon.AddVertex(vec + new asd.Vector2DF(500, 250));

                }

                geometryObj6.Shape = polygon;
                geometryObj6.Texture = texture;
                geometryObj6.Position = new asd.Vector2DF(0, 0);
            }
        }
Example #14
0
 public void setVelocity(asd.Vector2DF velocity)
 {
     this.velocity = velocity;
 }
Example #15
0
 public void Reflect(asd.Vector2DF direction)
 {
     direction.Normalize();
     float dot = asd.Vector2DF.Dot(velocity, direction);
     velocity -= 1.8f * dot * direction;
 }
Example #16
0
 public void AddedForce(asd.Vector2DF acceleration)
 {
     velocity += acceleration;
 }
Example #17
0
        public ItemGetEffect_SpeedThreeShot(asd.Vector2DF pos) : base(pos)
        {
            Texture = asd.Engine.Graphics.CreateTexture2D("Resources/effect8.png");

            Src = new asd.RectF(0, 0, TextureSize, TextureSize);
        }
Example #18
0
 public void OnMousePlayerCity(asd.Vector2DF pos)
 {
     Player.City.OnMouse(pos);
 }
Example #19
0
 /// <summary>
 /// Vector型に変換する
 /// </summary>
 /// <param name="vector">Vector2DF型</param>
 /// <returns>Vector型</returns>
 public static Vector ToScriptVector(this asd.Vector2DF vector)
 {
     return(new Vector(vector.X, vector.Y));
 }
Example #20
0
 public void setVelocity(asd.Vector2DF velocity)
 {
     this.velocity = velocity;
 }
        bool IsContainAtTriangle(asd.Vector2DF vertex1, asd.Vector2DF vertex2, asd.Vector2DF vertex3, asd.Vector2DF vector)
        {
            float c1 = asd.Vector2DF.Cross(vertex2 - vertex1, vector - vertex2);
            float c2 = asd.Vector2DF.Cross(vertex3 - vertex2, vector - vertex3);
            float c3 = asd.Vector2DF.Cross(vertex1 - vertex3, vector - vertex1);

            if ((c1 > 0 && c2 > 0 && c3 > 0) || (c1 < 0 && c2 < 0 && c3 < 0))
            {
                return(true);
            }

            return(false);
        }
Example #22
0
 public void AddedForce(asd.Vector2DF acceleration)
 {
     velocity += acceleration;
 }
Example #23
0
        protected override void OnUpdate()
        {
            if (Count % 120 == 0)
            {
                asd.Engine.Sound.SetVolume(asd.Engine.Sound.Play(ShotSound), VolumeChange);
                HP += 3;
                AddBullet(Position + new asd.Vector2DF(100, 0), new asd.Vector2DF(0, 6), 20, Position);
                AddBullet(Position + new asd.Vector2DF(-150, 0), new asd.Vector2DF(0, 6), 20, Position);
                AddBullet(Position + new asd.Vector2DF(-100, 0), new asd.Vector2DF(0, -6), 20, Position);
                AddBullet(Position + new asd.Vector2DF(150, 0), new asd.Vector2DF(0, -6), 20, Position);
                Layer.AddObject(new EnemyBullet(Position, new asd.Vector2DF(-4, 2), 10));
                Layer.AddObject(new EnemyBullet(Position, new asd.Vector2DF(4, 2), 10));
                Layer.AddObject(new EnemyBullet(Position, new asd.Vector2DF(0, 6), 20));
                Layer.AddObject(new EnemyBullet(Position, new asd.Vector2DF(3, 6), 20));
                Layer.AddObject(new EnemyBullet(Position, new asd.Vector2DF(-3, 6), 20));
            }
            if (Count % 60 == 0 && HP < MAXHP / 2)
            {
                HP += 7;
                AddBullet(Position + new asd.Vector2DF(200, 0), new asd.Vector2DF(0, 6), 15, Position);
                AddBullet(Position + new asd.Vector2DF(-250, 0), new asd.Vector2DF(0, 6), 15, Position);
                AddBullet(Position + new asd.Vector2DF(-200, 0), new asd.Vector2DF(0, -6), 15, Position);
                AddBullet(Position + new asd.Vector2DF(250, 0), new asd.Vector2DF(0, -6), 15, Position);
            }
            if (Count % 120 == 0 && HP < MAXHP / 2 && HP > MAXHP / 4)
            {
                int a = r.Next(5);
                switch (a)
                {
                case 0:
                    Layer.AddObject(new EnemyYellow(Position));
                    break;

                case 1:
                    Layer.AddObject(new EnemyBlue(Position));
                    break;

                case 2:
                    Layer.AddObject(new EnemyGreen(Position));
                    break;

                case 3:
                    Layer.AddObject(new EnemyPink(Position));
                    break;

                case 4:
                    Layer.AddObject(new EnemyWhite(Position));
                    break;

                case 5:
                    Layer.AddObject(new EnemyRed(Position));
                    break;
                }
            }
            if (Count % 150 == 0 && HP < MAXHP / 4)
            {
                int a = r.Next(8);
                switch (a)
                {
                case 0:
                    Layer.AddObject(new EnemyPink(Position));
                    Layer.AddObject(new EnemyRed(Position));
                    Layer.AddObject(new EnemyYellow(Position));
                    break;

                case 1:
                    Layer.AddObject(new EnemyRed(Position));
                    Layer.AddObject(new EnemyWhite(Position));
                    Layer.AddObject(new EnemyBlue(Position));
                    break;

                case 2:
                    Layer.AddObject(new EnemyPink(Position));
                    Layer.AddObject(new EnemyRed(Position));
                    Layer.AddObject(new EnemyGreen(Position));
                    break;

                case 3:
                    Layer.AddObject(new EnemyRed(Position));
                    Layer.AddObject(new EnemyPink(Position));
                    break;

                case 4:
                    Layer.AddObject(new EnemyRed(Position));
                    Layer.AddObject(new EnemyWhite(Position));
                    break;

                case 5:
                    Layer.AddObject(new EnemyPink(Position));
                    Layer.AddObject(new EnemyWhite(Position));
                    Layer.AddObject(new EnemyRed(Position));
                    break;

                case 6:
                    Layer.AddObject(new EnemyPink(Position));
                    Layer.AddObject(new EnemyYellow(Position));
                    Layer.AddObject(new EnemyRed(Position));
                    break;

                case 7:
                    Layer.AddObject(new EnemyPink(Position));
                    Layer.AddObject(new EnemyRed(Position));
                    Layer.AddObject(new EnemyGreen(Position));
                    break;
                }
            }
            foreach (var rot in BulletList)
            {
                rot.Position    += Vel;
                rot.RotateCenter = Position;
            }
            if (Count % 780 == 0)
            {
                foreach (var obj in BulletList)
                {
                    RotateBullet rot = obj;
                    int          z   = r.Next(4);
                    if (z == 1)
                    {
                        asd.Vector2DF re = rot.Position - Position;
                        rot.MoveVelocity = re.Normal * 10;
                    }
                }
            }
            if (Count > 10000)
            {
                Count = 0;
            }
            Count++;
            base.OnUpdate();
        }
Example #24
0
        protected override void OnUpdate()
        {
            switch (key)
            {
            case 1:
                if (asd.Engine.Keyboard.GetKeyState(asd.Keys.Z) == asd.KeyState.Push && ((GameScine)Layer.Scene).player1.otetsuki_count == 0)
                {
                    if (asd.Engine.Keyboard.GetKeyState(asd.Keys.Right) == asd.KeyState.Hold)
                    {
                        playingcard_right();
                    }
                    else
                    {
                        playingcard_left();
                    }
                }

                break;

            case 2:

                if (asd.Engine.Keyboard.GetKeyState(asd.Keys.X) == asd.KeyState.Push && ((GameScine)Layer.Scene).player1.otetsuki_count == 0)
                {
                    if (asd.Engine.Keyboard.GetKeyState(asd.Keys.Right) == asd.KeyState.Hold)
                    {
                        playingcard_right();
                    }
                    else
                    {
                        playingcard_left();
                    }
                }
                break;

            case 3:

                if (asd.Engine.Keyboard.GetKeyState(asd.Keys.C) == asd.KeyState.Push && ((GameScine)Layer.Scene).player1.otetsuki_count == 0)
                {
                    if (asd.Engine.Keyboard.GetKeyState(asd.Keys.Left) == asd.KeyState.Hold)
                    {
                        playingcard_left();
                    }
                    else
                    {
                        playingcard_right();
                    }
                }

                break;

            case 4:

                if (asd.Engine.Keyboard.GetKeyState(asd.Keys.V) == asd.KeyState.Push && ((GameScine)Layer.Scene).player1.otetsuki_count == 0)
                {
                    if (asd.Engine.Keyboard.GetKeyState(asd.Keys.Left) == asd.KeyState.Hold)
                    {
                        playingcard_left();
                    }
                    else
                    {
                        playingcard_right();
                    }
                }
                break;

            case 5:
                if (joystickCheck(14) && ((GameScine)Layer.Scene).player2.otetsuki_count == 0 && TitleScene.isCpuAssert == false)
                {
                    playingcard_left();
                }

                if (joystickCheck(3) && ((GameScine)Layer.Scene).player2.otetsuki_count == 0 && TitleScene.isCpuAssert == false)
                {
                    playingcard_right();
                }

                break;

            case 6:
                if (joystickCheck(17) && ((GameScine)Layer.Scene).player2.otetsuki_count == 0 && TitleScene.isCpuAssert == false)
                {
                    playingcard_left();
                }

                if (joystickCheck(0) && ((GameScine)Layer.Scene).player2.otetsuki_count == 0 && TitleScene.isCpuAssert == false)
                {
                    playingcard_right();
                }
                break;

            case 7:
                if (joystickCheck(15) && ((GameScine)Layer.Scene).player2.otetsuki_count == 0 && TitleScene.isCpuAssert == false)
                {
                    playingcard_left();
                }

                if (joystickCheck(2) && ((GameScine)Layer.Scene).player2.otetsuki_count == 0 && TitleScene.isCpuAssert == false)
                {
                    playingcard_right();
                }
                break;

            case 8:
                if (joystickCheck(16) && ((GameScine)Layer.Scene).player2.otetsuki_count == 0 && TitleScene.isCpuAssert == false)
                {
                    playingcard_left();
                }

                if (joystickCheck(1) && ((GameScine)Layer.Scene).player2.otetsuki_count == 0 && TitleScene.isCpuAssert == false)
                {
                    playingcard_right();
                }
                break;

            default:
                break;
            }

            //おてつき画像表示
            if (((GameScine)Layer.Scene).player1.otetsuki_count > 0 && ((GameScine)Layer.Scene).player1.otetsuki_flag == false)
            {
                asd.Engine.AddObject2D(new Otetsuki(otetsuki, new asd.Vector2DF(250, 655)));

                ((GameScine)Layer.Scene).player1.otetsuki_flag = true;
            }

            if (((GameScine)Layer.Scene).player2.otetsuki_count > 0 && ((GameScine)Layer.Scene).player2.otetsuki_flag == false)
            {
                asd.Engine.AddObject2D(new Otetsuki(otetsuki, new asd.Vector2DF(245, 120)));

                ((GameScine)Layer.Scene).player2.otetsuki_flag = true;
            }


            Texture = card_now.Texture;


            asd.Vector2DF position = Position;

            position.X = asd.MathHelper.Clamp(position.X, asd.Engine.WindowSize.X - Texture.Size.X / 2.0f, Texture.Size.X / 2.0f);
            position.Y = asd.MathHelper.Clamp(position.Y, asd.Engine.WindowSize.Y - Texture.Size.Y / 2.0f, Texture.Size.Y / 2.0f);

            Position = position;

            count++;
        }
Example #25
0
 public void SetForce(asd.Vector2DF dir, float power)
 {
     Acceleration = dir.Normal * power;
 }
Example #26
0
        protected override void OnUpdate()
        {
            // startCount から validCount 経過したら
            if (count >= validCount + startCount)
            {
                // bossとの親子関係を解消する
                boss.RemoveChild(this);

                // レーザー消滅
                Dispose();
            }

            // startCount に達するまでは
            else if (count < startCount)
            {
                // Scaleでチャージの拡大率を上げる
                Scale += new asd.Vector2DF(0.1f, 0.1f);

                // Colorでアルファ値を設定する
                Color = new asd.Color(255, 255, 255, startAlpha);

                // startCountの数だけアルファ値にこれを足したら255(不透明)になるよう設定する
                startAlpha += (byte)((255 - startAlpha) / startCount);

                // 予測線を表示する 
                DrawLineAdditionally(GetGlobalPosition(), destPos, new asd.Color(120, 160, 255, startAlpha), 5, asd.AlphaBlendMode.Add, 0);
            }

            // レーザーが照射されている時の処理
            // プレイヤーのいる方へレーザーの向きを調整する
            else
            {
                // アルファ値を0(透明)にする
                Color = new asd.Color(255, 255, 255, 0);

                // 現在の絶対座標を取得する
                globalPos = GetGlobalPosition();

                // レーザーを向けたい目標の方向ベクトルを設定する
                asd.Vector2DF destDirection = player.Position - globalPos;

                // ベクトルの内積を用いて destDirection の direction に平行な成分を parallelVector として取り出す
                asd.Vector2DF parallelVector = asd.Vector2DF.Dot(destDirection, direction) / direction.Length * direction.Normal;

                // ベクトルの差を用いて destDirection の direction に垂直な成分を verticalVector として取り出す
                asd.Vector2DF verticalVector = (destDirection - parallelVector);

                // レーザーの当たり判定の範囲内にプレイヤーがいない場合は
                if (verticalVector.Length > 5 + player.Radius)
                {
                    // 角速度に応じて verticalVector の大きさを設定する
                    direction += verticalVector.Normal * direction.Length * (float)Math.Abs(Math.Tan(angleVelocity));

                    // direction の長さは既定の length を使用する
                    direction.Length = length;

                    // レーザーの目標地点を更新する
                    destPos = globalPos + direction;
                }
                else
                {
                    // 衝突処理
                    player.OnCollide(null);
                }

                // レーザーを加算合成で描画する
                DrawLineAdditionally(GetGlobalPosition(), destPos, new asd.Color(0, 20, 255, 255), 20, asd.AlphaBlendMode.Add, 0);
                DrawLineAdditionally(GetGlobalPosition(), destPos, new asd.Color(40, 50, 255, 255), 16, asd.AlphaBlendMode.Add, 0);
                DrawLineAdditionally(GetGlobalPosition(), destPos, new asd.Color(80, 90, 255, 255), 12, asd.AlphaBlendMode.Add, 0);
                DrawLineAdditionally(GetGlobalPosition(), destPos, new asd.Color(120, 160, 255, 255), 10, asd.AlphaBlendMode.Add, 0);
            }

            // bossがDisposeされていたら
            if (!boss.IsAlive)
            {
                // Disposeする
                Dispose();
            }

            // 更新ごとに1つカウントする
            count++;
        }
Example #27
0
 public void Gravity()
 {
     Velocity += new asd.Vector2DF(0, 0.5f);
 }
Example #28
0
 protected override void OnUpdate()
 {
     base.OnUpdate();
     Position = new asd.Vector2DF(Consts.Window.Width / 2, Consts.CharSize.Y * 3) * 0.01f + this.Position * 0.99f;
 }
 public SpeedThereeShotItem(asd.Vector2DF pos) : base(pos)
 {
     Texture = asd.Engine.Graphics.CreateTexture2D("Resources/Item5.png");
 }
Example #30
0
 //private float jumppos = 0.0f;
 public Player()//constructor
 {
     Texture  = asd.Engine.Graphics.CreateTexture2D("Resources/player.png");
     Position = new asd.Vector2DF(60, 100);
 }
Example #31
0
 public Otetsuki(asd.Texture2D tex, asd.Vector2DF pos)
 {
     Texture  = tex;
     Position = pos;
 }
Example #32
0
 // コンストラクタ(敵の初期位置を引数として受け取る。)
 public StraightMovingEnemyBullet(asd.Vector2DF pos, asd.Vector2DF movevelocity)
     : base(pos)
 {
     // 敵弾の速度ベクトルを設定する。
     moveVelocity = movevelocity;
 }
Example #33
0
 public MapTip(System.Drawing.Color color, asd.Vector2DF pos, Scene.Field.Data data)
 {
     Texture = Resource.CharactorGraph;
     if (color.R == 255)
     {
         type = Type.Wall;
         if (color.G == 0 && color.B == 0)
         {
             Src = Resource.GraphSrc(Resource.GraphType.Wall);
         }
         else if (color.G == 100 && color.B == 0)
         {
             Src = Resource.GraphSrc(Resource.GraphType.Block);
         }
         else if (color.G == 150 && color.B == 0)
         {
             Src = Resource.GraphSrc(Resource.GraphType.Table);
         }
         if (color.B == 200)
         {
             if (color.G == 40)
             {
                 Src = Resource.GraphSrc(Resource.GraphType.PartitionVertical);
             }
             else if (color.G == 80)
             {
                 Src = Resource.GraphSrc(Resource.GraphType.PatitionHorizontal);
             }
             else if (color.G == 120)
             {
                 Src = Resource.GraphSrc(Resource.GraphType.PartitionLeftTop);
             }
             else if (color.G == 160)
             {
                 Src = Resource.GraphSrc(Resource.GraphType.PartitionRightTop);
             }
             else if (color.G == 200)
             {
                 Src = Resource.GraphSrc(Resource.GraphType.PartitionLeftBottom);
             }
             else if (color.G == 240)
             {
                 Src = Resource.GraphSrc(Resource.GraphType.PartitionRightBottom);
             }
         }
     }
     else if (color.G == 255)
     {
         type = Type.Ground;
         if (color.R == 0 && color.B == 0)
         {
             Src = Resource.GraphSrc(Resource.GraphType.Ground);
         }
         else if (color.R == 200 && color.B == 0)
         {
             Src = Resource.GraphSrc(Resource.GraphType.Step);
         }
         else if (color.R == 0 && color.B == 100)
         {
             Src = Resource.GraphSrc(Resource.GraphType.Person);
         }
         else if (color.R == 100 && color.B == 100)
         {
             Src = Resource.GraphSrc(Resource.GraphType.Ground);
             data.Player.Position = pos;
         }
     }
     else if (color.B == 255)
     {
         type = Type.Event;
         if (color.G == 0 && color.R == 0)
         {
             Src = Resource.GraphSrc(Resource.GraphType.Ground);
         }
         else if (color.G == 100 && color.R == 0)
         {
             Src = Resource.GraphSrc(Resource.GraphType.Table);
         }
     }
     Position = pos;
 }
 public ExplosionEffect(asd.Vector2DF firstPosition)
 {
     Texture        = asd.Engine.Graphics.CreateTexture2D("Resources/explosion.png");
     Position       = firstPosition;
     CenterPosition = new asd.Vector2DF(16, 16);
 }
 public RushingEnemy(asd.Vector2DF pos, Player player)
     : base(pos, player)
 {
     // 速度ベクトルベクトルを初期化。
     moveVelocity = new asd.Vector2DF();
 }
Example #36
0
 public Player()
 {
     Position = new asd.Vector2DF(asd.Engine.WindowSize.X / 3, asd.Engine.WindowSize.Y / 2);
 }
Example #37
0
 public Effect(asd.Vector2DF pos)
 {
     Position = pos;
     Effect   = asd.Engine.Graphics.CreateEffect("aaa.efk");
 }
Example #38
0
 public UpArrow(asd.Vector2DF pos)
     : base(pos)
 {
 }
Example #39
0
 asd.Vector2DF VRandm(asd.Vector2DF v, int m)
 {
     return(new asd.Vector2DF((float)(Math.Floor(((v.X + m - 1) / m)) * m),
                              (float)(Math.Floor(((v.Y + m - 1) / m)) * m)));
 }
        List <PolygonDef> DivideToTriangles(List <asd.Vector2DF> argVertexes)
        {
            if (argVertexes.Count < 3)
            {
                return(null);
            }

            List <PolygonDef> result = new List <PolygonDef>();

            if (argVertexes.Count == 3)
            {
                result.Add(CreatePolygonDef(argVertexes[0], argVertexes[1], argVertexes[2]));
                return(result);
            }

            asd.Vector2DF root = new asd.Vector2DF();
            foreach (var item in argVertexes)
            {
                if (root.Length < item.Length)
                {
                    root = item;
                }
            }

            asd.Vector2DF next1, next2;
            next1 = argVertexes.IndexOf(root) != argVertexes.Count - 1 ? argVertexes[argVertexes.IndexOf(root) + 1] : argVertexes[0];
            next2 = argVertexes.IndexOf(root) != 0 ? argVertexes[argVertexes.IndexOf(root) - 1] : argVertexes[argVertexes.Count - 1];

            float cross = asd.Vector2DF.Cross(next1 - root, next2 - root);

            while (true)
            {
                bool isDivideble = true;
                foreach (var item in argVertexes)
                {
                    if (IsContainAtTriangle(root, next1, next2, item))
                    {
                        isDivideble = false;
                    }
                }

                if (!isDivideble)
                {
                    do
                    {
                        root  = argVertexes.IndexOf(root) != argVertexes.Count - 1 ? argVertexes[argVertexes.IndexOf(root) + 1] : argVertexes[0];
                        next1 = argVertexes.IndexOf(next1) != argVertexes.Count - 1 ? argVertexes[argVertexes.IndexOf(next1) + 1] : argVertexes[0];
                        next2 = argVertexes.IndexOf(next2) != argVertexes.Count - 1 ? argVertexes[argVertexes.IndexOf(next2) + 1] : argVertexes[0];
                    } while (System.Math.Sign(cross) != System.Math.Sign(asd.Vector2DF.Cross(next1 - root, next2 - root)));
                }
                else
                {
                    break;
                }
            }

            result.Add(CreatePolygonDef(root, next1, next2));
            List <asd.Vector2DF> remain = new List <asd.Vector2DF>(argVertexes);

            remain.Remove(root);
            result.AddRange(DivideToTriangles(remain));
            return(result);
        }