Пример #1
0
        //-----------------

        //Graphics//
        private void RacingGame_Paint(object sender, PaintEventArgs e)
        {
            Graphics g = e.Graphics;

            if (FIRST_SCENE)
            {
                foreground.DrawImage(g);
#if MyDebug
                g.DrawString($"X: {cursX}, Y: {cursY}", myFont, myBrush, 0, 0);
#endif
            }
            if (SECOND_SCENE)
            {
                background.DrawImage(g);
                scoreFrame.DrawImage(g);

                for (int x = 0; x < steps.Length; x++)
                {
                    steps[x].Left += 5;
                }
                for (int x = 0; x < steps.Length; x++)
                {
                    if (steps[x].Left >= 847)
                    {
                        steps[x].Left = 0;
                    }
                }
                for (int x = 0; x < steps.Length; x++)
                {
                    steps[x].DrawImage(g);
                }

                enemy.DrawImage(g);
                player.DrawImage(g);
                enemySecond.DrawImage(g);
#if MyDebug
                enemySecond.DrawDebugRectangle(g);
                enemy.DrawDebugRectangle(g);
#endif
                player.DrawDebugRectangle(g);

                menu.DrawImage(g);


                if (record > 1)
                {
                    g.DrawString($"Level: {Level}\n\nScore: {record}\n\nTime: {time}", new Font("stencil", 13), Brushes.Green, 310, 150);
                }
                else if (record < 0)
                {
                    g.DrawString($"Level: {Level}\n\nScore: {record}\n\nTime: {time}", new Font("stencil", 13), Brushes.Red, 310, 150);
                }
                else
                {
                    g.DrawString($"Level: {Level}\n\nScore: {record}\n\nTime: {time}", new Font("stencil", 13), Brushes.Black, 310, 150);
                }
#if MyDebug
                g.DrawString($"X: {cursX}, Y: {cursY}", myFont, myBrush, 0, 0);
                g.DrawString($"TOUCH X: {enemy.touchSpot.X}, Y: {enemy.touchSpot.Y}", myFont, myBrush, 0, 20);
#endif
            }
        }