Advertisement
Guest User

Untitled

a guest
Jun 28th, 2017
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.32 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using SnakeProject;
  6. using System.Drawing;
  7.  
  8.  
  9. namespace ProjektArbete_Lundahl_Löfvenhaft
  10. {
  11.     [Serializable]
  12.     class Cake : BallSnakeFood
  13.     {
  14.         /// <summary>
  15.         /// konstruktor utan argument
  16.         /// </summary>
  17.         public Cake() : base(21, 15)
  18.         {
  19.  
  20.         }
  21.         /// <summary>
  22.         /// konstruktor för att skapa kakan.
  23.         /// </summary>
  24.         /// <param name="x"></param>
  25.         /// <param name="y"></param>
  26.         /// <param name="color"></param>
  27.         /// <param name="size"></param>
  28.  
  29.         float storlek;
  30.         bool harRussin;
  31.         public Cake(int x, int y, Color color, float size, bool russin) : base(x, y)
  32.         {
  33.             BGColor = color;
  34.             storlek = size;
  35.             harRussin = russin;
  36.  
  37.         }
  38.  
  39.  
  40.         public override void Draw(Graphics g)
  41.         {
  42.  
  43.             base.Draw(g);
  44.             g.FillEllipse(new SolidBrush(BGColor), (int)Pos.X - (storlek/2), (int)Pos.Y - (storlek/2), storlek, storlek);
  45.  
  46.             if(harRussin == true)
  47.                 g.FillEllipse(new SolidBrush(Color.Black), (int)Pos.X - (storlek / 4),
  48.                 (int)Pos.Y - (storlek / 4), storlek / 2, storlek / 2);
  49.  
  50.  
  51.         }
  52.  
  53.        
  54.     }
  55. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement