Changeset fea4b77 in advance-wars for src/com/medievaltech/advancewars/GameView.java
- Timestamp:
- Jun 6, 2011, 6:07:43 PM (14 years ago)
- Branches:
- master
- Children:
- 99433bb
- Parents:
- b660017
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/com/medievaltech/advancewars/GameView.java
rb660017 rfea4b77 19 19 class DrawingThread extends Thread { 20 20 public GameState mGameState; 21 22 /* 23 * Member (state) fields 24 */ 25 21 22 //maybe make this private and make an accessor for it 23 public Map mMap; 24 25 public Tile grassTile, oceanTile; 26 27 public Turn mTurn; 28 29 //temporary variable to let the enemy control a specific unit 30 //ownership of units hasn't been implemented yet 31 public Unit enemyUnit; 32 26 33 private int mCanvasHeight = 1; 27 34 private int mCanvasWidth = 1; 28 35 29 /** Paint to draw the lines on screen. */ 30 private Paint mLinePaint, mTextPaint, mButtonPaint, mTilePaint1, mTilePaint2, mSelectionPaint, 31 mUnitPaint; 32 33 //maybe make this private and make an accessor for it 34 public Map mMap; 35 36 public Tile grassTile, oceanTile; 36 private Paint mLinePaint, mTextPaint, mButtonPaint, mTilePaint1, 37 mTilePaint2, mSelectionPaint, mUnitPaint; 37 38 38 39 /** Indicate whether the surface has been created & is ready to draw */ … … 105 106 } 106 107 108 enemyUnit = new Soldier(mUnitPaint); 109 110 mMap.getTile(0, 0).addUnit(enemyUnit); 107 111 mMap.getTile(2, 3).addUnit(new Soldier(mUnitPaint)); 108 112 mMap.getTile(5, 6).addUnit(new Soldier(mUnitPaint)); 113 114 mTurn = Turn.YOUR_TURN; 109 115 110 116 mGameState = GameState.MAIN_MENU; … … 129 135 c = mSurfaceHolder.lockCanvas(null); 130 136 synchronized(mSurfaceHolder) { 137 doLogic(); 131 138 doDraw(c); 132 139 } … … 169 176 Log.i("AdvanceWars", "width: "+mCanvasWidth+", height: "+mCanvasHeight); 170 177 } 178 } 179 180 private void doLogic() { 181 if(mTurn == Turn.YOUR_TURN) 182 return; 183 184 switch(mGameState) { 185 case BATTLE_MAP: 186 int x = thread.enemyUnit.location.x; 187 int y = thread.enemyUnit.location.y; 188 thread.mMap.getTile(x, y).removeUnit(); 189 thread.mMap.getTile(x, y+1).addUnit(thread.enemyUnit); 190 mTurn = Turn.YOUR_TURN; 191 break; 192 } 171 193 } 172 194
Note:
See TracChangeset
for help on using the changeset viewer.