Beispiel #1
0
        // Move the plate
        public void Move(int xOffset, int yOffset)
        {
            ctlBreakout c = Caller as ctlBreakout;
            // X axis
            double newX = Position.x + xOffset;

            Offset.x = xOffset;
            if (newX < 0)
            {
                newX = 0;
            }
            if (newX + this.Size.Width > c.PlayGround.Width)
            {
                newX = c.PlayGround.Width - this.Size.Width;
            }
            // Y axis
            double newY = Position.y + yOffset;

            Offset.y = yOffset;
            if (newY < 400)
            {
                newY = 400;
            }
            if (newY + this.Size.Height > c.PlayGround.Height)
            {
                newY = c.PlayGround.Height - this.Size.Height;
            }

            this.Position.x = newX;
            this.Position.y = newY;
        }
Beispiel #2
0
 public GameControl(ctlBreakout cb)
 {
     CB              = cb;
     GameTimer.Tick += new EventHandler(GameTimer_Tick);
     sndGameOver.Load();
     sndComplete.Load();
     sndHitPlate.Load();
     sndHitWall.Load();
     sndHitBrick.Load();
 }