Ejemplo n.º 1
0
        public virtual void Draw(Graphics g, int drawLength, int drawHeight, int[] topLefta)
        {
            Bitmap drawImage;
            int    animNumber;

            if (animated)
            {
                animNumber = (Globals.animations[0] + offset) % Globals.MAXFRAMES;
            }
            else
            {
                animNumber = 0;
            }
            drawImage = Globals.ResizeImage(rootImages[animNumber], drawLength / drawRatio, drawHeight / drawRatio);
            Globals.WriteDebug("Entity->Draw->", "animNumber is " + animNumber + " drawImage Height is" + rootImages[animNumber], false);
            this.topLeft.X     = topLefta[0] + ((drawRatio / 2) * drawImage.Width);
            this.topLeft.Y     = topLefta[1] + ((drawRatio / 2) * drawImage.Height);
            this.bottomRight.X = topLeft.X + drawImage.Width;
            this.bottomRight.Y = topLeft.Y + drawImage.Height;
            g.DrawImage(drawImage, new Point(topLeft.X, topLeft.Y));
            if (dying && (Globals.animations[0] + offset) % Globals.MAXFRAMES == Globals.MAXFRAMES - 1)
            {
                rootImages[0] = rootImages[Globals.MAXFRAMES - 1];
                dying         = false;
                animated      = false;
            }
            if (Globals.drawOutline)
            {
                g.DrawRectangle(new Pen(Color.Red), new Rectangle(topLeft.X, topLeft.Y, drawImage.Width, drawImage.Height));
                g.DrawRectangle(new Pen(Color.Cyan), new Rectangle(topLefta[0], topLefta[1], drawLength, drawHeight));
            }
        }
Ejemplo n.º 2
0
 /// <summary>
 /// UpdateGunSize is used to update the scale of all frames in 'animation'
 /// This is so all gun frames drawn are to the correct scale.
 /// This uses <see cref="Globals.ResizeImage(Image, int, int)"/>
 /// </summary>
 /// <param name="x">The width of the new scale</param>
 /// <param name="y">The height of the new scale</param>
 public void UpdateGunSize(int x, int y)
 {
     for (int i = 0; i < animation.Length; i++)
     {
         animation[i] = Globals.ResizeImage(animation[i], animation[i].Width * 8, animation[i].Height * 8);
     }
 }