Esempio n. 1
0
 public Game(Control Box, Point location, Dragon_image dragon_image,
             Bitmap obstacle_image, int fps = 30)
 {
     builder(Box, location, dragon_image, fps);
     _obstacles_image.Add(obstacle_image);
     _obstacle_image_count = 1;
 }
Esempio n. 2
0
        private void Form1_Load(object sender, EventArgs e)
        {
            Change_timer.Tick    += change_tick;
            Change_timer.Interval = 50;

            Dragon_image dragon_images = new Dragon_image();

            dragon_images.Normal = (Bitmap)Image.FromFile(Application.StartupPath + @"/image/people.png");
            dragon_images.Jump   = (Bitmap)Image.FromFile(Application.StartupPath + @"/image/people_jump.png");

            List <Bitmap> obs = new List <Bitmap>();

            for (int i = 1; i <= 4; i++)
            {
                obs.Add((Bitmap)Image.FromFile(Application.StartupPath + @"/image/obstacle_" + i.ToString() + ".png"));
            }

            G = new Game(this, new Point(10, 50), dragon_images, obs, 60);

            G.Background_image.Image = (Bitmap)Image.FromFile(Application.StartupPath + @"/image/Land.png");

            G.ScoreStandar        = 1000;
            G.DragonDie          += DragonDie;
            G.GameStatusUpdate   += score_update;
            G.ScoreArriveStandar += Faster;
        }
Esempio n. 3
0
 public Game(Control Box, Point location, Dragon_image dragon_image,
             List <Bitmap> obstacle_images, int fps = 30)
 {
     builder(Box, location, dragon_image, fps);
     foreach (Bitmap i in obstacle_images)
     {
         _obstacles_image.Add(i);
     }
     _obstacle_image_count = obstacle_images.Count;
 }
Esempio n. 4
0
        public Dragon(Point location, Size size, Dragon_image images, int fps = 30)
        {
            _fps = fps;
            anime_jump.Interval = Convert.ToInt32(1000 / _fps);
            anime_jump.Tick    += Jump_anime_hander_fun;
            BackColor           = Color.Transparent;
            Location            = location;

            _dragon_image = images;
            Image         = _dragon_image.Normal;

            x    = location.X;
            y    = location.Y;
            Size = size;
            w    = size.Width;
            h    = size.Height;
            Check_struct.Left   = x + w / 5;
            Check_struct.Right  = x + (w * 4) / 5;
            Check_struct.Top    = y;
            Check_struct.Bottom = y + (h * 4) / 5;
            SizeMode            = PictureBoxSizeMode.StretchImage;
        }
Esempio n. 5
0
        private void builder(Control Box, Point location, Dragon_image dragon_image, int fps)
        {
            _box = Box;
            _fps = fps;


            Game_location_x = location.X;
            Game_location_y = location.Y;
            Point dragon_location = new Point(Game_location_x + 50, Game_location_y + 100);

            _dragon = new Dragon(dragon_location, new Size(80, 100), dragon_image);

            _box.Controls.Add(_dragon);

            _box.Controls.Add(Background_image);

            Background_image.Size = new Size(700 + Game_location_x, 250 + Game_location_y);

            Check_Timer.Interval = Convert.ToInt32(1000 / _fps);
            Check_Timer.Tick    += Check;

            Obstacle_Generate_Timer.Tick    += ObstacleGenerate_Tick;
            Obstacle_Generate_Timer.Interval = 500;
        }