コード例 #1
0
ファイル: Form1.cs プロジェクト: Pierretag/snake
        public Form1()
        {
            
            InitializeComponent();
            MainGame = new Game(
                new Coords(this.GamePanel.Left,this.GamePanel.Top),
                new Coords(this.GamePanel.Size.Width, this.GamePanel.Size.Height)
                );

            Snake = new List<Segment>();
            int i;
          //  Segment seg = new Segment((int)Segment.typeSel.Snake, (int)Segment.direction.DL, new Coords(50, 18));
            for (i = 5; i >0; i--)
            {
                Snake.Add(
                    new Segment((int)Segment.typeSel.Snake,
                        (int)Segment.direction.H,
                        new Coords(i*10 + MainGame.GameLocation.x  , 10 + MainGame.GameLocation.y)
                        )
                        );

            }
            Snake.ElementAt(0).ChangeDirection((int)Segment.direction.HL);
            Snake.Last().ChangeDirection((int)Segment.direction.QR);
            
            foreach (Segment segi in Snake)
            {
                this.Controls.Add(segi);
                segi.BringToFront();
            }

        }