Changeset b97a618 in advance-wars for src/com/medievaltech/game
- Timestamp:
- Feb 2, 2011, 4:51:03 PM (14 years ago)
- Branches:
- master
- Children:
- 78d3c6f
- Parents:
- 6a639f7
- Location:
- src/com/medievaltech/game
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
src/com/medievaltech/game/Map.java
r6a639f7 rb97a618 6 6 public class Map { 7 7 private Tile[][] grid; 8 public Point offset; 8 9 9 public Map(int width, int height ) {10 public Map(int width, int height, Point offset) { 10 11 grid = new Tile[width][height]; 12 this.offset = offset; 11 13 } 12 14 13 public Map(Tile t, int width, int height ) {15 public Map(Tile t, int width, int height, Point offset) { 14 16 grid = new Tile[width][height]; 17 this.offset = offset; 15 18 16 19 for(int x=0; x<getWidth(); x++) … … 39 42 } 40 43 41 public void draw(Canvas c , int xStart, int yStart) {44 public void draw(Canvas c) { 42 45 for(int x=0; x<getWidth(); x++) 43 46 for(int y=0; y<getHeight(); y++) 44 grid[x][y].draw(c, xStart+50*x, yStart+50*y); 47 grid[x][y].draw(c, offset.x+50*x, offset.y+50*y); 48 } 49 50 public void drawUnits(Canvas c) { 51 for(int x=0; x<getWidth(); x++) 52 for(int y=0; y<getHeight(); y++) 53 grid[x][y].drawUnit(c, offset.x+50*x, offset.y+50*y); 45 54 } 46 55 } -
src/com/medievaltech/game/Tile.java
r6a639f7 rb97a618 43 43 public void draw(Canvas c, int x, int y) { 44 44 c.drawRect(x, y, x+50, y+50, p); 45 45 } 46 47 public void drawUnit(Canvas c, int x, int y) { 46 48 if(currentUnit != null) 47 49 currentUnit.draw(c, x+25, y+25); -
src/com/medievaltech/game/Unit.java
r6a639f7 rb97a618 60 60 visited[p.x-location.x+move-1][p.y-location.y+move] = true; 61 61 } 62 if(p.x< 8&& p.x<location.x+move && !visited[p.x-location.x+move+1][p.y-location.y+move]) {62 if(p.x<5 && p.x<location.x+move && !visited[p.x-location.x+move+1][p.y-location.y+move]) { 63 63 cur.add(new Point(p.x+1, p.y)); 64 64 visited[p.x-location.x+move+1][p.y-location.y+move] = true; … … 68 68 visited[p.x-location.x+move][p.y-location.y+move-1] = true; 69 69 } 70 if(p.y< 6&& p.y<location.y+move && !visited[p.x-location.x+move][p.y-location.y+move+1]) {70 if(p.y<7 && p.y<location.y+move && !visited[p.x-location.x+move][p.y-location.y+move+1]) { 71 71 cur.add(new Point(p.x, p.y+1)); 72 72 visited[p.x-location.x+move][p.y-location.y+move+1] = true;
Note:
See TracChangeset
for help on using the changeset viewer.