import jp.ac.tuis.basic.*; public class Player{ public static void main(String[] args){ //初期化 BasicGraphics g = new BasicGraphics(); int WIDTH=40; int HEIGHT=20; int player_x=WIDTH/2; int player_y=HEIGHT-1; long SLEEP=100; g.locate(player_x,player_y); g.color(g.CYAN); g.print('A'); //アニメーション開始 while(true){ char key = g.inkey(); //プレイヤー移動 if(key != 0){ // 何かキーが押された g.locate(player_x,player_y); g.print((char)0); //前の座標のプレイヤーを消す } if(key == 'j' && player_x > 0){ player_x--; } if(key == 'l' && player_x < WIDTH-2){ player_x++; } if(key == 'i' && player_y > 0){ player_y--; } if(key == 'k' && player_y < HEIGHT-1){ player_y++; } g.locate(player_x,player_y); g.color(g.CYAN); g.print('A'); g.sleep(SLEEP); }//end while(true) }//end main }//end class Player