Back to project page 2048GameAndroid.
The source code is released under:
Apache License
If you think the Android project 2048GameAndroid listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
package zhengxiao.myapplication.game; // w ww.j a v a2 s. c o m import java.text.MessageFormat; /** * Created by zhengxiao on 12/15/14. */ public class Position { public int x; public int y; public Position(int x, int y) { this.x = x; this.y = y; } public Position(Position that){ this.x = that.x; this.y = that.y; } public void move(Direction direction) { switch (direction) { case UP: y -= 1; case DOWN: y += 1; case LEFT: x -=1; case RIGHT: x += 1; } } @Override public String toString() { return MessageFormat.format("({0},{1})",x,y); } }