Coin picking | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
- 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

27th Jan 2017, 11:49 PM
Visar
1 Answer
+ 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 ();
23rd Mar 2017, 5:58 AM
Eldar Bakerman