Пример #1
0
        public MoleShooter()
        {
            InitializeComponent();


            this.SetStyle(
                System.Windows.Forms.ControlStyles.UserPaint |
                System.Windows.Forms.ControlStyles.AllPaintingInWmPaint |
                System.Windows.Forms.ControlStyles.OptimizedDoubleBuffer,
                true);

            _mole = new CMole()
            {
                Left = 300, Top = 450
            };


            _scoreframe = new CScoreFrame()
            {
                Left = 10, Top = 10
            };
            _sign = new CSign()
            {
                Left = 580, Top = 192
            };


            _splat = new CSplat();


            Bitmap b = new Bitmap(Resources.Site);

            this.Cursor = CustomeCursor.CreateCursor(b, b.Height / 2, b.Width / 2);
        }
Пример #2
0
        //The game program is not executed as sequential but by timer
        public MoleShooter()
        {
            //Don't put anything before InitializeComponent().
            InitializeComponent();

            //need this code to make the form update smoothly
            this.SetStyle(
                System.Windows.Forms.ControlStyles.UserPaint |
                System.Windows.Forms.ControlStyles.AllPaintingInWmPaint |
                System.Windows.Forms.ControlStyles.OptimizedDoubleBuffer,
                true);

            //Update the initial position of the mole when the game is loaded
            //_mole position will be changed during the game
            //Outer class ( Mole Shooter) creates the cointained class ( CMole) upon start-up
            //If we did not, the _mole would begin life as a null reference
            _mole = new CMole()
            {
                Left = 300, Top = 450
            };

            //intialize the initial position of _scoreFrame and _sign
            //these positons will be fixed during playing game
            //Outer class ( Mole Shooter) creates the cointained classes (_scoreframe and _sign) upon start-up
            //If we did not, the _scoreframe and _sign would begin life as a null reference
            _scoreframe = new CScoreFrame()
            {
                Left = 10, Top = 10
            };
            _sign = new CSign()
            {
                Left = 580, Top = 192
            };

            //_splat positon will be updated in Hit() method
            //Outer class ( Mole Shooter) creates the contained class ( _splat) upon start-up
            //If we did not, the _splat would begin life as a null reference
            _splat = new CSplat();

            //Create Scope Site
            //the center point is ( b.Height/2, b.Width/2)
            Bitmap b = new Bitmap(Resources.Site);

            this.Cursor = CustomeCursor.CreateCursor(b, b.Height / 2, b.Width / 2);
        }
Пример #3
0
        public MoleShooter()
        {
            InitializeComponent();

            // Create sniper site
            Bitmap b = new Bitmap(Resources.Site);

            this.Cursor = CustomCursor.CreateCursor(b, b.Height / 2, b.Width / 2);

            _scoreFrame = new CScoreFrame()
            {
                Left = 10, Top = 0
            };
            _sign = new CSign {
                Left = 975, Top = 325
            };
            _mole = new CMole()
            {
                Left = 10, Top = 200
            };
            _splat = new CSplat();
        }
Пример #4
0
        public MoleShooter()
        {
            InitializeComponent();
            Bitmap b = new Bitmap(Resources.Site);

            this.Cursor = CustomCursor.CreateCursor(b, b.Height / 2, b.Width / 2);

            _scoreFrame = new CScoreFrame()
            {
                Left = 1, Top = 1
            };
            _sign = new CSign()
            {
                Left = 1180, Top = 180
            };


            _mole = new CMole()
            {
                Left = 550, Top = 550
            };
            _splat = new CSplat();
        }
Пример #5
0
        public MoleShooter()
        {
            InitializeComponent();
            DoubleBuffered = true;

            Bitmap b = new Bitmap(Resources.site);

            this.Cursor = CustomCursor.CreateCursor(b, b.Height / 2, b.Width / 2);

            _scoreFrame = new CScoreFrame()
            {
                Left = 10, Top = 10
            };
            _sign = new CSign()
            {
                Left = 570, Top = 10
            };
            _mole = new CMole()
            {
                Left = 10, Top = 200
            };
            _splat = new CSplat();
        }
Пример #6
0
        public MoleShooter()
        {
            InitializeComponent();

            Bitmap b = new Bitmap(Resources.sight);
            // this.Cursor = CustomCursor.CreateCursor(b, b.Height / 2, b.Width / 2);
            Graphics g   = Graphics.FromImage(b);
            IntPtr   ptr = b.GetHicon();

            Cursor = new System.Windows.Forms.Cursor(ptr);
            _mole  = new CMole()
            {
                Left = 10, Top = 200
            };
            _sign = new CSign()
            {
                Left = 320, Top = 10
            };
            _splat      = new CSplat();
            _scoreFrame = new CScoreFrame()
            {
                Left = 10, Top = 10
            };
        }