Changeset 1a1e8c7 in advance-wars for src/com/medievaltech/game/Unit.java


Ignore:
Timestamp:
Jan 31, 2011, 11:44:53 PM (14 years ago)
Author:
dportnoy <devnull@…>
Branches:
master
Children:
00c432c
Parents:
abe7b3d
Message:

Added a basic draw function to Unit and made some other minor code changes.

File:
1 edited

Legend:

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

    rabe7b3d r1a1e8c7  
    33import java.util.List;
    44
     5import android.graphics.Canvas;
     6import android.graphics.Paint;
    57import android.graphics.Point;
    68
    79public abstract class Unit
    810{
    9         public Unit()
    10         {
    11                
    12         }
    1311        public enum Type
    1412        {
     
    1614        }
    1715
     16        private Paint p;
     17       
    1818        public Type type;
    1919        public Player owner;
     
    3232        public Point location;
    3333       
     34        public Unit(Paint p) {
     35                this.p = p;
     36        }
     37       
    3438        public abstract boolean move(Point point);
    3539        public abstract boolean attack(Point point);
     
    3842        public abstract List<Point> getAttackRange();
    3943       
    40         public  void die()
    41         {
     44        public  void die() {
    4245               
    4346        }
    4447       
    45        
    46        
    47        
    48        
    49        
    50        
    51        
     48        public void draw(Canvas c, int x, int y) {
     49                c.drawCircle(x, y, 20, p);
     50        }
    5251}
Note: See TracChangeset for help on using the changeset viewer.