Exemplo n.º 1
0
 public override bool OnUpdate(double ElapsedTime)
 {
     Engine.Drawer.Clear(System.Drawing.Color.LightGoldenrodYellow);
     Engine.Drawer.String("Your Score Is : ", "Arial", 24, System.Drawing.Color.Black, new System.Drawing.PointF((Engine.ScreenWidth() / 2) - 100, (Engine.ScreenHeight() / 2) - 40));
     Engine.Drawer.String($"{ScoreValue}", "Arial", 24, System.Drawing.Color.Black, new System.Drawing.PointF((Engine.ScreenWidth() / 2) - 100, (Engine.ScreenHeight() / 2)));
     if (Engine.KeyClicked(System.Windows.Forms.Keys.Space))
     {
         game = new Playing(this.Engine);
         Engine.RegisterScene(game);
         Engine.GoToScene(game);
     }
     return(base.OnUpdate(ElapsedTime));
 }
Exemplo n.º 2
0
        public override bool OnUpdate(double ElapsedTime)
        {
            Engine.Drawer.Sprite(new PointF(0, 0), Background);
            if (Engine.MouseOnTopOf(StartBtn))
            {
                StartBtn.SetAnimation("start_btn_on");
            }
            else
            {
                StartBtn.SetAnimation("start_btn_off");
            }

            if (Engine.MouseOnTopOf(RestartBtn))
            {
                RestartBtn.SetAnimation("restart_btn_on");
            }
            else
            {
                RestartBtn.SetAnimation("restart_btn_off");
            }

            if (Engine.MouseOnTopOf(StartBtn))
            {
                if (Engine.MouseClicked(System.Windows.Forms.MouseButtons.Left))
                {
                    UpDown.Play(false);
                    if (Game == null)
                    {
                        game = new Playing(this.Engine);
                    }
                    else
                    {
                        game = Game;
                    }
                    Engine.RegisterScene(game);
                    Engine.GoToScene(game);
                }
            }

            if (Engine.MouseOnTopOf(RestartBtn))
            {
                if (Engine.MouseClicked(System.Windows.Forms.MouseButtons.Left))
                {
                    UpDown.Play(false);
                    game = new Playing(this.Engine);
                    Engine.RegisterScene(game);
                    Engine.GoToScene(game);
                }
            }

            if (Engine.KeyClicked(System.Windows.Forms.Keys.Space))
            {
                UpDown.Play(false);
                StartBtn.SetAnimation("start_btn_on");
                if (Game == null)
                {
                    game = new Playing(this.Engine);
                }
                else
                {
                    game = Game;
                }
                Engine.RegisterScene(game);
                Engine.GoToScene(game);
            }

            Engine.Drawer.String("Use Space bar to Stop music", "Arial", 8, System.Drawing.Color.Black, new PointF(20, Engine.ScreenHeight() - 50));
            Engine.Drawer.String("Use Escape to go back to this menu", "Arial", 8, System.Drawing.Color.Black, new PointF(20, Engine.ScreenHeight() - 40));


            Engine.Drawer.String("Powred by CSharpGame | https://github.com/MohKamal/CsharpGame", "Arial", 8, System.Drawing.Color.Black, new PointF(20, Engine.ScreenHeight() - 20));

            return(base.OnUpdate(ElapsedTime));
        }
Exemplo n.º 3
0
 public Menu(Engine engine, Playing game) : base("Main Menu", engine)
 {
     UpDown = new Audio(engine.Ressources("add_1.wav"));
     Game   = game;
 }