- 1
Coin picking
can somebody help me finding a code where without picking all the coins or cubes or whatever you cant load the next level. Thank you
1 Respuesta
+ 1
I'll show it in stages:
Stage 1: Create a few coin models and the main character model. By creating a few classes and methods.
Stage 2: Create a randomizer for x y (and z - optional) and the amount of the coins.
Stage 3: create an If statement so I'd main character is in same x and y (and z - optional) a method called get coin will be runned:
for (Int I = 0; I < coins.amount ; I++)
if (player.x == coin [i].x && player.y == coin [i].y)
getCoin ();
class coins
...
int coinsGot = 0;
public int getCoin () {
coinsGot++;
return coinsGot;
}
if (coinsGot == coins.amount)
nextLevel ();