Beispiel #1
0
        public MonsterPiranah(int x, int y, PiranahType T)
            : base(ObjectType.OT_Pirana)
        {
            ImageCount = 10;

            Type = T;
            SetPiranahProperties();
            Move = PiranaMove.PM_None;

            this.x = x;
            this.y = y;
            SetWidthHeight();
            newx += 8;
            width = 16;
            OffY  = 0;
            Live  = true;

            Ball = new FireBall(0, 0);
            AddObject(Ball);

            TimerGenerator.AddTimerEventHandler(TimerType.TT_500, OnAnimate);
            TimerGenerator.AddTimerEventHandler(TimerType.TT_50, OnMove);
        }
        public MonsterPiranah(int x, int y, PiranahType T)
            : base(ObjectType.OT_Pirana)
        {
            ImageCount = 10;

            Type = T;
            SetPiranahProperties();
            Move = PiranaMove.PM_None;

            this.x = x;
            this.y = y;
            SetWidthHeight();
            newx += 8;
            width = 16;
            OffY = 0;
            Live = true;

            Ball = new FireBall(0, 0);
            AddObject(Ball);

            TimerGenerator.AddTimerEventHandler(TimerType.TT_500, OnAnimate);
            TimerGenerator.AddTimerEventHandler(TimerType.TT_50, OnMove);
        }
Beispiel #3
0
        public void OnMove(object sender, EventArgs e)
        {
            if (Live == false)
            {
                return;
            }

            if (Move == PiranaMove.PM_Up)
            {
                if (Type == PiranahType.PT_Fire)
                {
                    Animated = false;
                }
                else
                {
                    Animated = true;
                }

                OffY += 1;
                newy -= 1;

                if (OffY >= height)
                {
                    Move = PiranaMove.PN_Middle;
                    OffY = 0;
                }
            }
            else
            if (Move == PiranaMove.PM_Down)
            {
                if (Type == PiranahType.PT_Fire)
                {
                    Animated = false;
                    if (!Ball.Started)
                    {
                        UpdateOffsetsFireBall();
                        if (FireOnce)
                        {
                            Ball.RunFireBall(newx, newy, FireBall.FireBallType.FT_Piranah, FireBall.FireBallDir.FB_Left);
                            FireOnce = false;
                        }
                    }
                }
                else
                {
                    Animated = true;
                }


                OffY += 1;
                newy += 1;

                if (OffY >= height)
                {
                    Move = PiranaMove.PM_None;
                    OffY = 0;
                }
            }
            else if (Move == PiranaMove.PN_Middle)
            {
                Animated = true;


                OffY += 1;

                if (OffY >= height)
                {
                    Move     = PiranaMove.PM_Down;
                    FireOnce = true;
                    OffY     = 0;
                }
            }
            else
            {
                OffY += 1;

                if (OffY >= height * 2)
                {
                    Move = PiranaMove.PM_Up;
                    OffY = 0;
                    SetDirection();
                }
            }
        }
        public void OnMove(object sender, EventArgs e)
        {
            if (Live == false)
                return;

            if (Move == PiranaMove.PM_Up)
            {
                if (Type == PiranahType.PT_Fire)
                    Animated = false;
                else
                    Animated = true;

                OffY += 1;
                newy -= 1;

                if (OffY >= height)
                {
                    Move = PiranaMove.PN_Middle;
                    OffY = 0;
                }

            }
            else
                if (Move == PiranaMove.PM_Down)
                {
                    if (Type == PiranahType.PT_Fire)
                    {
                        Animated = false;
                        if (!Ball.Started)
                        {
                            UpdateOffsetsFireBall();
                            if (FireOnce)
                            {
                                Ball.RunFireBall(newx, newy, FireBall.FireBallType.FT_Piranah, FireBall.FireBallDir.FB_Left);
                                FireOnce = false;
                            }
                        }
                    }
                    else
                        Animated = true;

                    OffY += 1;
                    newy += 1;

                    if (OffY >= height)
                    {
                        Move = PiranaMove.PM_None;
                        OffY = 0;
                    }

                }
                else if (Move == PiranaMove.PN_Middle)
                {
                    Animated = true;

                    OffY += 1;

                    if (OffY >= height)
                    {
                        Move = PiranaMove.PM_Down;
                        FireOnce = true;
                        OffY = 0;
                    }

                }
                else
                {
                    OffY += 1;

                    if (OffY >= height * 2)
                    {
                        Move = PiranaMove.PM_Up;
                        OffY = 0;
                        SetDirection();
                    }
                }
        }