Exemplo n.º 1
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);
            }
        }
Exemplo n.º 2
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);
        }
Exemplo n.º 3
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);
        }
Exemplo n.º 4
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++;
        }