Beispiel #1
0
        private void UpdateMoving()
        {
            float Dx = 0.0f;
            float Dy = 0.0f;

            if (GameGuiScreen.IsPlaying())
            {
                if (GameLevel.Input.Left.Down)
                {
                    ReqAngle = (int)Direction * 90;
                    MoveLeft(Speed);
                    Dx = Speed;
                }
                else if (GameLevel.Input.Right.Down)
                {
                    MoveRight(Speed);
                    Dx = -Speed;
                }
                else if (GameLevel.Input.Up.Down)
                {
                    MoveUp(Speed);
                    Dy = Speed;
                }
                else if (GameLevel.Input.Down.Down)
                {
                    MoveDown(Speed);
                    Dy = -Speed;
                }
            }

            if (GameLevel.GetIntersectingEntities(this).Count > 0 || GameLevel.GetIntersectingPlayers(this, IntersectionType.BY_ID).Count > 0)
            {
                X += Dx;
                Y += Dy;
            }

            Moving = Dx != 0 || Dy != 0;
            GameLevel.CenterCameraOnPlayer();

            if (Moving)
            {
                if (Speed < MaxSpeed)
                {
                    Speed += SpeedDelta;
                }
                if (SkippedTrackTicks++ > 2)
                {
                    SkippedTrackTicks = 0;
                    if (TrackState++ >= 2)
                    {
                        TrackState = 0;
                    }
                }
            }
            else
            {
                Speed      = MinSpeed;
                TrackState = 0;
            }
        }
Beispiel #2
0
        public void Shoot(bool justShoot = false)
        {
            long CurrentShot = Program.GetCurrentTimeMillis();

            if ((GameGuiScreen.IsPlaying() && !IsHolding() && !BindingMaster && !Shooting && CurrentShot - LastShot > SHOT_DELAY && Ammunition > 0) || justShoot)
            {
                if (IsMe(Id))
                {
                    ++GameComponent.Gs.IntStatsShots;
                }

                LastShot = CurrentShot;
                Shooting = true;
                --Ammunition;

                Sound.Shoot.Play();

                int[]  Spo = GetBulletStartPositionOffsets();
                Bullet B   = new Bullet(X + Spo[0], Y + Spo[1], Id, Direction, Bonus.IsAPBulletsA());
                GameLevel.AddBullet(B);

                GameLevel.AddParticle(new BarrelFlame(X, Y, Direction, false));
            }
        }