Beispiel #1
0
        public override void Update(KeyMapping _kmp, Scene _sce)
        {
            if (!AABB.IsCollision(this.pos, this.box, new Point(0, 0), new Size(MainScreen.Width, MainScreen.Height)))
                this.Distroy = true;

            this.pos.X += this.Speed.X;
            this.pos.Y += this.Speed.Y;
        }
Beispiel #2
0
 public override void Update(KeyMapping _kmp, Scene _sce)
 {
     if (this.Life <= 0)
     {
         this.IsDead = true;
         this.Life = 0;
     }
     else
         this.IsDead = false;
 }
Beispiel #3
0
        public override void Update(KeyMapping _kmp, Scene _sce)
        {
            base.Update(_kmp, _sce);

            this.IsDamaged = false;

            if (IsDead)
                this.pos = new Point(-999, -999);

            if (this.BulletCoolDown < 0)
                this.BulletCoolDown = 0;

            if (this.BulletCoolDown > 0)
                this.BulletCoolDown--;

            if (_kmp.IsPressing(Joypad.Left))
                if (this.pos.X - BaseStep > 0)
                    this.pos.X -= BaseStep;
                else
                    this.pos.X = 0;

            if (_kmp.IsPressing(Joypad.Right))
                if (this.pos.X + BaseStep + this.box.Width < MainScreen.Width   )
                    this.pos.X += BaseStep;
                else
                    this.pos.X = MainScreen.Width    - this.box.Width;

            if (_kmp.IsPressing(Joypad.Up))
                if (this.pos.Y - BaseStep > 0)
                    this.pos.Y -= BaseStep;
                else
                    this.pos.Y = 0;

            if (_kmp.IsPressing(Joypad.Down))
                if (this.pos.Y + BaseStep + this.box.Height < MainScreen.Height)
                    this.pos.Y += BaseStep;
                else
                    this.pos.Y = MainScreen.Height - this.box.Height;

            if (this.BulletCoolDown == 0 && _kmp.IsPressing(Joypad.A))
            {
                if (this.WeaponList[this.WeaponType] == "N")
                {
                    _sce.AddGameObject(new PC_WeaponN(new Point(this.pos.X + 5, this.pos.Y)));
                    this.BulletCoolDown = 5;
                }
                else if (this.WeaponList[this.WeaponType] == "L")
                {
                    _sce.AddGameObject(new PC_WeaponL(new Point(0, this.pos.Y)));
                    this.BulletCoolDown = 1;
                }
                else if (this.WeaponList[this.WeaponType] == "W")
                {
                    _sce.AddGameObject(new PC_WeaponW(new Point(this.pos.X + 10, this.pos.Y)));
                    this.BulletCoolDown = 2;

                }
            }

            if(_kmp.IsPressed(Joypad.X))
            {
                this.WeaponType--;
                if (this.WeaponType < 0)
                    this.WeaponType += this.WeaponList.GetLength(0);

                if (this.WeaponType >= this.WeaponList.GetLength(0))
                    this.WeaponType -= this.WeaponList.GetLength(0);
            }

            if (_kmp.IsPressed(Joypad.Y))
            {
                this.WeaponType--;
                if (this.WeaponType < 0)
                    this.WeaponType += this.WeaponList.GetLength(0);

                if (this.WeaponType >= this.WeaponList.GetLength(0))
                    this.WeaponType -= this.WeaponList.GetLength(0);
            }
        }
Beispiel #4
0
        public override void Update(KeyMapping _kmp, Scene _sce)
        {
            if (this.lifetime < 20)
            {
                base.Update(_kmp, _sce);
                this.pos.X--;
                this.box.Width += 2;
            }
            else
                this.Distroy = true;

            lifetime++;
        }
Beispiel #5
0
        public override void Update(KeyMapping _kmp, Scene _sce)
        {
            if (_kmp.IsPressed(Joypad.A))
                this.IsTriggered = true;

            base.Update(_kmp, _sce);

            if (!this.IsTriggered)
                this.pos.X = ((MainGameScene)_sce).GetPlayer().pos.X + 10;
        }
