qqwref

Uno Mas: Red Coins

Apr 12th, 2020 (edited)
30
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.48 KB | None | 0 0
  1. /* Uno Mas: Red Coins */
  2.  
  3. /* If we just started the game or died, reset the red coins. */
  4. if (frameCount == 0 || (player.pos[0] == player.respawnPos[0] && player.pos[1] == player.respawnPos[1] && player.pos[2] == player.respawnPos[2])) {
  5. player["redCoins"] = 8;
  6. player["redCoinsCollected"] = [];
  7. }
  8.  
  9. /* Create a new platform if all red coins are collected. */
  10. if (player["redCoins"] == 0) {
  11. platform3D(-5, 50, 0, 10, 50, 3, color(0, 255, 0));
  12. }
  13.  
  14. /* As long as the red coin isn't collected, draw it. If we collide with it, count it as collected. */
  15. var redCoin = function(x, y, z, id) {
  16. /* if not collected, draw it */
  17. if ("redCoinsCollected" in player && player["redCoinsCollected"].indexOf(id) != -1) {
  18. return;
  19. }
  20. box3D(x, y, z, 2, 2, 2, color(255, 0, 0));
  21. if (shadows) shadow(x, y, z, 2, 2);
  22. if (isColliding(player.pos[0] - player.size[0], player.pos[1] - player.size[1], player.pos[2] - player.size[2], player.size[0] * 2, player.size[1] * 2, player.size[2] * 2, x, y, z, 2, 2, 2)) {
  23. player["redCoinsCollected"].push(id);
  24. player["redCoins"] -= 1;
  25. }
  26. }
  27.  
  28. /* Place start platform and red coins. */
  29. platform3D(-50, -50, 0, 100, 100, 3, color(0, 255, 0));
  30. redCoin(5, 5, -3, "A");
  31. redCoin(10, -15, -3, "B");
  32. redCoin(30, 20, -4, "C");
  33. redCoin(58, 30, -13, "D");
  34. redCoin(40, -40, -10, "E");
  35. redCoin(30, 20, -13, "F");
  36. redCoin(5, 5, -13, "G");
  37. redCoin(-30, -30, -10, "H");
  38.  
  39. addCheckpoint(0, 10, 0);
  40. addCheckpoint(0, 100, 0);
Advertisement
Add Comment
Please, Sign In to add comment