Changeset b97a618 in advance-wars for src/com/medievaltech/game/Map.java


Ignore:
Timestamp:
Feb 2, 2011, 4:51:03 PM (14 years ago)
Author:
dportnoy <devnull@…>
Branches:
master
Children:
78d3c6f
Parents:
6a639f7
Message:

Touching a unit now displays its movement area. Touching a square without a unit will stop displaying any previously displayed movement area. THe movement area is now drawn under the unit itself.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/com/medievaltech/game/Map.java

    r6a639f7 rb97a618  
    66public class Map {
    77        private Tile[][] grid;
     8        public Point offset;
    89       
    9         public Map(int width, int height) {
     10        public Map(int width, int height, Point offset) {
    1011                grid = new Tile[width][height];
     12                this.offset = offset;
    1113        }
    1214       
    13         public Map(Tile t, int width, int height) {
     15        public Map(Tile t, int width, int height, Point offset) {
    1416                grid = new Tile[width][height];
     17                this.offset = offset;
    1518               
    1619                for(int x=0; x<getWidth(); x++)
     
    3942        }
    4043       
    41         public void draw(Canvas c, int xStart, int yStart) {
     44        public void draw(Canvas c) {
    4245                for(int x=0; x<getWidth(); x++)
    4346                        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);
    4554        }
    4655}
Note: See TracChangeset for help on using the changeset viewer.