Comment puis-je placer des pièces de monnaie dans le jeu SuperJumper parce qu'à l'heure actuelle les pièces sont tirées au sort, mais je veux dessiner des motifs particuliers comme le cercle, le demi-cercle et la ligne droite. Voici le code que j'ai tellement Extrême-Comment dessiner des pièces dans un chemin avec des motifs dans le jeu superjumeur?
int coinecoord = rand.nextInt(3);
switch(coinecoord)
{
case 0:
if (rand.nextFloat() > 0.5f)
{
Coin coin = new Coin(x1 +1, y + Coin.COIN_HEIGHT + rand.nextFloat() * 3,0);
coins.add(coin);
}
break;
case 1:
if (rand.nextFloat() > 0.5f)
{
Coin coin = new Coin(x1 +6, y + Coin.COIN_HEIGHT + rand.nextFloat() * 3,1);
coins.add(coin);
}
break;
case 2:
if (rand.nextFloat() > 0.5f)
{
Coin coin = new Coin(x1 +rand.nextFloat(), y + Coin.COIN_HEIGHT + rand.nextFloat() * 3,2);
coins.add(coin);
}
break;
}
y += (maxJumpHeight - 0.5f) /3.0f;// add plateform
y -= rand.nextFloat() * (maxJumpHeight/3);
}
tirage dans le monde Renderer classe ---
private void renderItems()
{
int len = world.springs.size();
len = world.coins.size();
for (int i = 0; i < len; i++) {
Coin coin = world.coins.get(i);
TextureRegion keyFrame;
//System.out.println("coin.getMoreCoin()"+coin.getMoreCoin());
switch (coin.getMoreCoin())
{
case 0:
keyFrame = Assets.coinAnim.getKeyFrame(coin.stateTime, Animation.ANIMATION_LOOPING);
batch.draw(keyFrame, coin.position.x - 0.5f, coin.position.y - 0.8f, 1, 1.6f);
break;
case 1:
keyFrame = Assets.coinAnim.getKeyFrame(coin.stateTime, Animation.ANIMATION_LOOPING);
batch.draw(keyFrame, coin.position.x - 0.5f, coin.position.y - 0.8f, 1, 1.6f);
break;
case 2:
keyFrame = Assets.coinAnim.getKeyFrame(coin.stateTime, Animation.ANIMATION_LOOPING);
batch.draw(keyFrame, coin.position.x - 0.5f, coin.position.y - 0.8f, 1, 1.6f);
break;
}
}
}
s'il vous plaît quelqu'un me aider ...