Exemplo n.º 1
0
        public override void Update(GameTime gameTime)
        {
            if (Keyboard.GetState().IsKeyDown(Keys.Left))
            {
                x   -= step;
                main = left;
            }
            else if (Keyboard.GetState().IsKeyDown(Keys.Right))
            {
                x   += step;
                main = right;
            }
            else if (Keyboard.GetState().IsKeyDown(Keys.Up))
            {
                y   -= step;
                main = up;
            }
            else if (Keyboard.GetState().IsKeyDown(Keys.Down))
            {
                y   += step;
                main = down;
            }
            main.SetPositionBaseOnPivot(x, y);


            //base.Update(gameTime);
        }
Exemplo n.º 2
0
 public Ship()
 {
     left  = new MyTexture("ShipLeft", 0, 0, 0, 0);
     right = new MyTexture("ShipRight", 0, 0, 0, 0);
     up    = new MyTexture("ShipUp", 0, 0, 0, 0);
     down  = new MyTexture("ShipDown", 0, 0, 0, 0);
     main  = down;
     x     = main.GetWidth() / 2;
     y     = main.GetHeight() / 2;
 }
 private void CreateAllMapFragments()
 {
     MapFragments = new MyTexture[nRows, nCols];
     for (int r = 0; r < nRows; r++)
     {
         for (int c = 0; c < nCols; c++)
         {
             MapFragments[r, c] = new MyTexture(GetTexturesResourceNameFromHeight(HeightData[r, c]),
                                                Left + c * FragmentWidth,
                                                Top + r * FragmentHeight,
                                                FragmentWidth,
                                                FragmentHeight);
         }
     }
 }
Exemplo n.º 4
0
 private void CreateAllMapFragments(string strResourceName, int nRows, int nCols, int Left, int Top, int FragmentWidth, int FragmentHeight)
 {
     MapFragments = new MyTexture[nRows, nCols];
     for (int r = 0; r < nRows; r++)
     {
         for (int c = 0; c < nCols; c++)
         {
             MapFragments[r, c] = new MyTexture(
                 strResourceName + r.ToString("00") + "_" + c.ToString("00"),
                 Left + c * FragmentWidth,
                 Top + r * FragmentHeight,
                 FragmentWidth,
                 FragmentHeight);
         }
     }
 }