Beispiel #6
0
        public override void Update(KeyMapping _kmp, Scene _sce)
        {
            int tmp = Convert.ToInt32(Easing.linear(tick, this.pos.X, this.PrevPoint.X - this.pos.X, 300));
            tick++;

            if (tick >= 300)
                this.Distroy = true;

            this.Speed.X = tmp - this.pos.X;

            base.Update(_kmp, _sce);
        }
Beispiel #7
0
 public override void Update(KeyMapping _kmp, Scene _sce)
 {
     base.Update(_kmp, _sce);
     this.pos.Y += 10;
 }
Beispiel #8
0
        public override void Update(KeyMapping _kmp, Scene _sce)
        {
            if(this.tick % 5 == 0)
            {
                Point p = ((MainGameScene)_sce).GetPlayer().pos;
                Size s = ((MainGameScene)_sce).GetPlayer().box;

                Point pm = ((Box)tmpobj).pos;
                Size sm = ((Box)tmpobj).box;

                _sce.AddGameObject(new EN_Danmu_Child(new Point(pm.X + sm.Width / 2 - 10 , pm.Y + sm.Height), new Point(p.X + s.Width / 2 , p.Y + s.Height), new Size(20, 20), 30));
            }

            base.Update(_kmp, _sce);
        }
Beispiel #9
0
 public override void Update(KeyMapping _kmp, Scene _sce)
 {
     if (this.tick >= this.Duration)
         this.Distroy = true;
     else
         this.tick++;
 }
Beispiel #10
0
        public override void Update(KeyMapping _kmp, Scene _sce)
        {
            if(this.tick % D == 0)
            {
                Point pm = ((Box)tmpobj).pos;
                Size sm = ((Box)tmpobj).box;

                double degree = (double)360 / this.W;

                double start_degree = degree;

                if (this.W % 2 == 0)
                    start_degree = -0.5 * start_degree;

                for (int i = 0; i < this.W; i++)
                {
                    double delta_degree = start_degree + i * degree;

                    if (this.type == 0)
                        _sce.AddGameObject(new DanmuChild_Cycle(this.pos, delta_degree, 0));
                    else if (this.type == 1)
                        _sce.AddGameObject(new DanmuChild_Cycle(this.pos, delta_degree, 1));
                    else if (this.type == 2)
                        _sce.AddGameObject(new DanmuChild_Cycle(this.pos, delta_degree, this.tick % (D * 2) == 0 ? 2 : 3));
                    else if (this.type == 3)
                        _sce.AddGameObject(new DanmuChild_Cycle(this.pos, delta_degree, i % 2 == 0 ? 2 : 3));
                    else if(this.type == 4)
                        _sce.AddGameObject(new DanmuChild_Cycle(this.pos, delta_degree, 2));
                    else if (this.type == 5)
                        _sce.AddGameObject(new DanmuChild_Cycle(this.pos, delta_degree, 3));
                }
            }

            base.Update(_kmp, _sce);
        }
Beispiel #11
0
        public override void Update(KeyMapping _kmp, Scene _sce)
        {
            if (this.tick >= this.Duration)
                this.Distroy = true;
            else
            {
                this.pos.X = Convert.ToInt32(Easing.easeInOutSine(tick, this.Start_pos.X, this.End_pos.X - this.Start_pos.X, this.Duration));
                this.pos.Y = Convert.ToInt32(Easing.easeInOutSine(tick, this.Start_pos.Y, this.End_pos.Y - this.Start_pos.Y, this.Duration));

                this.tick++;
            }
        }
