Last change
on this file since 7f693b4 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
|
Rev | Line | |
---|
[2e798d9] | 1 | package com.example.advancewars;
|
---|
| 2 |
|
---|
[a0f5455] | 3 | import com.example.game.Unit;
|
---|
| 4 |
|
---|
[2e798d9] | 5 | import android.graphics.Canvas;
|
---|
| 6 | import android.graphics.Color;
|
---|
| 7 | import android.graphics.Paint;
|
---|
[a0f5455] | 8 | import android.graphics.Point;
|
---|
[2e798d9] | 9 |
|
---|
| 10 | public class Tile {
|
---|
[a0f5455] | 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 | }
|
---|
[2e798d9] | 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.