2014-01-16 51 views

回答

0

你在背景中使用瓷磚嗎? 我從這個代碼片段: This very useful tutorial

switch(lDirection) { 
       case RIGHT: 
        int RightAnimTiles[] = {WorldActivity.RIGHT_CENTER_TILE - 1, 
          WorldActivity.RIGHT_CENTER_TILE, 
          WorldActivity.RIGHT_CENTER_TILE + 1, 
          WorldActivity.RIGHT_CENTER_TILE}; 
        animate(WorldActivity.WALK_ANIMATE_DURATION, RightAnimTiles, -1); 
        break; 
       case DOWN: 
        int DownAnimTiles[] = {WorldActivity.DOWN_CENTER_TILE - 1, 
          WorldActivity.DOWN_CENTER_TILE, 
          WorldActivity.DOWN_CENTER_TILE + 1, 
          WorldActivity.DOWN_CENTER_TILE}; 
        animate(WorldActivity.WALK_ANIMATE_DURATION, DownAnimTiles, -1); 
        break; 
       case LEFT: 
        int LeftAnimTiles[] = {WorldActivity.LEFT_CENTER_TILE - 1, 
          WorldActivity.LEFT_CENTER_TILE, 
          WorldActivity.LEFT_CENTER_TILE + 1, 
          WorldActivity.LEFT_CENTER_TILE}; 
        animate(WorldActivity.WALK_ANIMATE_DURATION, LeftAnimTiles, -1); 
        break; 
       case UP: 
        int UpAnimTiles[] = {WorldActivity.UP_CENTER_TILE - 1, 
          WorldActivity.UP_CENTER_TILE, 
          WorldActivity.UP_CENTER_TILE + 1, 
          WorldActivity.UP_CENTER_TILE}; 
        animate(WorldActivity.WALK_ANIMATE_DURATION, UpAnimTiles, -1); 
        break; 
      default: 
       break; 

      }