source: advance-wars/src/com/example/advancewars/Tile.java@ 15ddb57

Last change on this file since 15ddb57 was a0f5455, checked in by aluthra <devnull@…>, 14 years ago

Created the game package and started creating actual game objects.

  • Property mode set to 100644
File size: 706 bytes
Line 
1package com.example.advancewars;
2
3import com.example.game.Unit;
4
5import android.graphics.Canvas;
6import android.graphics.Color;
7import android.graphics.Paint;
8import android.graphics.Point;
9
10public class Tile {
11 public enum TerrainType
12 {
13 LAND, SEA
14 }
15
16 TerrainType type;
17 public double moveCoefficent;
18 public Unit currentUnit;
19 public Point point;
20
21 public void addUnit(Unit unit)
22 {
23 currentUnit = unit;
24 }
25
26 public void removeUnit(Unit unit)
27 {
28 if(currentUnit != null)
29 {
30 currentUnit = null;
31 }
32
33 }
34 private Paint p;
35
36 public Tile(Paint p) {
37 this.p = p;
38 }
39
40 public void draw(Canvas c, int x, int y) {
41 c.drawRect(x, y, x+50, y+50, p);
42 }
43}
Note: See TracBrowser for help on using the repository browser.