MoveObject.java
上传用户:xueping400
上传日期:2022-02-08
资源大小:888k
文件大小:1k
- import java.awt.Graphics;
- import java.util.HashMap;
- public abstract class MoveObject {
- protected int x;
- protected int y;
- protected int width;
- protected int height;
- public enum DIR {
- UP, DN, LT, RT, LU, LD, RU, RD
- };
- protected static HashMap<DIR, DirStep> hmDir;
- static {
- hmDir = new HashMap<DIR, DirStep>();
- hmDir.put(DIR.LT, new DirStep(-1, 0));
- hmDir.put(DIR.LU, new DirStep(-1, -1));
- hmDir.put(DIR.UP, new DirStep(0, -1));
- hmDir.put(DIR.RU, new DirStep(1, -1));
- hmDir.put(DIR.RT, new DirStep(1, 0));
- hmDir.put(DIR.RD, new DirStep(1, 1));
- hmDir.put(DIR.DN, new DirStep(0, 1));
- hmDir.put(DIR.LD, new DirStep(-1, 1));
- }
- public MoveObject() {
- }
- public abstract void move();
-
- public abstract void paint(Graphics g);
- }