public class BarricadeStar extends Barricade {
private static final float PI2 = (float) (Math.PI*2);
public BarricadeStar(float x, float y, float inR, float outR, BConf conf) {
super(10, conf);
for(int i=0; i<5; i++){
_pt[i*2+0].x = (float) (x + Math.cos(PI2/5*i)*inR);//内側
_pt[i*2+0].y = (float) (y + Math.sin(PI2/5*i)*inR);
_pt[i*2+1].x = (float) (x + Math.cos(PI2/5*i+PI2/10)*outR);//外側
_pt[i*2+1].y = (float) (y + Math.sin(PI2/5*i+PI2/10)*outR);
}
_center.x = x;
_center.y = y;
}
}

public class GameMgr {
private static final float PI = (float) Math.PI;
private ArrayList<Barricade> _barrList = new ArrayList<Barricade>();//障害物リスト
private LinkedList<Task> _taskList = new LinkedList<Task>();// タスクリスト
GameMgr() {
_barrList.add(new BarricadeSquare( 0, 0,480, 20, null));// 画面4隅に四角形を配置
_barrList.add(new BarricadeSquare( 0, 0, 20,800, null));
_barrList.add(new BarricadeSquare(460, 0, 20,800, null));
_barrList.add(new BarricadeSquare( 0,780,480, 20, null));
// _barrList.add(new BarricadeSquare(0, 390, 480, 20, new BConf(+PI / 180)));// 中央に回転するバー(時計回り)
// _barrList.add(new BarricadeSquare(0, 390, 480, 20, new BConf(-PI / 180)));// 中央に回転するバー(反時計回り)
// _barrList.add(new BarricadeTriangle(240, 400, 200, new BConf(+PI / 180)));// 中央に回転する三角形(時計回り)
_barrList.add(new BarricadeStar(240, 400, 80, 220, new BConf(+PI / 180)));// 中央に回転する星(時計回り)
for (Barricade bar : _barrList) {
_taskList.add(bar); //タスクリストに障害物を追加
}
_taskList.add(new Player());
_taskList.add(new FpsController());
}
public boolean onUpdate() {
for (int i = 0; i < _taskList.size(); i++) {
if (_taskList.get(i).onUpdate() == false) { // 更新失敗なら
_taskList.remove(i); // そのタスクを消す
i--;
}
}
return true;
}
public void onDraw(Canvas c) {
c.drawColor(Color.WHITE); // 白で塗りつぶす
for (Task task : _taskList) {
task.onDraw(c);// 描画
}
}
}



Portions of this page are modifications
based on work created and shared by Google and used according to terms
described in the Creative Commons 3.0 Attribution License.
- Remical Soft -