Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- static int[][] g = {{0,-1},{1,0},{1,0},{1,0},{1,0},{0,-1},{0,-1},{0,-1},{0,-1},{0,-1},{0,-1},{1,0},{0,1},{0,1},{0,1},{0,1},{0,1},{0,1},{0,1},{-1,0},{-1,0},{-1,0},{-1,0},{-1,0}};
- public void move(){
- Random rg = new Random();
- int d = rg.nextInt(2);
- if(d == 0){//segue o percurso normal
- setCoordinates(x+g[a][0], y+g[a][1]);
- a++;
- }
- else if(d == 1){//inverte o percurso
- a--;
- setCoordinates(x-g[a][0],y-g[a][1]);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement