java - I want to design hurdles like used in jetpack joyride -
how can design hurdle pattern going easy tough magical ride(facebook), jetpack joy ride etc. able design separately want more optimize way this.
for(int i=0;i<5;i++) { for(int j=0;j<i;j++) { system.out.println(j); } }
this give me triangle shape want more complex design there other way it.
well better approch make 2d array
int[][] coinmatrix1 = { { 1, 0, 0, 1, 0, 0 }, { 0, 1, 0, 0, 1, 0 }, { 0, 0, 1, 0, 0, 1 }, { 0, 1, 0, 0, 1, 0 }, { 1, 0, 0, 1, 0, 0 }, { 0, 0, 0, 0, 0, 0 }, }; generatecoinmatrix(coinmatrix1); public void generatecoinmatrix(int[][] coinmatrix2) { (int = 0; < 6; i++) { (int j = 0; j < 6; j++) { if (coinmatrix2[i][j] == 1) { coin = dummycoinscollection.get(countcoinfromdummy); coin.coineffectshow = false; // me coin.position.x = coinsetpos.x + j * (coinsizex); coin.position.y = coinsetpos.y + (5 - i) * (coinsizex); coin.setbounds(coin.position.x, coin.position.y); coinmatrix[i][j] = coin; countcoinfromdummy++; } } } }
this way u can make pattern want.
Comments
Post a Comment