Beispiel #12
0
        public override void Update(KeyMapping _kmp, Scene _sce)
        {
            if(this.DamageCoolDown != 0)
                this.DamageCoolDown--;

            //if ((tick / 100) % 2 == 0 && tick % 5 == 0)
            //    _sce.AddGameObject(new EN_WeaponP_Trace(new Point(this.pos.X + 23, this.pos.Y + this.box.Height) , ((MainGameScene)_sce).GetPlayer().pos ));
            //if ((tick / 100) % 2 == 1 && tick % 5 == 0)
            //    _sce.AddGameObject(new EN_WeaponP(new Point(this.pos.X + 23, this.pos.Y + this.box.Height)));

            if(tick % 1000 == 0)
                _sce.AddGameObject(new EN_WeaponCiculiar(this.pos , this , R.Next(0,4) , 50 , 8 , 100));

            base.Update(_kmp, _sce);
            this.IsDamaged = false;

            if (IsDead)
                this.Distroy = true;

            this.Speed.X = Convert.ToInt32((Math.Sin(Math.PI * (double)tick / 180) + 1) * 0.5 * (MainScreen.Width - this.box.Width - 20)) - this.pos.X + 10;
            this.Speed.Y = Convert.ToInt32((Math.Cos(Math.PI * (double)tick / 180) + 1) * 0.5 * (200 - this.box.Height - 20)) - this.pos.Y + 10;

            this.pos.X += this.Speed.X;
            this.pos.Y += this.Speed.Y;

            if(this.pos.X < 0)
            {
                this.pos.X = 0;
                this.Speed.X *= -1;
            }

            if(this.pos.X + this.box.Width > MainScreen.Width)
            {
                this.pos.X = MainScreen.Width - this.box.Width;
                this.Speed.X *= -1;
            }

            if (this.pos.Y < 0)
            {
                this.pos.Y = 0;
                this.Speed.Y *= -1;
            }

            if (this.pos.Y + this.box.Height > MainScreen.Height)
            {
                this.pos.Y = MainScreen.Height - this.box.Height;
                this.Speed.Y *= -1;
            }

            this.tick++;
        }
Beispiel #13
0
        public override void Update(KeyMapping _kmp, Scene _sce)
        {
            //if (!AABB.IsCollision(this.pos, this.box, new Point(0, 0), new Size(MainScreen.Width, MainScreen.Height)))
            //    this.Distroy = true;

            if (this.tick >= this.Duration)
                this.Distroy = true;
            else
            {
                double delta_degree = Math.Abs(tick - (this.Duration / 2)) + this.degree;

                if (this.RKind == 0)
                {
                    this.pos.X = this.Start_pos.X + Convert.ToInt32(tick * Math.Sin((this.degree + tick) * Math.PI / 180));
                    this.pos.Y = this.Start_pos.Y + Convert.ToInt32(tick * Math.Cos((this.degree + tick) * Math.PI / 180));
                }
                else if (this.RKind == 1)
                {
                    this.pos.X = this.Start_pos.X + Convert.ToInt32(tick * Math.Cos((this.degree + tick) * Math.PI / 180));
                    this.pos.Y = this.Start_pos.Y + Convert.ToInt32(tick * Math.Sin((this.degree + tick) * Math.PI / 180));
                }
                else if (this.RKind == 2)
                {
                    this.pos.X = this.Start_pos.X + Convert.ToInt32(tick * Math.Sin(delta_degree * Math.PI / 180));
                    this.pos.Y = this.Start_pos.Y + Convert.ToInt32(tick * Math.Cos(delta_degree * Math.PI / 180));
                }
                else if (this.RKind == 3)
                {
                    this.pos.X = this.Start_pos.X + Convert.ToInt32(tick * Math.Cos(delta_degree * Math.PI / 180));
                    this.pos.Y = this.Start_pos.Y + Convert.ToInt32(tick * Math.Sin(delta_degree * Math.PI / 180));
                }

                    //this.pos.X = this.Start_pos.X + Convert.ToInt32(tick * Math.Cos((double)(tick + this.degree) * Math.PI / 180));
                    //this.pos.Y = this.Start_pos.Y + Convert.ToInt32(tick * Math.Sin((double)(tick + this.degree) * Math.PI / 180));

                    this.tick++;
            }
        }
Beispiel #14
0
 public virtual void Update(KeyMapping _kmp , Scene _sce)
 {
 }
 public override void Update(KeyMapping _kmp , Scene _sce)
 {
     for (int i = 0; i < 10; i++)
         if (_kmp.IsPressing(JoypadList[i]))
             ((BoolDisplayer)SceneObjList[i]).Set(true);
         else
             ((BoolDisplayer)SceneObjList[i]).Set(false);
 }