Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /* Uno Mas: Red Coins */
- /* If we just started the game or died, reset the red coins. */
- if (frameCount == 0 || (player.pos[0] == player.respawnPos[0] && player.pos[1] == player.respawnPos[1] && player.pos[2] == player.respawnPos[2])) {
- player["redCoins"] = 8;
- player["redCoinsCollected"] = [];
- }
- /* Create a new platform if all red coins are collected. */
- if (player["redCoins"] == 0) {
- platform3D(-5, 50, 0, 10, 50, 3, color(0, 255, 0));
- }
- /* As long as the red coin isn't collected, draw it. If we collide with it, count it as collected. */
- var redCoin = function(x, y, z, id) {
- /* if not collected, draw it */
- if ("redCoinsCollected" in player && player["redCoinsCollected"].indexOf(id) != -1) {
- return;
- }
- box3D(x, y, z, 2, 2, 2, color(255, 0, 0));
- if (shadows) shadow(x, y, z, 2, 2);
- 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)) {
- player["redCoinsCollected"].push(id);
- player["redCoins"] -= 1;
- }
- }
- /* Place start platform and red coins. */
- platform3D(-50, -50, 0, 100, 100, 3, color(0, 255, 0));
- redCoin(5, 5, -3, "A");
- redCoin(10, -15, -3, "B");
- redCoin(30, 20, -4, "C");
- redCoin(58, 30, -13, "D");
- redCoin(40, -40, -10, "E");
- redCoin(30, 20, -13, "F");
- redCoin(5, 5, -13, "G");
- redCoin(-30, -30, -10, "H");
- addCheckpoint(0, 10, 0);
- addCheckpoint(0, 100, 0);
Advertisement
Add Comment
Please, Sign In to add comment