예제 #1
0
파일: 2048.cs 프로젝트: Epidra/GameCenter
 public override void Draw2()
 {
     spriteBatch.Draw(SK.texture_background_2048, SK.Position_DisplayEdge() + SK.Position_2048(), Color.White);
     for (int y = 0; y < 4; y++)
     {
         for (int x = 0; x < 4; x++)
         {
             if (grid[x, y] != 0)
             {
                 spriteBatch.Draw(SK.texture_spritesheet_2048, new Vector2(SK.Position_DisplayEdge().X + 19 + SK.Position_2048().X + 128 * x + Get_Direction(true, x, y), SK.Position_DisplayEdge().Y + 19 + SK.Position_2048().Y + 128 * y + (Get_Direction(false, x, y))), new Rectangle((128 * Get_Spritesheet(true, grid[x, y])), (128 * Get_Spritesheet(false, grid[x, y])), 128, 128), Color.White, 0.0f, new Vector2(0, 0), 1, SpriteEffects.None, 0.0f);
             }
         }
     }
 }
예제 #2
0
 public override void Draw2()
 {
     spriteBatch.Draw(SK.texture_background_2048, SK.Position_DisplayEdge() + SK.Position_2048(), Color.White);
     for (int y = 0; y < 4; y++)
     {
         for (int x = 0; x < 4; x++)
         {
             if (grid[x, y] == -1)
             {
                 if (active_gameover)
                 {
                     spriteBatch.Draw(SK.texture_spritesheet_2048, new Vector2(SK.Position_DisplayEdge().X + 8 + SK.Position_2048().X + 128 * x, SK.Position_DisplayEdge().Y + 8 + SK.Position_2048().Y + 128 * y), new Rectangle(1 + (65 * Get_Spritesheet(true, grid[x, y])), 1 + (65 * Get_Spritesheet(false, grid[x, y])), 64, 64), Color.White, 0.0f, new Vector2(0, 0), 2, SpriteEffects.None, 0.0f);
                 }
             }
             else
             {
                 spriteBatch.Draw(SK.texture_spritesheet_mysticsquare, new Vector2(SK.Position_DisplayEdge().X + 8 + SK.Position_2048().X + 128 * x + Get_Direction(true, x, y), SK.Position_DisplayEdge().Y + 8 + SK.Position_2048().Y + 128 * y + (Get_Direction(false, x, y))), new Rectangle(1 + (65 * Get_Spritesheet(true, grid[x, y])), 1 + (65 * Get_Spritesheet(false, grid[x, y])), 64, 64), Color.White, 0.0f, new Vector2(0, 0), 2, SpriteEffects.None, 0.0f);
             }
         }
     }
 }
예제 #3
0
 public override void Draw2()
 {
     spriteBatch.Draw(SK.texture_background_2048, SK.Position_DisplayEdge() + SK.Position_2048(), Color.DarkGray);
 }
예제 #4
0
 public override string Update2()
 {
     if (active_timer)
     {
         timer = timer + 16;
         if (timer == 128)
         {
             active_timer = false;
             timer        = 0;
             Change();
             Check();
         }
     }
     else
     {
         direction = "null";
         if (ButtonPressed(GhostKey.button_function_P1) == GhostState.pressed)
         {
             pressed_response = true;
         }
         if (ButtonPressed(GhostKey.button_ok_P1) == GhostState.pressed)
         {
             pressed_response = true;
         }
         if (ButtonPressed(GhostKey.arrow_up_P1) == GhostState.pressed)
         {
             Move("up"); pressed_response = true;
         }
         if (ButtonPressed(GhostKey.arrow_down_P1) == GhostState.pressed)
         {
             Move("down"); pressed_response = true;
         }
         if (ButtonPressed(GhostKey.arrow_left_P1) == GhostState.pressed)
         {
             Move("left"); pressed_response = true;
         }
         if (ButtonPressed(GhostKey.arrow_right_P1) == GhostState.pressed)
         {
             Move("right"); pressed_response = true;
         }
     }
     if (pressed_event_touch)
     {
         for (int y = 0; y < 4; y++)
         {
             for (int x = 0; x < 4; x++)
             {
                 if (Collision_Button(false, new Rectangle((int)(SK.Position_DisplayEdge().X + 8 + SK.Position_2048().X + 128 * x), (int)(SK.Position_DisplayEdge().Y + 8 + SK.Position_2048().Y + 128 * y), 128, 128)))
                 {
                     if (y > 0)
                     {
                         if (grid[x, y - 1] == -1)
                         {
                             Move("up");
                         }
                     }
                     if (y < 3)
                     {
                         if (grid[x, y + 1] == -1)
                         {
                             Move("down");
                         }
                     }
                     if (x > 0)
                     {
                         if (grid[x - 1, y] == -1)
                         {
                             Move("left");
                         }
                     }
                     if (x < 3)
                     {
                         if (grid[x + 1, y] == -1)
                         {
                             Move("right");
                         }
                     }
                 }
             }
         }
     }
     return("void");
 }