Example #1
0
        private void Form1_Load(object sender, EventArgs e)
        {
            //  BackColor = Color.White;
            sLoader = new spriteLoader();
            sLoader.initlize();
            eng = new engine(this, sLoader);
            eng.Set_Center_coords(GAME_CENTER_X, GAME_CENTER_Y);
            eng.createInfinitRoad(0, 340);
            eng.createThePlayer();
            eng.StartBuildingTrees();
            eng.StartDrawing(100);
            eng.GameSpeed   = 70;
            eng.RoadSpeed   = 10;
            button1.Enabled = false;
            Timer x = new Timer()
            {
                Enabled = true, Interval = 1000
            };

            x.Tick += delegate
            {
                Text            = eng.Fps + " fps";
                eng.Fps         = 0;
                button1.Enabled = eng.IsPaused;
            };
        }
Example #2
0
 public engine(Form mainForm, spriteLoader sp)
 {
     mainfrm    = mainForm;
     mainLoader = sp;
     mainAnim   = new animeator();
     trees      = new List <PictureBox>();
     rand       = new Random();
     System.Diagnostics.Debug.WriteLine("[EVENT] new engine class instance created!");
 }