//ワールドマップで、どのエリアを選択しているかを表示する class Select { int position=0; int x, y; /****************************************** position切り替え case 0:中央 case 1:右(東) case 2:下(南) case 3:左(西) case 4:上(北) ******************************************/ void move(int a) { /****************************************** int a は入力されたキーが上下左右のどれかによって値が変わる a切り替え case 1:上 case 2:下 case 3:右 case 4:左 ******************************************/ if (a == 1) { if (position == 0 || position == 1 || position == 3) position = 4; else if (position == 2) position = 0; } else if (a == 2) { if (position == 0 || position == 1 || position == 3) position = 2; else if (position == 4) position = 0; } else if (a == 3) { if (position == 0 || position == 2 || position == 4) position = 1; else if (position == 3) position = 0; } else if (a == 4) { if (position == 0 || position == 2 || position == 4) position = 3; else if (position == 1) position = 0; } } void display() { noFill(); stroke(#ff0000); strokeWeight(10); if (position == 0) { x = width/2; y = height/2; } else if (position == 1) { x = width-80; y = height/2; } else if (position == 2) { x = width/2; y = height-80; } else if (position == 3) { x = 80; y = height/2; } else if (position == 4) { x = width/2; y = 50; } ellipse(x, y, 80, 80); } } class Select_chara { int position=0; int x, y; void move_c(int a) { if (a == 1) { if (position == 2) position = 0; else if (position == 3) position = 1; } else if (a == 2) { if (position == 0) position = 2; else if (position == 1) position = 3; } else if (a == 3) { if (position == 0) position = 1; else if (position == 2) position = 3; } else if (a == 4) { if (position == 1) position = 0; else if (position == 3) position = 2; } } void display_c() { noFill(); stroke(#ff0000); strokeWeight(10); if (position == 0) { x = 0; y = 80; } else if (position == 1) { x = 300; y = 80; } else if (position == 2) { x = 0; y = 340; } else if (position == 3) { x = 300; y = 340; } rect(x, y, 300, 260); } }