public override void Draw(Graphics g, Engine.PointF Dimensions) { if (Texture.Image != null) { g.DrawImage(Texture.Image, Dimensions); //Draw the image } }
public Shield(ref Engine.PointF Position, int player) : base("Shield" + player, null, 50, 50) { this.Following = Position; this.player = player; this.Visible = false; Game.AddElement(this); this.ZOrder = 10; controller = XboxController.RetrieveController(player - 1); FramesOfShield = (int)(Game.FrameRate * ShieldDuration); }
public override void Draw(Graphics G, Engine.PointF Dimensions) { base.Draw(G, Dimensions); Engine.PointF pos; if (this.PlayerNumber == 1) { pos = Following.Position; } else { pos = Following2.Position; } var ScreenPosition = Game.GameToScreenCoordinates(pos, Dimensions, 32, 32); ScreenPosition.X += 16; ScreenPosition.Y += 16; foreach (float angle in angles) { System.Drawing.PointF p1 = new System.Drawing.PointF(ScreenPosition.X, ScreenPosition.Y); System.Drawing.PointF p2 = new System.Drawing.PointF(ScreenPosition.X, ScreenPosition.Y); p1.X += (float)Math.Cos(-angle * Math.PI / 180.0) * 30; p1.Y += (float)Math.Sin(-angle * Math.PI / 180.0) * 30; p2.X += (float)Math.Cos(-angle * Math.PI / 180.0) * 40; p2.Y += (float)Math.Sin(-angle * Math.PI / 180.0) * 40; int r = 100; int g, b; if (this.PlayerNumber == 1) { g = (int)(255 * velocity / MAX_VELOCITY); b = 100; } else { g = 100; b = (int)(255 * velocity / MAX_VELOCITY); } G.DrawLine(new Pen(Color.FromArgb(255, r, g, b), 10), p1, p2); } }
public override void Draw(Graphics G, Engine.PointF Dimensions) { var p = Game.GameToScreenCoordinates(this.Position, Dimensions, (int)Width * 100, (int)Height); if (LeftToRight) { for (int i = 0; i < Health; i++) { G.DrawImage(this.Models[0].Image, p); p.X += Width; } } else { p.X += Width * 100; for (int i = 0; i < Health; i++) { G.DrawImage(this.Models[0].Image, p); p.X -= Width; } } }
public override void Draw(Graphics G, Engine.PointF Dimensions) { base.Draw(G, Dimensions); var p = Game.GameToScreenCoordinates((Engine.PointF)Following.Clone(), Dimensions, 50, 50); float af = (255 * ((float)FramesOfShield / (float)(Game.FrameRate * ShieldDuration))); if (af > 255) { af = 255; } if (af < 0) { af = 0; } int a = (int)af; int r = 0; int g = 255 * Math.Abs(player - 2); int b = 255 * (player - 1); G.DrawEllipse(new Pen(Color.FromArgb(a, r, g, b), 3), p.X, p.Y, 50, 50); G.FillEllipse(new SolidBrush(Color.FromArgb((int)(af / 255 * 100), r, g, b)), p.X, p.Y, 50, 50); }
public static PointF GameToScreenCoordinates(PointF Position, float Width, float Height) { return(new PointF((Position.X + Dimensions.Width / 2f) - Width / 2f, (-Position.Y + Dimensions.Height / 2f) - Height / 2f)); }