How to use initialCount method in wpt

Best JavaScript code snippet using wpt

Data.ts

Source:Data.ts Github

copy

Full Screen

1GreaterThan = {};2data = [3 {4 numberOfLevels: 19,5 startLevel: 06 }7]8menu = [9 {10 world: 'Greater Than',11 worldUnlocked: true,12 easyUnlocked: true,13 mediumUnlocked: true,14 hardUnlocked: false,15 easy: [16 {17 name: 'Range 0 to 10',18 unlocked: true,19 points: 0,20 bronze: true,21 silver: true,22 gold: true,23 },24 {25 name: 'Range 0 to 20',26 unlocked: true,27 points: 0,28 bronze: true,29 silver: true,30 gold: false,31 },32 {33 name: 'Range -10 to 0',34 unlocked: true,35 points: 0,36 bronze: true,37 silver: false,38 gold: false,39 },40 {41 name: 'Range -20 to 0',42 unlocked: true,43 points: 0,44 bronze: false,45 silver: false,46 gold: false,47 },48 {49 name: 'Range -10 to 10',50 unlocked: false,51 points: 0,52 bronze: false,53 silver: false,54 gold: false,55 },56 {57 name: 'Range -20 to 20',58 unlocked: false,59 points: 0,60 bronze: false,61 silver: false,62 gold: false,63 },64 ],65 medium: [66 {67 name: 'Range 0 to 10',68 unlocked: true,69 points: 0,70 bronze: false,71 silver: false,72 gold: false,73 },74 {75 name: 'Range 0 to 20',76 unlocked: true,77 points: 0,78 bronze: false,79 silver: false,80 gold: false,81 },82 {83 name: 'Range -10 to 0',84 unlocked: false,85 points: 0,86 bronze: false,87 silver: false,88 gold: false,89 },90 {91 name: 'Range -20 to 0',92 unlocked: false,93 points: 0,94 bronze: false,95 silver: false,96 gold: false,97 },98 {99 name: 'Range -10 to 10',100 unlocked: false,101 points: 0,102 bronze: false,103 silver: false,104 gold: false,105 },106 {107 name: 'Range -20 to 20',108 unlocked: false,109 points: 0,110 bronze: false,111 silver: false,112 gold: false,113 }114 ],115 hard: [116 {117 name: 'Range 0 to 10 Doubling and Halving',118 unlocked: false,119 points: 0,120 bronze: false,121 silver: false,122 gold: false,123 },124 {125 name: 'Range 0 to 100 Multiply by 10 ',126 unlocked: false,127 points: 0,128 bronze: false,129 silver: false,130 gold: false,131 },132 {133 name: 'Range 0 to 256 Squaring',134 unlocked: false,135 points: 0,136 bronze: false,137 silver: false,138 gold: false,139 }140 ]141 },142 {143 world: 'Less Than',144 worldUnlocked: true,145 easyUnlocked: true,146 mediumUnlocked: false,147 hardUnlocked: false,148 easy: [149 {150 name: 'Range 0 to 10',151 unlocked: true,152 points: 0,153 bronze: true,154 silver: true,155 gold: false,156 },157 {158 name: 'Range 0 to 20',159 unlocked: true,160 points: 0,161 bronze: true,162 silver: false,163 gold: false,164 },165 {166 name: 'Range -10 to 0',167 unlocked: true,168 points: 0,169 bronze: false,170 silver: false,171 gold: false,172 },173 {174 name: 'Range -20 to 0',175 unlocked: false,176 points: 0,177 bronze: false,178 silver: false,179 gold: false,180 },181 {182 name: 'Range -10 to 10',183 unlocked: false,184 points: 0,185 bronze: false,186 silver: false,187 gold: false,188 },189 {190 name: 'Range -20 to 20',191 unlocked: false,192 points: 0,193 bronze: false,194 silver: false,195 gold: false,196 }197 ],198 medium: [199 {200 name: 'Range 0 to 10',201 unlocked: false,202 points: 0,203 bronze: false,204 silver: false,205 gold: false,206 },207 {208 name: 'Range 0 to 20',209 unlocked: false,210 points: 0,211 bronze: false,212 silver: false,213 gold: false,214 },215 {216 name: 'Range -10 to 0',217 unlocked: true,218 points: 0,219 bronze: false,220 silver: false,221 gold: false,222 },223 {224 name: 'Range -20 to 0',225 unlocked: false,226 points: 0,227 bronze: false,228 silver: false,229 gold: false,230 },231 {232 name: 'Range -10 to 10',233 unlocked: true,234 points: 0,235 bronze: false,236 silver: false,237 gold: false,238 },239 {240 name: 'Range -20 to 20',241 unlocked: false,242 points: 0,243 bronze: false,244 silver: false,245 gold: false,246 }247 ],248 hard: [249 {250 name: 'Range 0 to 10 Doubling and Halving',251 unlocked: false,252 points: 0,253 bronze: false,254 silver: false,255 gold: false,256 },257 {258 name: 'Range 0 to 100 Multiply by 10 ',259 unlocked: false,260 points: 0,261 bronze: false,262 silver: false,263 gold: false,264 },265 {266 name: 'Range 0 to 256 Squaring',267 unlocked: true,268 points: 0,269 bronze: false,270 silver: false,271 gold: false,272 }273 ]274 },275 {276 world: 'Greater Than and Less Than',277 worldUnlocked: false,278 easyUnlocked: false,279 mediumUnlocked: false,280 hardUnlocked: false,281 easy: [282 {283 name: 'Range 0 to 10',284 unlocked: true,285 points: 0,286 bronze: false,287 silver: false,288 gold: false,289 },290 {291 name: 'Range 0 to 20',292 unlocked: false,293 points: 0,294 bronze: false,295 silver: false,296 gold: false,297 },298 {299 name: 'Range -10 to 0',300 unlocked: true,301 points: 0,302 bronze: false,303 silver: false,304 gold: false,305 },306 {307 name: 'Range -20 to 0',308 unlocked: false,309 points: 0,310 bronze: false,311 silver: false,312 gold: false,313 },314 {315 name: 'Range -10 to 10',316 unlocked: true,317 points: 0,318 bronze: false,319 silver: false,320 gold: false,321 },322 {323 name: 'Range -20 to 20',324 unlocked: false,325 points: 0,326 bronze: false,327 silver: false,328 gold: false,329 }330 ],331 medium: [332 {333 name: 'Range 0 to 10',334 unlocked: false,335 points: 0,336 bronze: false,337 silver: false,338 gold: false,339 },340 {341 name: 'Range 0 to 20',342 unlocked: false,343 points: 0,344 bronze: false,345 silver: false,346 gold: false,347 },348 {349 name: 'Range -10 to 0',350 unlocked: true,351 points: 0,352 bronze: false,353 silver: false,354 gold: false,355 },356 {357 name: 'Range -20 to 0',358 unlocked: false,359 points: 0,360 bronze: false,361 silver: false,362 gold: false,363 },364 {365 name: 'Range -10 to 10',366 unlocked: true,367 points: 0,368 bronze: false,369 silver: false,370 gold: false,371 },372 {373 name: 'Range -20 to 20',374 unlocked: false,375 points: 0,376 bronze: false,377 silver: false,378 gold: false,379 }380 ],381 hard: [382 {383 name: 'Range 0 to 10 Doubling and Halving',384 unlocked: false,385 points: 0,386 bronze: false,387 silver: false,388 gold: false,389 },390 {391 name: 'Range 0 to 100 Multiply by 10 ',392 unlocked: false,393 points: 0,394 bronze: false,395 silver: false,396 gold: false,397 },398 {399 name: 'Range 0 to 256 Squaring',400 unlocked: true,401 points: 0,402 bronze: false,403 silver: false,404 gold: false,405 }406 ],407 },408]409levels = [410 {411 levelName: 'F R1-1 L0',412 startValue: 10,413 endValue: 10,414 playerMaxValue: 10,415 playerMinValue: 0,416 worldSizeX: 2500,417 worldSizeY: 2500,418 nextLevelGold: 3, 419 nextLevelSilver: 2,420 nextLevelBronze: 1,421 sharks: [422 {423 value: 0,424 initialCount: 2,425 },426 {427 value: 1,428 initialCount: 2,429 },430 {431 value: 2,432 initialCount: 2,433 },434 {435 value: 3,436 initialCount: 2,437 },438 {439 value: 4,440 initialCount: 2,441 },442 {443 value: 5,444 initialCount: 2,445 },446 {447 value: 6,448 initialCount: 2,449 },450 {451 value: 7,452 initialCount: 2,453 },454 {455 value: 8,456 initialCount: 2,457 },458 {459 value: 9,460 initialCount: 2,461 },462 {463 value: 10,464 initialCount: 2,465 }466 ],467 },468 {469 levelName: 'F R1-2 L1',470 startValue: 9,471 endValue: 9,472 playerMaxValue: 10,473 playerMinValue: 0,474 worldSizeX: 2500,475 worldSizeY: 2500,476 nextLevelGold: 4,477 nextLevelSilver: 2,478 nextLevelBronze: 2,479 sharks: [480 {481 value: 0,482 initialCount: 2,483 },484 {485 value: 1,486 initialCount: 2,487 },488 {489 value: 2,490 initialCount: 2,491 },492 {493 value: 3,494 initialCount: 2,495 },496 {497 value: 4,498 initialCount: 2,499 },500 {501 value: 5,502 initialCount: 2,503 },504 {505 value: 6,506 initialCount: 2,507 },508 {509 value: 7,510 initialCount: 2,511 },512 {513 value: 8,514 initialCount: 2,515 },516 {517 value: 9,518 initialCount: 2,519 },520 {521 value: 10,522 initialCount: 2,523 }524 ],525 },526 {527 levelName: 'F R1-3 L2',528 startValue: 8,529 endValue: 8,530 playerMaxValue: 10,531 playerMinValue: 0,532 worldSizeX: 2500,533 worldSizeY: 2500,534 nextLevelGold: 4,535 nextLevelSilver: 4,536 nextLevelBronze: 3,537 sharks: [538 {539 value: 0,540 initialCount: 2,541 },542 {543 value: 1,544 initialCount: 2,545 },546 {547 value: 2,548 initialCount: 2,549 },550 {551 value: 3,552 initialCount: 2,553 },554 {555 value: 4,556 initialCount: 2,557 },558 {559 value: 5,560 initialCount: 2,561 },562 {563 value: 6,564 initialCount: 2,565 },566 {567 value: 7,568 initialCount: 2,569 },570 {571 value: 8,572 initialCount: 2,573 },574 {575 value: 9,576 initialCount: 2,577 },578 {579 value: 10,580 initialCount: 2,581 }582 ],583 },584 {585 levelName: 'F R1-4 L3',586 startValue: 7,587 endValue: 7,588 playerMaxValue: 10,589 playerMinValue: 0,590 worldSizeX: 2500,591 worldSizeY: 2500,592 nextLevelGold: 4,593 nextLevelSilver: 4,594 nextLevelBronze: 4,595 sharks: [596 {597 value: 0,598 initialCount: 1,599 },600 {601 value: 1,602 initialCount: 1,603 },604 {605 value: 2,606 initialCount: 2,607 },608 {609 value: 3,610 initialCount: 2,611 },612 {613 value: 4,614 initialCount: 2,615 },616 {617 value: 5,618 initialCount: 2,619 },620 {621 value: 6,622 initialCount: 2,623 },624 {625 value: 7,626 initialCount: 2,627 },628 {629 value: 8,630 initialCount: 2,631 },632 {633 value: 9,634 initialCount: 3,635 },636 {637 value: 10,638 initialCount: 3,639 }640 ],641 },642 {643 levelName: 'F R1-5 L4',644 startValue: 6,645 endValue: 6,646 playerMaxValue: 10,647 playerMinValue: 0,648 worldSizeX: 2500,649 worldSizeY: 2500,650 nextLevelGold: 7,651 nextLevelSilver: 5,652 nextLevelBronze: 5,653 sharks: [654 {655 value: 0,656 initialCount: 1,657 },658 {659 value: 1,660 initialCount: 1,661 },662 {663 value: 2,664 initialCount: 2,665 },666 {667 value: 3,668 initialCount: 2,669 },670 {671 value: 4,672 initialCount: 2,673 },674 {675 value: 5,676 initialCount: 3,677 },678 {679 value: 6,680 initialCount: 3,681 },682 {683 value: 7,684 initialCount: 3,685 },686 {687 value: 8,688 initialCount: 2,689 },690 {691 value: 9,692 initialCount: 2,693 },694 {695 value: 10,696 initialCount: 1,697 }698 ],699 },700 {701 levelName: 'F R1-6 L5',702 startValue: 5,703 endValue: 5,704 playerMaxValue: 10,705 playerMinValue: 0,706 worldSizeX: 2500,707 worldSizeY: 2500,708 nextLevelGold: 7,709 nextLevelSilver: 7,710 nextLevelBronze: 6,711 sharks: [712 {713 value: 0,714 initialCount: 1,715 },716 {717 value: 1,718 initialCount: 1,719 },720 {721 value: 2,722 initialCount: 2,723 },724 {725 value: 3,726 initialCount: 2,727 },728 {729 value: 4,730 initialCount: 3,731 },732 {733 value: 5,734 initialCount: 3,735 },736 {737 value: 6,738 initialCount: 3,739 },740 {741 value: 7,742 initialCount: 2,743 },744 {745 value: 8,746 initialCount: 2,747 },748 {749 value: 9,750 initialCount: 1,751 },752 {753 value: 10,754 initialCount: 1,755 }756 ],757 },758 {759 levelName: 'F R1-7 L6',760 startValue: 4,761 endValue: 4,762 playerMaxValue: 10,763 playerMinValue: 0,764 worldSizeX: 2500,765 worldSizeY: 2500,766 nextLevelGold: 7,767 nextLevelSilver: 7,768 nextLevelBronze: 7,769 sharks: [770 {771 value: 0,772 initialCount: 1,773 },774 {775 value: 1,776 initialCount: 2,777 },778 {779 value: 2,780 initialCount: 2,781 },782 {783 value: 3,784 initialCount: 3,785 },786 {787 value: 4,788 initialCount: 3,789 },790 {791 value: 5,792 initialCount: 3,793 },794 {795 value: 6,796 initialCount: 2,797 },798 {799 value: 7,800 initialCount: 2,801 },802 {803 value: 8,804 initialCount: 1,805 },806 {807 value: 9,808 initialCount: 1,809 },810 {811 value: 10,812 initialCount: 1,813 }814 ],815 },816 {817 levelName: 'F R1-8 L7',818 startValue: 3,819 endValue: 3,820 playerMaxValue: 10,821 playerMinValue: 0,822 worldSizeX: 2500,823 worldSizeY: 2500,824 nextLevelGold: 8,825 nextLevelSilver: 8,826 nextLevelBronze: 8,827 sharks: [828 {829 value: 0,830 initialCount: 2,831 },832 {833 value: 1,834 initialCount: 2,835 },836 {837 value: 2,838 initialCount: 3,839 },840 {841 value: 3,842 initialCount: 3,843 },844 {845 value: 4,846 initialCount: 3,847 },848 {849 value: 5,850 initialCount: 2,851 },852 {853 value: 6,854 initialCount: 2,855 },856 {857 value: 7,858 initialCount: 1,859 },860 {861 value: 8,862 initialCount: 1,863 },864 {865 value: 9,866 initialCount: 1,867 },868 {869 value: 10,870 initialCount: 1,871 }872 ],873 },874 {875 levelName: 'F R2-1 L8',876 startValue: 20,877 endValue: 20,878 playerMaxValue: 20,879 playerMinValue: 0,880 worldSizeX: 2500,881 worldSizeY: 2500,882 nextLevelGold: 9,883 nextLevelSilver: 8,884 nextLevelBronze: 8,885 sharks: [886 {887 value: 0,888 initialCount: 1,889 },890 {891 value: 1,892 initialCount: 1,893 },894 {895 value: 2,896 initialCount: 1,897 },898 {899 value: 3,900 initialCount: 1,901 },902 {903 value: 4,904 initialCount: 1,905 },906 {907 value: 5,908 initialCount: 1,909 },910 {911 value: 6,912 initialCount: 1,913 },914 {915 value: 7,916 initialCount: 1,917 },918 {919 value: 8,920 initialCount: 1,921 },922 {923 value: 9,924 initialCount: 1,925 },926 {927 value: 10,928 initialCount: 1,929 },930 {931 value: 11,932 initialCount: 1,933 },934 {935 value: 12,936 initialCount: 1,937 },938 {939 value: 13,940 initialCount: 1,941 },942 {943 value: 14,944 initialCount: 1,945 },946 {947 value: 15,948 initialCount: 1,949 },950 {951 value: 16,952 initialCount: 1,953 },954 {955 value: 17,956 initialCount: 1,957 },958 {959 value: 18,960 initialCount: 1,961 },962 {963 value: 19,964 initialCount: 1,965 },966 {967 value: 20,968 initialCount: 1,969 }970 ],971 },972 {973 levelName: 'F R2-2 L9',974 startValue: 18,975 endValue: 18,976 playerMaxValue: 20,977 playerMinValue: 0,978 worldSizeX: 2500,979 worldSizeY: 2500,980 nextLevelGold: 10,981 nextLevelSilver: 10,982 nextLevelBronze: 10,983 sharks: [984 {985 value: 0,986 initialCount: 1,987 },988 {989 value: 1,990 initialCount: 1,991 },992 {993 value: 2,994 initialCount: 1,995 },996 {997 value: 3,998 initialCount: 1,999 },1000 {1001 value: 4,1002 initialCount: 1,1003 },1004 {1005 value: 5,1006 initialCount: 1,1007 },1008 {1009 value: 6,1010 initialCount: 1,1011 },1012 {1013 value: 7,1014 initialCount: 1,1015 },1016 {1017 value: 8,1018 initialCount: 1,1019 },1020 {1021 value: 9,1022 initialCount: 1,1023 },1024 {1025 value: 10,1026 initialCount: 1,1027 },1028 {1029 value: 11,1030 initialCount: 1,1031 },1032 {1033 value: 12,1034 initialCount: 1,1035 },1036 {1037 value: 13,1038 initialCount: 1,1039 },1040 {1041 value: 14,1042 initialCount: 1,1043 },1044 {1045 value: 15,1046 initialCount: 1,1047 },1048 {1049 value: 16,1050 initialCount: 1,1051 },1052 {1053 value: 17,1054 initialCount: 1,1055 },1056 {1057 value: 18,1058 initialCount: 1,1059 },1060 {1061 value: 19,1062 initialCount: 1,1063 },1064 {1065 value: 20,1066 initialCount: 1,1067 }1068 ],1069 },1070 {1071 levelName: 'F R2-3 L10',1072 startValue: 17,1073 endValue: 17,1074 playerMaxValue: 20,1075 playerMinValue: 0,1076 worldSizeX: 2500,1077 worldSizeY: 2500,1078 nextLevelGold: 13,1079 nextLevelSilver: 11,1080 nextLevelBronze: 11,1081 sharks: [1082 {1083 value: 0,1084 initialCount: 1,1085 },1086 {1087 value: 1,1088 initialCount: 1,1089 },1090 {1091 value: 2,1092 initialCount: 1,1093 },1094 {1095 value: 3,1096 initialCount: 1,1097 },1098 {1099 value: 4,1100 initialCount: 1,1101 },1102 {1103 value: 5,1104 initialCount: 1,1105 },1106 {1107 value: 6,1108 initialCount: 1,1109 },1110 {1111 value: 7,1112 initialCount: 1,1113 },1114 {1115 value: 8,1116 initialCount: 1,1117 },1118 {1119 value: 9,1120 initialCount: 1,1121 },1122 {1123 value: 10,1124 initialCount: 1,1125 },1126 {1127 value: 11,1128 initialCount: 1,1129 },1130 {1131 value: 12,1132 initialCount: 1,1133 },1134 {1135 value: 13,1136 initialCount: 1,1137 },1138 {1139 value: 14,1140 initialCount: 1,1141 },1142 {1143 value: 15,1144 initialCount: 1,1145 },1146 {1147 value: 16,1148 initialCount: 1,1149 },1150 {1151 value: 17,1152 initialCount: 1,1153 },1154 {1155 value: 18,1156 initialCount: 1,1157 },1158 {1159 value: 19,1160 initialCount: 1,1161 },1162 {1163 value: 20,1164 initialCount: 1,1165 }1166 ],1167 },1168 {1169 levelName: 'F R2-4 L11',1170 startValue: 15,1171 endValue: 15,1172 playerMaxValue: 20,1173 playerMinValue: 0,1174 worldSizeX: 2500,1175 worldSizeY: 2500,1176 nextLevelGold: 13,1177 nextLevelSilver: 13,1178 nextLevelBronze: 12,1179 sharks: [1180 {1181 value: 0,1182 initialCount: 1,1183 },1184 {1185 value: 1,1186 initialCount: 1,1187 },1188 {1189 value: 2,1190 initialCount: 1,1191 },1192 {1193 value: 3,1194 initialCount: 1,1195 },1196 {1197 value: 4,1198 initialCount: 1,1199 },1200 {1201 value: 5,1202 initialCount: 1,1203 },1204 {1205 value: 6,1206 initialCount: 1,1207 },1208 {1209 value: 7,1210 initialCount: 1,1211 },1212 {1213 value: 8,1214 initialCount: 1,1215 },1216 {1217 value: 9,1218 initialCount: 1,1219 },1220 {1221 value: 10,1222 initialCount: 1,1223 },1224 {1225 value: 11,1226 initialCount: 1,1227 },1228 {1229 value: 12,1230 initialCount: 1,1231 },1232 {1233 value: 13,1234 initialCount: 1,1235 },1236 {1237 value: 14,1238 initialCount: 1,1239 },1240 {1241 value: 15,1242 initialCount: 1,1243 },1244 {1245 value: 16,1246 initialCount: 1,1247 },1248 {1249 value: 17,1250 initialCount: 1,1251 },1252 {1253 value: 18,1254 initialCount: 1,1255 },1256 {1257 value: 19,1258 initialCount: 1,1259 },1260 {1261 value: 20,1262 initialCount: 1,1263 }1264 ],1265 },1266 {1267 levelName: 'F R2-5 L12',1268 startValue: 14,1269 endValue: 14,1270 playerMaxValue: 20,1271 playerMinValue: 0,1272 worldSizeX: 2500,1273 worldSizeY: 2500,1274 nextLevelGold: 13,1275 nextLevelSilver: 13,1276 nextLevelBronze: 13,1277 sharks: [1278 {1279 value: 0,1280 initialCount: 1,1281 },1282 {1283 value: 1,1284 initialCount: 1,1285 },1286 {1287 value: 2,1288 initialCount: 1,1289 },1290 {1291 value: 3,1292 initialCount: 1,1293 },1294 {1295 value: 4,1296 initialCount: 1,1297 },1298 {1299 value: 5,1300 initialCount: 1,1301 },1302 {1303 value: 6,1304 initialCount: 1,1305 },1306 {1307 value: 7,1308 initialCount: 1,1309 },1310 {1311 value: 8,1312 initialCount: 1,1313 },1314 {1315 value: 9,1316 initialCount: 1,1317 },1318 {1319 value: 10,1320 initialCount: 1,1321 },1322 {1323 value: 11,1324 initialCount: 1,1325 },1326 {1327 value: 12,1328 initialCount: 1,1329 },1330 {1331 value: 13,1332 initialCount: 1,1333 },1334 {1335 value: 14,1336 initialCount: 1,1337 },1338 {1339 value: 15,1340 initialCount: 1,1341 },1342 {1343 value: 16,1344 initialCount: 1,1345 },1346 {1347 value: 17,1348 initialCount: 1,1349 },1350 {1351 value: 18,1352 initialCount: 1,1353 },1354 {1355 value: 19,1356 initialCount: 1,1357 },1358 {1359 value: 20,1360 initialCount: 1,1361 }1362 ],1363 },1364 {1365 levelName: 'F R2-6 L13',1366 startValue: 13,1367 endValue: 13,1368 playerMaxValue: 20,1369 playerMinValue: 0,1370 worldSizeX: 2500,1371 worldSizeY: 2500,1372 nextLevelGold: 17,1373 nextLevelSilver: 14,1374 nextLevelBronze: 14,1375 sharks: [1376 {1377 value: 0,1378 initialCount: 1,1379 },1380 {1381 value: 1,1382 initialCount: 1,1383 },1384 {1385 value: 2,1386 initialCount: 1,1387 },1388 {1389 value: 3,1390 initialCount: 1,1391 },1392 {1393 value: 4,1394 initialCount: 1,1395 },1396 {1397 value: 5,1398 initialCount: 1,1399 },1400 {1401 value: 6,1402 initialCount: 1,1403 },1404 {1405 value: 7,1406 initialCount: 1,1407 },1408 {1409 value: 8,1410 initialCount: 1,1411 },1412 {1413 value: 9,1414 initialCount: 1,1415 },1416 {1417 value: 10,1418 initialCount: 1,1419 },1420 {1421 value: 11,1422 initialCount: 1,1423 },1424 {1425 value: 12,1426 initialCount: 1,1427 },1428 {1429 value: 13,1430 initialCount: 1,1431 },1432 {1433 value: 14,1434 initialCount: 1,1435 },1436 {1437 value: 15,1438 initialCount: 1,1439 },1440 {1441 value: 16,1442 initialCount: 1,1443 },1444 {1445 value: 17,1446 initialCount: 1,1447 },1448 {1449 value: 18,1450 initialCount: 1,1451 },1452 {1453 value: 19,1454 initialCount: 1,1455 },1456 {1457 value: 20,1458 initialCount: 1,1459 }1460 ],1461 },1462 {1463 levelName: 'F R2-7 L14',1464 startValue: 12,1465 endValue: 12,1466 playerMaxValue: 20,1467 playerMinValue: 0,1468 worldSizeX: 2500,1469 worldSizeY: 2500,1470 nextLevelGold: 17,1471 nextLevelSilver: 16,1472 nextLevelBronze: 15,1473 sharks: [1474 {1475 value: 0,1476 initialCount: 1,1477 },1478 {1479 value: 1,1480 initialCount: 1,1481 },1482 {1483 value: 2,1484 initialCount: 1,1485 },1486 {1487 value: 3,1488 initialCount: 1,1489 },1490 {1491 value: 4,1492 initialCount: 1,1493 },1494 {1495 value: 5,1496 initialCount: 1,1497 },1498 {1499 value: 6,1500 initialCount: 1,1501 },1502 {1503 value: 7,1504 initialCount: 1,1505 },1506 {1507 value: 8,1508 initialCount: 1,1509 },1510 {1511 value: 9,1512 initialCount: 1,1513 },1514 {1515 value: 10,1516 initialCount: 1,1517 },1518 {1519 value: 11,1520 initialCount: 1,1521 },1522 {1523 value: 12,1524 initialCount: 1,1525 },1526 {1527 value: 13,1528 initialCount: 1,1529 },1530 {1531 value: 14,1532 initialCount: 1,1533 },1534 {1535 value: 15,1536 initialCount: 1,1537 },1538 {1539 value: 16,1540 initialCount: 1,1541 },1542 {1543 value: 17,1544 initialCount: 1,1545 },1546 {1547 value: 18,1548 initialCount: 1,1549 },1550 {1551 value: 19,1552 initialCount: 1,1553 },1554 {1555 value: 20,1556 initialCount: 1,1557 }1558 ],1559 },1560 {1561 levelName: 'F R2-8 L15',1562 startValue: 11,1563 endValue: 11,1564 playerMaxValue: 20,1565 playerMinValue: 0,1566 worldSizeX: 2500,1567 worldSizeY: 2500,1568 nextLevelGold: 17,1569 nextLevelSilver: 16,1570 nextLevelBronze: 16,1571 sharks: [1572 {1573 value: 0,1574 initialCount: 1,1575 },1576 {1577 value: 1,1578 initialCount: 1,1579 },1580 {1581 value: 2,1582 initialCount: 1,1583 },1584 {1585 value: 3,1586 initialCount: 1,1587 },1588 {1589 value: 4,1590 initialCount: 1,1591 },1592 {1593 value: 5,1594 initialCount: 1,1595 },1596 {1597 value: 6,1598 initialCount: 1,1599 },1600 {1601 value: 7,1602 initialCount: 1,1603 },1604 {1605 value: 8,1606 initialCount: 1,1607 },1608 {1609 value: 9,1610 initialCount: 1,1611 },1612 {1613 value: 10,1614 initialCount: 1,1615 },1616 {1617 value: 11,1618 initialCount: 1,1619 },1620 {1621 value: 12,1622 initialCount: 1,1623 },1624 {1625 value: 13,1626 initialCount: 1,1627 },1628 {1629 value: 14,1630 initialCount: 1,1631 },1632 {1633 value: 15,1634 initialCount: 1,1635 },1636 {1637 value: 16,1638 initialCount: 1,1639 },1640 {1641 value: 17,1642 initialCount: 1,1643 },1644 {1645 value: 18,1646 initialCount: 1,1647 },1648 {1649 value: 19,1650 initialCount: 1,1651 },1652 {1653 value: 20,1654 initialCount: 1,1655 }1656 ],1657 },1658 {1659 levelName: 'F R2-9 L16',1660 startValue: 10,1661 endValue: 10,1662 playerMaxValue: 20,1663 playerMinValue: 0,1664 worldSizeX: 2500,1665 worldSizeY: 2500,1666 nextLevelGold: 17,1667 nextLevelSilver: 17,1668 nextLevelBronze: 17,1669 sharks: [1670 {1671 value: 0,1672 initialCount: 1,1673 },1674 {1675 value: 1,1676 initialCount: 1,1677 },1678 {1679 value: 2,1680 initialCount: 1,1681 },1682 {1683 value: 3,1684 initialCount: 1,1685 },1686 {1687 value: 4,1688 initialCount: 1,1689 },1690 {1691 value: 5,1692 initialCount: 1,1693 },1694 {1695 value: 6,1696 initialCount: 1,1697 },1698 {1699 value: 7,1700 initialCount: 1,1701 },1702 {1703 value: 8,1704 initialCount: 1,1705 },1706 {1707 value: 9,1708 initialCount: 1,1709 },1710 {1711 value: 10,1712 initialCount: 1,1713 },1714 {1715 value: 11,1716 initialCount: 1,1717 },1718 {1719 value: 12,1720 initialCount: 1,1721 },1722 {1723 value: 13,1724 initialCount: 1,1725 },1726 {1727 value: 14,1728 initialCount: 1,1729 },1730 {1731 value: 15,1732 initialCount: 1,1733 },1734 {1735 value: 16,1736 initialCount: 1,1737 },1738 {1739 value: 17,1740 initialCount: 1,1741 },1742 {1743 value: 18,1744 initialCount: 1,1745 },1746 {1747 value: 19,1748 initialCount: 1,1749 },1750 {1751 value: 20,1752 initialCount: 1,1753 }1754 ],1755 },1756 {1757 levelName: 'F R2-10 L17',1758 startValue: 9,1759 endValue: 9,1760 playerMaxValue: 20,1761 playerMinValue: 0,1762 worldSizeX: 2500,1763 worldSizeY: 2500,1764 nextLevelGold: 19,1765 nextLevelSilver: 18,1766 nextLevelBronze: 18,1767 sharks: [1768 {1769 value: 0,1770 initialCount: 1,1771 },1772 {1773 value: 1,1774 initialCount: 1,1775 },1776 {1777 value: 2,1778 initialCount: 1,1779 },1780 {1781 value: 3,1782 initialCount: 1,1783 },1784 {1785 value: 4,1786 initialCount: 1,1787 },1788 {1789 value: 5,1790 initialCount: 1,1791 },1792 {1793 value: 6,1794 initialCount: 1,1795 },1796 {1797 value: 7,1798 initialCount: 1,1799 },1800 {1801 value: 8,1802 initialCount: 1,1803 },1804 {1805 value: 9,1806 initialCount: 1,1807 },1808 {1809 value: 10,1810 initialCount: 1,1811 },1812 {1813 value: 11,1814 initialCount: 1,1815 },1816 {1817 value: 12,1818 initialCount: 1,1819 },1820 {1821 value: 13,1822 initialCount: 1,1823 },1824 {1825 value: 14,1826 initialCount: 1,1827 },1828 {1829 value: 15,1830 initialCount: 1,1831 },1832 {1833 value: 16,1834 initialCount: 1,1835 },1836 {1837 value: 17,1838 initialCount: 1,1839 },1840 {1841 value: 18,1842 initialCount: 1,1843 },1844 {1845 value: 19,1846 initialCount: 1,1847 },1848 {1849 value: 20,1850 initialCount: 1,1851 }1852 ],1853 },1854 {1855 levelName: 'Fish: 9',1856 startValue: 20,1857 endValue: 20,1858 playerMaxValue: 20,1859 playerMinValue: 0,1860 worldSizeX: 2500,1861 worldSizeY: 2500,1862 nextLevelGold: 10,1863 nextLevelSilver: 9,1864 nextLevelBronze: 9,1865 sharks: [1866 {1867 value: 0,1868 initialCount: 1,1869 },1870 {1871 value: 1,1872 initialCount: 1,1873 },1874 {1875 value: 2,1876 initialCount: 1,1877 },1878 {1879 value: 3,1880 initialCount: 1,1881 },1882 {1883 value: 4,1884 initialCount: 1,1885 },1886 {1887 value: 5,1888 initialCount: 1,1889 },1890 {1891 value: 6,1892 initialCount: 1,1893 },1894 {1895 value: 7,1896 initialCount: 1,1897 },1898 {1899 value: 8,1900 initialCount: 1,1901 },1902 {1903 value: 9,1904 initialCount: 1,1905 },1906 {1907 value: 10,1908 initialCount: 1,1909 },1910 {1911 value: 11,1912 initialCount: 1,1913 },1914 {1915 value: 12,1916 initialCount: 1,1917 },1918 {1919 value: 13,1920 initialCount: 1,1921 },1922 {1923 value: 14,1924 initialCount: 1,1925 },1926 {1927 value: 15,1928 initialCount: 1,1929 },1930 {1931 value: 16,1932 initialCount: 1,1933 },1934 {1935 value: 17,1936 initialCount: 1,1937 },1938 {1939 value: 18,1940 initialCount: 1,1941 },1942 {1943 value: 19,1944 initialCount: 1,1945 },1946 {1947 value: 20,1948 initialCount: 1,1949 }1950 ],1951 },1952 {1953 levelName: 'Level 1',1954 startValue: 1,1955 endValue: 10,1956 playerMaxValue: 10,1957 playerMinValue: 0,1958 worldSizeX: 2500,1959 worldSizeY: 2500,1960 sharks: [1961 {1962 value: 1,1963 initialCount: 2,1964 },1965 {1966 value: 2,1967 initialCount: 10,1968 },1969 {1970 value: 5,1971 initialCount: 51972 },1973 {1974 value: 7,1975 initialCount: 51976 },1977 {1978 value: 10,1979 initialCount: 51980 }1981 ],1982 eats: [1983 {1984 value: 1,1985 text: '+1',1986 initialCount: 101987 },1988 ]1989 },1990 {1991 levelName: 'Level 2',1992 startValue: 50,1993 endValue: 10,1994 playerMaxValue: 50,1995 playerMinValue: 10,1996 worldSizeX: 2500,1997 worldSizeY: 2500,1998 sharks: [1999 {2000 value: 0,2001 initialCount: 2,2002 },2003 {2004 value: 1,2005 initialCount: 2,2006 },2007 {2008 value: 4,2009 initialCount: 2,2010 },2011 {2012 value: 9,2013 initialCount: 2,2014 },2015 {2016 value: 10,2017 initialCount: 2,2018 },2019 {2020 value: 19,2021 initialCount: 2,2022 },2023 {2024 value: 24,2025 initialCount: 2,2026 },2027 {2028 value: 25,2029 initialCount: 2,2030 },2031 {2032 value: 33,2033 initialCount: 2,2034 },2035 {2036 value: 37,2037 initialCount: 2,2038 },2039 {2040 value: 50,2041 initialCount: 2,2042 },2043 {2044 value: 48,2045 initialCount: 2,2046 }2047 ],2048 eats: [2049 {2050 value: -1,2051 text: '-1',2052 initialCount: 202053 },2054 {2055 value: -2,2056 text: '-2',2057 initialCount: 202058 },2059 {2060 value: -5,2061 text: '-5',2062 initialCount: 202063 },2064 ],2065 },2066 {2067 levelName: 'Sharks',2068 startValue: 0,2069 endValue: 50,2070 playerMaxValue: 100,2071 playerMinValue: -50,2072 worldSizeX: 2500,2073 worldSizeY: 2500,2074 sharks: [2075 {2076 value: 0,2077 initialCount: 1,2078 },2079 {2080 value: 1,2081 initialCount: 1,2082 },2083 {2084 value: 4,2085 initialCount: 1,2086 },2087 {2088 value: 9,2089 initialCount: 1,2090 },2091 {2092 value: 10,2093 initialCount: 1,2094 },2095 {2096 value: 19,2097 initialCount: 1,2098 },2099 {2100 value: 24,2101 initialCount: 1,2102 },2103 {2104 value: 25,2105 initialCount: 1,2106 },2107 {2108 value: 33,2109 initialCount: 1,2110 },2111 {2112 value: 37,2113 initialCount: 1,2114 },2115 {2116 value: 50,2117 initialCount: 1,2118 },2119 {2120 value: 48,2121 initialCount: 1,2122 },2123 {2124 value: 99,2125 initialCount: 1,2126 },2127 {2128 value: 77,2129 initialCount: 1,2130 },2131 {2132 value: 91,2133 initialCount: 1,2134 },2135 {2136 value: 68,2137 initialCount: 1,2138 },2139 {2140 value: 84,2141 initialCount: 1,2142 },2143 {2144 value: -33,2145 initialCount: 1,2146 },2147 {2148 value: -49,2149 initialCount: 1,2150 },2151 {2152 value: -28,2153 initialCount: 1,2154 },2155 {2156 value: -18,2157 initialCount: 1,2158 },2159 {2160 value: -14,2161 initialCount: 1,2162 },2163 {2164 value: -6,2165 initialCount: 1,2166 },2167 {2168 value: 7,2169 initialCount: 1,2170 }2171 ],2172 eats: [2173 {2174 value: -1,2175 text: '-1',2176 initialCount: 52177 },2178 {2179 value: -2,2180 text: '-2',2181 initialCount: 52182 },2183 {2184 value: -5,2185 text: '-5',2186 initialCount: 52187 },2188 {2189 value: -10,2190 text: '-10',2191 initialCount: 52192 },2193 {2194 value: 1,2195 text: '+1',2196 initialCount: 52197 },2198 {2199 value: 2,2200 text: '+2',2201 initialCount: 52202 },2203 {2204 value: 5,2205 text: '+5',2206 initialCount: 52207 },2208 {2209 value: 10,2210 text: '+10',2211 initialCount: 52212 },2213 ],2214 },2215 {2216 levelName: ' B < x < R',2217 startValue: 0,2218 endValue: 10,2219 playerMaxValue: 10,2220 playerMinValue: 0,2221 worldSizeX: 2500,2222 worldSizeY: 2500,2223 sharks: [2224 {2225 value: 0,2226 initialCount: 1,2227 },2228 {2229 value: 1,2230 initialCount: 1,2231 },2232 {2233 value: 2,2234 initialCount: 1,2235 },2236 {2237 value: 3,2238 initialCount: 1,2239 },2240 {2241 value: 4,2242 initialCount: 1,2243 },2244 {2245 value: 5,2246 initialCount: 1,2247 },2248 {2249 value: 6,2250 initialCount: 1,2251 },2252 {2253 value: 7,2254 initialCount: 1,2255 },2256 {2257 value: 8,2258 initialCount: 1,2259 },2260 {2261 value: 9,2262 initialCount: 1,2263 },2264 ],2265 jellys: [2266 {2267 value: 1,2268 initialCount: 1,2269 },2270 {2271 value: 2,2272 initialCount: 1,2273 },2274 {2275 value: 3,2276 initialCount: 1,2277 },2278 {2279 value: 4,2280 initialCount: 1,2281 },2282 {2283 value: 5,2284 initialCount: 1,2285 },2286 {2287 value: 6,2288 initialCount: 1,2289 },2290 {2291 value: 7,2292 initialCount: 1,2293 },2294 {2295 value: 8,2296 initialCount: 1,2297 },2298 {2299 value: 9,2300 initialCount: 1,2301 },2302 {2303 value: 10,2304 initialCount: 1,2305 },2306 ],2307 eats: [2308 {2309 value: -1,2310 text: '-1',2311 initialCount: 252312 },2313 {2314 value: 1,2315 text: '+1',2316 initialCount: 252317 },2318 ],2319 },2320 {2321 levelName: 'Double&Half',2322 startValue: 1,2323 endValue: 64,2324 playerMaxValue: 129,2325 playerMinValue: 1,2326 worldSizeX: 2500,2327 worldSizeY: 2500,2328 sharks: [2329 {2330 value: 1,2331 initialCount: 2,2332 },2333 {2334 value: 2,2335 initialCount: 2,2336 },2337 {2338 value: 4,2339 initialCount: 2,2340 },2341 {2342 value: 8,2343 initialCount: 2,2344 },2345 {2346 value: 16,2347 initialCount: 2,2348 },2349 {2350 value: 32,2351 initialCount: 2,2352 },2353 {2354 value: 64,2355 initialCount: 2,2356 },2357 ],2358 jellys: [2359 {2360 value: 1,2361 initialCount: 2,2362 },2363 {2364 value: 2,2365 initialCount: 2,2366 },2367 {2368 value: 4,2369 initialCount: 2,2370 },2371 {2372 value: 8,2373 initialCount: 2,2374 },2375 {2376 value: 16,2377 initialCount: 2,2378 },2379 {2380 value: 32,2381 initialCount: 2,2382 },2383 {2384 value: 64,2385 initialCount: 2,2386 },2387 ],2388 eats: [2389 {2390 value: 'Double',2391 text: 'x2',2392 initialCount: 102393 },2394 {2395 value: 'Half',2396 text: 'x0.5',2397 initialCount: 102398 },2399 ],2400 },2401 {2402 levelName: 'Square&Half',2403 startValue: 2,2404 endValue: 64,2405 playerMaxValue: 257,2406 playerMinValue: 2,2407 worldSizeX: 2500,2408 worldSizeY: 2500,2409 sharks: [2410 {2411 value: 2,2412 initialCount: 2,2413 },2414 {2415 value: 4,2416 initialCount: 2,2417 },2418 {2419 value: 16,2420 initialCount: 2,2421 },2422 {2423 value: 32,2424 initialCount: 2,2425 },2426 {2427 value: 64,2428 initialCount: 2,2429 },2430 {2431 value: 128,2432 initialCount: 2,2433 },2434 {2435 value: 256,2436 initialCount: 2,2437 },2438 ],2439 jellys: [2440 {2441 value: 2,2442 initialCount: 2,2443 },2444 {2445 value: 4,2446 initialCount: 2,2447 },2448 {2449 value: 16,2450 initialCount: 2,2451 },2452 {2453 value: 32,2454 initialCount: 2,2455 },2456 {2457 value: 64,2458 initialCount: 2,2459 },2460 {2461 value: 128,2462 initialCount: 2,2463 },2464 {2465 value: 256,2466 initialCount: 2,2467 },2468 ],2469 eats: [2470 {2471 value: 'Square',2472 text: 'x^2',2473 initialCount: 102474 },2475 {2476 value: 'Half',2477 text: 'x/2',2478 initialCount: 102479 },2480 ],2481 },2482 {2483 levelName: '10',2484 startValue: 1,2485 endValue: 100,2486 playerMaxValue: 10000,2487 playerMinValue: 1,2488 worldSizeX: 2500,2489 worldSizeY: 2500,2490 sharks: [2491 {2492 value: 1,2493 initialCount: 2,2494 },2495 {2496 value: 10,2497 initialCount: 2,2498 },2499 {2500 value: 100,2501 initialCount: 2,2502 },2503 {2504 value: 1000,2505 initialCount: 2,2506 },2507 {2508 value: 10000,2509 initialCount: 2,2510 },2511 ],2512 jellys: [2513 {2514 value: 1,2515 initialCount: 2,2516 },2517 {2518 value: 10,2519 initialCount: 2,2520 },2521 {2522 value: 100,2523 initialCount: 2,2524 },2525 {2526 value: 1000,2527 initialCount: 2,2528 },2529 {2530 value: 10000,2531 initialCount: 2,2532 },2533 ],2534 eats: [2535 {2536 value: 'Times10',2537 text: 'x10',2538 initialCount: 102539 },2540 {2541 value: 'Divide10',2542 text: 'x/10',2543 initialCount: 102544 },2545 ],2546 },2547 {2548 levelName: '10 of Power',2549 startValue: 1,2550 endValue: 100,2551 playerMaxValue: 10000,2552 playerMinValue: 1,2553 worldSizeX: 2500,2554 worldSizeY: 2500,2555 sharks: [2556 {2557 value: 1,2558 initialCount: 2,2559 },2560 {2561 value: 10,2562 initialCount: 2,2563 },2564 {2565 value: 100,2566 initialCount: 2,2567 },2568 {2569 value: 1000,2570 initialCount: 2,2571 },2572 {2573 value: 10000,2574 initialCount: 2,2575 },2576 ],2577 jellys: [2578 {2579 value: 1,2580 initialCount: 2,2581 },2582 {2583 value: 10,2584 initialCount: 2,2585 },2586 {2587 value: 100,2588 initialCount: 2,2589 },2590 {2591 value: 1000,2592 initialCount: 2,2593 },2594 {2595 value: 10000,2596 initialCount: 2,2597 },2598 ],2599 eats: [2600 {2601 value: 'Power10',2602 text: 'x10^1',2603 initialCount: 102604 },2605 {2606 value: 'Power-10',2607 text: 'x10^-1',2608 initialCount: 102609 },2610 ],2611 },2612 {2613 levelName: 'Big Map!',2614 startValue: 10,2615 endValue: 50,2616 playerMaxValue: 100,2617 playerMinValue: -100,2618 worldSizeX: 10000,2619 worldSizeY: 10000,2620 sharks: [2621 {2622 value: -100,2623 initialCount: 1,2624 },2625 {2626 value: -51,2627 initialCount: 3,2628 },2629 {2630 value: -18,2631 initialCount: 14,2632 },2633 {2634 value: -4,2635 initialCount: 33,2636 },2637 {2638 value: -1,2639 initialCount: 50,2640 },2641 {2642 value: 1,2643 initialCount: 50,2644 },2645 {2646 value: 4,2647 initialCount: 33,2648 },2649 {2650 value: 18,2651 initialCount: 14,2652 },2653 {2654 value: 51,2655 initialCount: 3,2656 },2657 {2658 value: 100,2659 initialCount: 1,2660 },2661 ],2662 jellys: [2663 {2664 value: -100,2665 initialCount: 1,2666 },2667 {2668 value: -51,2669 initialCount: 3,2670 },2671 {2672 value: -18,2673 initialCount: 14,2674 },2675 {2676 value: -4,2677 initialCount: 33,2678 },2679 {2680 value: -1,2681 initialCount: 50,2682 },2683 {2684 value: 1,2685 initialCount: 50,2686 },2687 {2688 value: 4,2689 initialCount: 33,2690 },2691 {2692 value: 18,2693 initialCount: 14,2694 },2695 {2696 value: 51,2697 initialCount: 3,2698 },2699 {2700 value: 100,2701 initialCount: 1,2702 },2703 ],2704 eats: [2705 {2706 value: -1,2707 text: '-1',2708 initialCount: 502709 },2710 {2711 value: 1,2712 text: '+1',2713 initialCount: 502714 },2715 {2716 value: -2,2717 text: '-2',2718 initialCount: 402719 },2720 {2721 value: 2,2722 text: '+2',2723 initialCount: 402724 },2725 {2726 value: -5,2727 text: '-5',2728 initialCount: 302729 },2730 {2731 value: 5,2732 text: '+5',2733 initialCount: 302734 },2735 {2736 value: -10,2737 text: '-10',2738 initialCount: 202739 },2740 {2741 value: 10,2742 text: '+10',2743 initialCount: 202744 },2745 ],2746 },2747 2748]...

Full Screen

Full Screen

Game.ts

Source:Game.ts Github

copy

Full Screen

1var game = new Phaser.Game(1200, 800, Phaser.AUTO, 'container', {2 config: {3 //Size of the world - used for UI elements4 //These have to be the same as the canvas size5 worldSizeX: 1200,6 worldSizeY: 800,7 //Where to place the Question answered text8 textPlace: 86,9 //How many points you start with10 startPoints: '0',11 //Medal you won in the last round - this changes12 medal: 'none',13 //Players Information14 //startValue: 0,15 startSpeed: 400,16 endValue: 10,17 //State of the Player18 alive: true,19 lives: 3,20 answerStart: 0,21 startSpeed: 400,22 currentLevel: 1,23 finalLevel: 9,24 clamStart: false,25 levels: {26 1: {27 levelName: 'Level 1',28 startValue: 1,29 endValue: 10,30 playerMaxValue: 10,31 playerMinValue: 0,32 worldSizeX: 2500,33 worldSizeY: 2500,34 sharks: [35 {36 value: 1,37 initialCount: 2,38 },39 {40 value: 2,41 initialCount: 10,42 },43 {44 value: 5,45 initialCount: 546 },47 {48 value: 7,49 initialCount: 550 },51 {52 value: 10,53 initialCount: 554 }55 ],56 eats: [57 {58 value: 1,59 text: '+1',60 initialCount: 1061 },62 ]63 },64 2: {65 levelName: 'Level 2',66 startValue: 50,67 endValue: 10,68 playerMaxValue: 50,69 playerMinValue: 10,70 worldSizeX: 2500,71 worldSizeY: 2500,72 sharks: [73 {74 value: 0,75 initialCount: 2,76 },77 {78 value: 1,79 initialCount: 2,80 },81 {82 value: 4,83 initialCount: 2,84 },85 {86 value: 9,87 initialCount: 2,88 },89 {90 value: 10,91 initialCount: 2,92 },93 {94 value: 19,95 initialCount: 2,96 },97 {98 value: 24,99 initialCount: 2,100 },101 {102 value: 25,103 initialCount: 2,104 },105 {106 value: 33,107 initialCount: 2,108 },109 {110 value: 37,111 initialCount: 2,112 },113 {114 value: 50,115 initialCount: 2,116 },117 {118 value: 48,119 initialCount: 2,120 }121 ],122 eats: [123 {124 value: -1,125 text: '-1',126 initialCount: 20127 },128 {129 value: -2,130 text: '-2',131 initialCount: 20132 },133 {134 value: -5,135 text: '-5',136 initialCount: 20137 },138 ],139 },140 3: {141 levelName: 'Sharks',142 startValue: 0,143 endValue: 50,144 playerMaxValue: 100,145 playerMinValue: -50,146 worldSizeX: 2500,147 worldSizeY: 2500,148 sharks: [149 {150 value: 0,151 initialCount: 1,152 },153 {154 value: 1,155 initialCount: 1,156 },157 {158 value: 4,159 initialCount: 1,160 },161 {162 value: 9,163 initialCount: 1,164 },165 {166 value: 10,167 initialCount: 1,168 },169 {170 value: 19,171 initialCount: 1,172 },173 {174 value: 24,175 initialCount: 1,176 },177 {178 value: 25,179 initialCount: 1,180 },181 {182 value: 33,183 initialCount: 1,184 },185 {186 value: 37,187 initialCount: 1,188 },189 {190 value: 50,191 initialCount: 1,192 },193 {194 value: 48,195 initialCount: 1,196 },197 {198 value: 99,199 initialCount: 1,200 },201 {202 value: 77,203 initialCount: 1,204 },205 {206 value: 91,207 initialCount: 1,208 },209 {210 value: 68,211 initialCount: 1,212 },213 {214 value: 84,215 initialCount: 1,216 },217 {218 value: -33,219 initialCount: 1,220 },221 {222 value: -49,223 initialCount: 1,224 },225 {226 value: -28,227 initialCount: 1,228 },229 {230 value: -18,231 initialCount: 1,232 },233 {234 value: -14,235 initialCount: 1,236 },237 {238 value: -6,239 initialCount: 1,240 },241 {242 value: 7,243 initialCount: 1,244 }245 ],246 eats: [247 {248 value: -1,249 text: '-1',250 initialCount: 5251 },252 {253 value: -2,254 text: '-2',255 initialCount: 5256 },257 {258 value: -5,259 text: '-5',260 initialCount: 5261 },262 {263 value: -10,264 text: '-10',265 initialCount: 5266 },267 {268 value: 1,269 text: '+1',270 initialCount: 5271 },272 {273 value: 2,274 text: '+2',275 initialCount: 5276 },277 {278 value: 5,279 text: '+5',280 initialCount: 5281 },282 {283 value: 10,284 text: '+10',285 initialCount: 5286 },287 ],288 },289 4: {290 levelName: ' B < x < R',291 startValue: 0,292 endValue: 10,293 playerMaxValue: 10,294 playerMinValue: 0,295 worldSizeX: 2500,296 worldSizeY: 2500,297 sharks: [298 {299 value: 0,300 initialCount: 1,301 },302 {303 value: 1,304 initialCount: 1,305 },306 {307 value: 2,308 initialCount: 1,309 },310 {311 value: 3,312 initialCount: 1,313 },314 {315 value: 4,316 initialCount: 1,317 },318 {319 value: 5,320 initialCount: 1,321 },322 {323 value: 6,324 initialCount: 1,325 },326 {327 value: 7,328 initialCount: 1,329 },330 {331 value: 8,332 initialCount: 1,333 },334 {335 value: 9,336 initialCount: 1,337 },338 ],339 jellys: [340 {341 value: 1,342 initialCount: 1,343 },344 {345 value: 2,346 initialCount: 1,347 },348 {349 value: 3,350 initialCount: 1,351 },352 {353 value: 4,354 initialCount: 1,355 },356 {357 value: 5,358 initialCount: 1,359 },360 {361 value: 6,362 initialCount: 1,363 },364 {365 value: 7,366 initialCount: 1,367 },368 {369 value: 8,370 initialCount: 1,371 },372 {373 value: 9,374 initialCount: 1,375 },376 {377 value: 10,378 initialCount: 1,379 },380 ],381 eats: [382 {383 value: -1,384 text: '-1',385 initialCount: 25386 },387 {388 value: 1,389 text: '+1',390 initialCount: 25391 },392 ],393 },394 5: {395 levelName: 'Double&Half',396 startValue: 1,397 endValue: 64,398 playerMaxValue: 129,399 playerMinValue: 1,400 worldSizeX: 2500,401 worldSizeY: 2500,402 sharks: [403 {404 value: 1,405 initialCount: 2,406 },407 {408 value: 2,409 initialCount: 2,410 },411 {412 value: 4,413 initialCount: 2,414 },415 {416 value: 8,417 initialCount: 2,418 },419 {420 value: 16,421 initialCount: 2,422 },423 {424 value: 32,425 initialCount: 2,426 },427 {428 value: 64,429 initialCount: 2,430 },431 ],432 jellys: [433 {434 value: 1,435 initialCount: 2,436 },437 {438 value: 2,439 initialCount: 2,440 },441 {442 value: 4,443 initialCount: 2,444 },445 {446 value: 8,447 initialCount: 2,448 },449 {450 value: 16,451 initialCount: 2,452 },453 {454 value: 32,455 initialCount: 2,456 },457 {458 value: 64,459 initialCount: 2,460 },461 ],462 eats: [463 {464 value: 'Double',465 text: 'x2',466 initialCount: 10467 },468 {469 value: 'Half',470 text: 'x0.5',471 initialCount: 10472 },473 ],474 },475 6: {476 levelName: 'Square&Half',477 startValue: 2,478 endValue: 64,479 playerMaxValue: 257,480 playerMinValue: 2,481 worldSizeX: 2500,482 worldSizeY: 2500,483 sharks: [484 {485 value: 2,486 initialCount: 2,487 },488 {489 value: 4,490 initialCount: 2,491 },492 {493 value: 16,494 initialCount: 2,495 },496 {497 value: 32,498 initialCount: 2,499 },500 {501 value: 64,502 initialCount: 2,503 },504 {505 value: 128,506 initialCount: 2,507 },508 {509 value: 256,510 initialCount: 2,511 },512 ],513 jellys: [514 {515 value: 2,516 initialCount: 2,517 },518 {519 value: 4,520 initialCount: 2,521 },522 {523 value: 16,524 initialCount: 2,525 },526 {527 value: 32,528 initialCount: 2,529 },530 {531 value: 64,532 initialCount: 2,533 },534 {535 value: 128,536 initialCount: 2,537 },538 {539 value: 256,540 initialCount: 2,541 },542 ],543 eats: [544 {545 value: 'Square',546 text: 'x^2',547 initialCount: 10548 },549 {550 value: 'Half',551 text: 'x/2',552 initialCount: 10553 },554 ],555 },556 7: {557 levelName: '10',558 startValue: 1,559 endValue: 100,560 playerMaxValue: 10000,561 playerMinValue: 1,562 worldSizeX: 2500,563 worldSizeY: 2500,564 sharks: [565 {566 value: 1,567 initialCount: 2,568 },569 {570 value: 10,571 initialCount: 2,572 },573 {574 value: 100,575 initialCount: 2,576 },577 {578 value: 1000,579 initialCount: 2,580 },581 {582 value: 10000,583 initialCount: 2,584 },585 ],586 jellys: [587 {588 value: 1,589 initialCount: 2,590 },591 {592 value: 10,593 initialCount: 2,594 },595 {596 value: 100,597 initialCount: 2,598 },599 {600 value: 1000,601 initialCount: 2,602 },603 {604 value: 10000,605 initialCount: 2,606 },607 ],608 eats: [609 {610 value: 'Times10',611 text: 'x10',612 initialCount: 10613 },614 {615 value: 'Divide10',616 text: 'x/10',617 initialCount: 10618 },619 ],620 },621 8: {622 levelName: '10 of Power',623 startValue: 1,624 endValue: 100,625 playerMaxValue: 10000,626 playerMinValue: 1,627 worldSizeX: 2500,628 worldSizeY: 2500,629 sharks: [630 {631 value: 1,632 initialCount: 2,633 },634 {635 value: 10,636 initialCount: 2,637 },638 {639 value: 100,640 initialCount: 2,641 },642 {643 value: 1000,644 initialCount: 2,645 },646 {647 value: 10000,648 initialCount: 2,649 },650 ],651 jellys: [652 {653 value: 1,654 initialCount: 2,655 },656 {657 value: 10,658 initialCount: 2,659 },660 {661 value: 100,662 initialCount: 2,663 },664 {665 value: 1000,666 initialCount: 2,667 },668 {669 value: 10000,670 initialCount: 2,671 },672 ],673 eats: [674 {675 value: 'Power10',676 text: 'x10^1',677 initialCount: 10678 },679 {680 value: 'Power-10',681 text: 'x10^-1',682 initialCount: 10683 },684 ],685 },686 9: {687 levelName: 'Big Map!',688 startValue: 10,689 endValue: 50,690 playerMaxValue: 100,691 playerMinValue: -100,692 worldSizeX: 10000,693 worldSizeY: 10000,694 sharks: [695 {696 value: -100,697 initialCount: 1,698 },699 {700 value: -51,701 initialCount: 3,702 },703 {704 value: -18,705 initialCount: 14,706 },707 {708 value: -4,709 initialCount: 33,710 },711 {712 value: -1,713 initialCount: 50,714 },715 {716 value: 1,717 initialCount: 50,718 },719 {720 value: 4,721 initialCount: 33,722 },723 {724 value: 18,725 initialCount: 14,726 },727 {728 value: 51,729 initialCount: 3,730 },731 {732 value: 100,733 initialCount: 1,734 },735 ],736 jellys: [737 {738 value: -100,739 initialCount: 1,740 },741 {742 value: -51,743 initialCount: 3,744 },745 {746 value: -18,747 initialCount: 14,748 },749 {750 value: -4,751 initialCount: 33,752 },753 {754 value: -1,755 initialCount: 50,756 },757 {758 value: 1,759 initialCount: 50,760 },761 {762 value: 4,763 initialCount: 33,764 },765 {766 value: 18,767 initialCount: 14,768 },769 {770 value: 51,771 initialCount: 3,772 },773 {774 value: 100,775 initialCount: 1,776 },777 ],778 eats: [779 {780 value: -1,781 text: '-1',782 initialCount: 50783 },784 {785 value: 1,786 text: '+1',787 initialCount: 50788 },789 {790 value: -2,791 text: '-2',792 initialCount: 40793 },794 {795 value: 2,796 text: '+2',797 initialCount: 40798 },799 {800 value: -5,801 text: '-5',802 initialCount: 30803 },804 {805 value: 5,806 text: '+5',807 initialCount: 30808 },809 {810 value: -10,811 text: '-10',812 initialCount: 20813 },814 {815 value: 10,816 text: '+10',817 initialCount: 20818 },819 ],820 },821 },822 },823 gameState: {},824 //Phaser functions825 preload: function () {826 game.load.image('splash', 'assets/startScreen.png');827 game.load.spritesheet('you', 'assets2/body6.png', 75, 75, 4);828 game.load.spritesheet('lives', 'assets/LivesGreaterThan.png', 150, 30, 5);829 game.load.spritesheet('tailSwish', 'assets2/tail.png', 150, 150, 16);830 game.load.spritesheet('headFace', 'assets2/headFace.png', 150, 150, 2);831 //game.load.spritesheet('medals', 'assets3/medals.png', 300, 260, 3);832 game.load.image('bronze', 'assets3/bronze.png');833 game.load.image('silver', 'assets3/silver.png');834 game.load.image('gold', 'assets3/gold.png');835 game.load.image('complete', 'assets3/depthCompleted.png');836 game.load.image('play', 'assets3/playButton.png');837 //game.load.spritesheet('enemy', 'assets3/SharkSpriteSheet.png', 50, 50, 15);838 game.load.image('bg', 'assets/background.png');839 game.load.image('up', 'assets/levelUp.png');840 game.load.image('eatsUI', 'assets3/uiBar.png');841 game.load.image('blob', 'assets/bgDust.png');842 game.load.image('block', 'assets/collectable.png');843 game.load.image('enemy', 'assets2/shark.png');844 game.load.image('jelly', 'assets2/jelly.png');845 game.load.image('end', 'assets/credits.png');846 game.load.image('end', 'assets/credits.png');847 game.load.image('loose', 'assets/loose.png');848 game.load.image('title', 'assets/TitleBar.png');849 game.load.image('clam', 'assets/clam.png');850 game.load.image('waves', 'assets/waves.png');851 game.load.image('head', 'assets/head.png');852 },853 create: function () {854 var levelId = this.config.currentLevel;855 this.gameState = {856 currentLevel: levelId,857 levelName: this.config.levels[levelId].levelName,858 currentValue: this.config.levels[levelId].startValue,859 endValue: this.config.levels[levelId].endValue,860 playerMaxValue: this.config.levels[levelId].playerMaxValue,861 playerMinValue: this.config.levels[levelId].playerMinValue,862 worldSizeX: this.config.levels[levelId].worldSizeX,863 worldSizeY: this.config.levels[levelId].worldSizeY,864 //the number of background animations is 10% of the world size865 dustNumber: this.config.levels[levelId].worldSizeX/10,866 toBig: false,867 toSmall: false,868 alive: this.config.alive,869 lives: this.config.lives,870 currentSpeed: this.config.startSpeed,871 answered: this.config.answerStart,872 clams: 0,873 textPlace: this.config.textPlace,874 startPoints: this.config.startPoints,875 combo: 0,876 points: 0,877 fullUp: false,878 physicsGroup: this.add.group(),879 sharkGroups: [],880 jellyGroups: [],881 eatGroups: [],882 };883 this.addWorld();884 this._createEntities();885 //has to be added last otherwise things swim over it886 this.addUI();887 },888 889 update: function () {890 //Player movement with mouse891 if (this.game.input.activePointer.isDown) {892 // 400 is the speed it will move towards the mouse893 this.game.physics.arcade.moveToPointer(this.player, this.gameState.currentSpeed);894 // if it's overlapping the mouse, don't move any more895 //this only works for top left corner where this is true - because the game world is bigger than the screen896 //this dose not work !!! need to find a different way to calculate the position of the mouse is over the player.897 if (Phaser.Rectangle.contains(this.player.body, game.input.x, game.input.y)) {898 this.player.body.velocity.setTo(0, 0);899 }900 }901 else {902 this.player.body.velocity.setTo(0, 0);903 }904 //player animation905 // this.tail.x = this.player.x906 // this.tail.y = this.player.y907 //908 // this.head.x = this.player.x909 // this.head.y = this.player.y910 //911 // this.tail.rotation = game.physics.arcade.angleToPointer(this.tail);912 // this.head.rotation = game.physics.arcade.angleToPointer(this.head);913 //arrow key movement914 if (this.game.cursors.left.isDown) {915 this.player.x -= this.gameState.currentSpeed/80;916 }917 else if (this.game.cursors.right.isDown)918 {919 this.player.x += this.gameState.currentSpeed/80;920 }921 if (this.game.cursors.up.isDown) {922 this.player.y -= this.gameState.currentSpeed/80;923 }924 else if (this.game.cursors.down.isDown)925 {926 this.player.y += this.gameState.currentSpeed/80;927 }928 //setting up collisions929 if (this.gameState.alive == false) {930 } else {931 for (var i = 0; i < this.gameState.eatGroups.length; ++i) {932 var currentEatGroup = this.gameState.eatGroups[i];933 this.game.physics.arcade.overlap(934 this.player,935 currentEatGroup,936 function (player, eats) {937 this.checkeatsValueCollected(938 eats,939 currentEatGroup,940 currentEatGroup.value,941 currentEatGroup.text,942 'block'943 );944 },945 null,946 this947 );948 }949 for (var i = 0; i < this.gameState.sharkGroups.length; ++i) {950 var currentSharkGroup = this.gameState.sharkGroups[i];951 this.game.physics.arcade.overlap(952 this.player,953 currentSharkGroup,954 function (player, shark) {955 this.sharkAttack(956 player,957 shark,958 currentSharkGroup,959 currentSharkGroup.value,960 'enemy'961 );962 },963 null,964 this965 );966 }967 for (var i = 0; i < this.gameState.jellyGroups.length; ++i) {968 var currentJellyGroup = this.gameState.jellyGroups[i];969 this.game.physics.arcade.overlap(970 this.player,971 currentJellyGroup,972 function (player, jelly) {973 this.jellyAttack(974 player,975 jelly,976 currentJellyGroup,977 currentJellyGroup.value,978 'jelly'979 );980 },981 null,982 this983 );984 }985 //A colision with a clam986 if (this.gameState.clamExist = false){987 } else {988 this.game.physics.arcade.overlap(this.player, this.clamSprite, this.nextLevel, null, this);989 }990 }991 },992 993 //Functions for Building the Environment994 addWorld: function () {995 //create world bounds, background image and lock to camera996 this.game.world.setBounds(0, 0, this.gameState.worldSizeX, this.gameState.worldSizeY);997 this.bounds = new Phaser.Rectangle(0, 0, this.gameState.worldSizeX/1.2, this.gameState.worldSizeY/1.2);998 this.background = game.add.tileSprite(0, 0, 1600, 900, 'bg');999 this.background.fixedToCamera = true;1000 //this.waves = game.add.tileSprite(0, 0, 2500 , 2500, 'waves');1001 //enable Input1002 this.game.cursors = this.game.input.keyboard.createCursorKeys();1003 //The Background aninimated dust particles1004 this.dusts = this.add.group();1005 this.dustPhysicsGroup = this.game.make.group();1006 for (var i = 0; i < this.gameState.dustNumber; i++) {1007 this.dust = this.dusts.create(this.bounds.randomX, this.bounds.randomY, 'blob');1008 this.physics.enable(this.dust, Phaser.Physics.ARCADE);1009 this.dust.body.velocity.x = game.rnd.integerInRange(-200, 200);1010 this.dust.body.velocity.y = game.rnd.integerInRange(-220, 200);1011 }1012 this._createGroupPhyscis(this.dusts, this.dustPhysicsGroup);1013 },1014 addUI: function () {1015 //Lives in top left corner of the Camera1016 this.livesSprite = this.add.sprite(10, 10, 'lives');1017 this.livesSprite.fixedToCamera = true;1018 this.livesSprite.frame = 2;1019 //Score Board - Top Eats1020 this.topEatsUI = this.add.image(500, 500, 'eatsUI');1021 this.topEatsUI.fixedToCamera = true;1022 this.topEatsUI.cameraOffset.setTo(this.config.worldSizeX - 200, 50);1023 //title Bar - name of level1024 this.titleUI = this.add.image(500, 500, 'title');1025 this.titleUI.fixedToCamera = true;1026 this.titleUI.cameraOffset.setTo(this.config.worldSizeX - 200, 10);1027 this.titleText = this.make.text(5, 5, this.gameState.levelName, {fill: '#24475b'});1028 this.titleUI.addChild(this.titleText);1029 this.titleText = this.make.text(5, 5, this.gameState.levelName, {fill: '#24475b'});1030 this.titleUI.addChild(this.titleText);1031 //points UI1032 this.pointsText = game.add.text(600, 500, this.gameState.startPoints, {1033 fill: "#24475b",1034 align: "center"1035 });1036 this.pointsText.fixedToCamera = true;1037 this.pointsText.cameraOffset.setTo(this.config.worldSizeX - 130, 370);1038 //combo UI1039 this.comboText = game.add.text(600, 500, this.gameState.combo, {1040 fill: "#24475b",1041 align: "center"1042 });1043 this.comboText.fixedToCamera = true;1044 this.comboText.cameraOffset.setTo(this.config.worldSizeX - 100, 475);1045 this.config.scoreValue += 25;1046 },1047 _createEntities: function () {1048 if (this.config.levels[this.gameState.currentLevel].eats){1049 var eats = this.config.levels[this.gameState.currentLevel].eats;1050 for (var i=0; i < eats.length; ++i){1051 var eatsConfig = eats[i];1052 this._addAllStaticObjects(eatsConfig.initialCount, this.gameState.eatGroups, eatsConfig.value, eatsConfig.text, 'block')1053 }1054 }1055 if (this.config.levels[this.gameState.currentLevel].sharks){1056 var sharks = this.config.levels[this.gameState.currentLevel].sharks;1057 for (var i = 0; i < sharks.length; ++i) {1058 var sharkConfig = sharks[i];1059 this._addAllMovingObjects(sharkConfig.initialCount, this.gameState.sharkGroups, sharkConfig.value, 'enemy');1060 }1061 }1062 if (this.config.levels[this.gameState.currentLevel].jellys) {1063 var jellys = this.config.levels[this.gameState.currentLevel].jellys;1064 for (var i = 0; i < jellys.length; ++i) {1065 var jellyConfig = jellys[i];1066 this._addAllMovingObjects(jellyConfig.initialCount, this.gameState.jellyGroups, jellyConfig.value, 'jelly');1067 }1068 }1069 this.addPlayer();1070 },1071 addPlayer: function () {1072 this.player = this.add.sprite(1000, 1000, 'you');1073 //Player Physics1074 this.physics.enable(this.player, Phaser.Physics.ARCADE);1075 this.player.body.setSize(75, 75, 0, 0);1076 this.player.anchor.setTo(0.5, 0.5);1077 this.player.body.collideWorldBounds = true;1078 this.player.body.bounce.x = 1;1079 this.player.body.bounce.y = 1;1080 this.player.body.minBounceVelocity = 0;1081 this.game.camera.follow(this.player);1082 //Text on Player - Showing the players value1083 this.Number = this.make.text(-10, -15, this.config.levels[this.gameState.currentLevel].startValue, {fill: '#000000'});1084 this.player.addChild(this.Number);1085 // //create a tail1086 //1087 // this.tail = this.add.sprite(1000, 1000, 'tailSwish');1088 // this.tail.anchor.setTo(1, 0.55);1089 // this.tail.animations.add('tailSwish', [0, 1, 2, 3, 4,5,6,7], 10, true).play();1090 //1091 // //this.tail.animations.add('tailSwish', [0, 1, 2, 3, 4,5,6,7], 30, true).play();1092 //1093 // //create a head1094 // this.head = this.add.sprite(1000, 1000, 'headFace');1095 // this.head.anchor.setTo(-0.1, 0.5);1096 // this.head.frame = 1;1097 },1098 //Functions for changing between levels1099 addLevelUpScreen: function (){1100 this.config.currentLevel ++;1101 game.stage.backgroundColor = "#6f9695";1102 this.levelUp = game.add.sprite(220, 170, 'complete');1103 this.levelUp.fixedToCamera = true;1104 this.medal = game.add.sprite(260, 290, this.config.medal);1105 this.medal.fixedToCamera = true;1106 this.playButton = game.add.button(630, 280, 'play', this._endLevel, this);1107 this.playButton.fixedToCamera = true;1108 console.log(this.config.medal);1109 //1110 // game.add.tween(this.levelUp).to( { alpha: 0 }, 4000, Phaser.Easing.Linear.None, true);1111 //1112 // game.time.events.add(Phaser.Timer.SECOND * 4, this._endLevel, this)1113 },1114 _endLevel: function(){1115 this.game.world.removeAll();1116 this.create();1117 },1118 addLevelDownScreen: function (){1119 game.stage.backgroundColor = "#6f9695";1120 this.levelDown = game.add.image(0, 0, 'loose');1121 this.levelDown.fixedToCamera = true;1122 game.add.tween(this.levelDown).to( { alpha: 0 }, 3000, Phaser.Easing.Linear.None, true);1123 this.config.currentLevel --;;1124 game.time.events.add(Phaser.Timer.SECOND * 3, this._endLevel, this)1125 },1126 addEndScreen: function(){1127 game.stage.backgroundColor = "#6f9695";1128 this.levelEnd = game.add.sprite(0, 0, 'splash');1129 this.levelEnd.fixedToCamera = true;1130 this.levelEnd.inputEnabled = true;1131 this.levelEnd.events.onInputDown.add(this.startGame, this);1132 },1133 startGame: function(){1134 this.config.currentLevel = 1;1135 this.game.world.removeAll();1136 this.create();1137 },1138 //Game Play Functions1139 moreLives: function () {1140 if (this.gameState.lives < 5) {1141 this.gameState.lives += 1;1142 this.livesSprite.frame -= 1;1143 //if you have more lives you go slower1144 //this.gameState.currentSpeed -= 80;1145 console.log('my speed= ' + this.gameState.currentSpeed);1146 } else {1147 this.gameState.lives = 5;1148 }1149 this.tenToWin();1150 },1151 died: function () {1152 console.log('my speed= ' + this.gameState.currentSpeed);1153 if(this.gameState.fullUp == false){1154 this.player.frame = 1;1155 }else if(this.gameState.fullUp == true){1156 this.player.frame = 3;1157 }1158 this.gameState.combo = 0;1159 this.checkCombo();1160 console.log(this.gameState.fullUp);1161 // //change animations1162 // this.head.frame = 2;1163 // this.tail.animations.add('tailSwish', [8, 9, 10, 11, 12, 13, 14 ,15], 10, true).play();1164 //change states1165 this.gameState.alive = false;1166 this.game.time.events.add(Phaser.Timer.SECOND * 4, this.reBorn, this);1167 this.gameState.lives -= 1;1168 if (this.gameState.lives <= 0) {1169 1170 //go down to easier dificulty1171 if(this.config.currentLevel > 1){1172 this.config.currentLevel = this.gameState.currentLevel;1173 this.game.world.removeAll();1174 this.addLevelDownScreen();1175 }else{1176 // //you now have full lives and you speed is reset to fastest1177 //this.gameState.currentSpeed = 0;1178 //this.gameState.currentSpeed += this.config.startSpeed;1179 this.gameState.lives = 5;1180 }1181 } else {1182 //you have less lives so you go faster1183 //this.gameState.currentSpeed += 80;1184 this.livesSprite.frame += 1;1185 }1186 },1187 reBorn: function () {1188 if(this.gameState.fullUp == false){1189 this.player.frame = 0;1190 }else if(this.gameState.fullUp == true){1191 this.player.frame = 2;1192 }1193 // this.head.frame = 1;1194 // this.tail.animations.add('tailSwish', [0, 1, 2, 3, 4,5,6,7], 10, true).play();1195 this.gameState.alive = true;1196 },1197 tenToWin: function () {1198 if (this.gameState.answered <= 9) {1199 this.gameState.answered += 1;1200 }1201 else if( this.gameState.answered == 10 && this.gameState.clams < 1){1202 this.gameState.clams = 1;1203 this.addClam();1204 }1205 },1206 addClam: function () {1207 this.clamSprite = this.add.sprite(this.gameState.worldSizeX/2, this.gameState.worldSizeY/2, 'clam');1208 this.physics.enable(this.clamSprite, Phaser.Physics.ARCADE);1209 this.clamSprite.enableBody = true;1210 this.clamText = this.make.text(65, 50, this.gameState.endValue, {fill: '#FFFFFF'});1211 this.clamSprite.addChild(this.clamText);1212 this.endingText = this.add.text(400, 600, 'Become ' + this.gameState.endValue + ' and Get to the Clam!', {fill: '#000000'});1213 this.endingText.fixedToCamera = true;1214 console.log('there is a clam')1215 console.log(this.clamSprite.body);1216 console.log(this.gameState.clamExist);1217 console.log(this.gameState.currentValue + ' is my current value')1218 console.log(this.gameState.endValue + ' is my end value')1219 },1220 nextLevel: function () {1221 //Calculate medal won1222 this.config.medal = 'none';1223 console.log(this.config.medal);1224 if(this.gameState.points <=1000){1225 this.config.medal = 'bronze';1226 }else if (this.gameState.points >=1000 && this.gameState.points <= 2000){1227 this.config.medal = 'silver';1228 }else{1229 this.config.medal = 'gold';1230 }1231 console.log(this.config.medal);1232 if (this.gameState.currentValue == this.gameState.endValue){1233 1234 this.config.currentLevel = this.gameState.currentLevel;1235 this.clamSprite.destroy();1236 this.game.world.removeAll();1237 this.addLevelUpScreen();1238 }1239 },1240 1241 //Creating Moving Objects - Such as sharks or jelly fish or dust1242 _addAllMovingObjects: function (amount, listOfGroups, value, image) {1243 var objectGroup = this.add.group();1244 objectGroup.value = value;1245 listOfGroups.push(objectGroup);1246 this._createMovingObject(amount, objectGroup, value, image);1247 },1248 _createMovingObject: function (amount, objectGroup, value, image) {1249 for (var i = 0; i < amount; i++) {1250 this._createMovingObjectAndAddToGroup(objectGroup, value, image);1251 }1252 },1253 _createMovingObjectAndAddToGroup: function(objectGroup, value, image){1254 var object = objectGroup.create(this.bounds.randomX, this.bounds.randomY, image);1255 this.physics.enable(object, Phaser.Physics.ARCADE);1256 //give the object a random speed1257 object.body.velocity.x = game.rnd.integerInRange(-200, 200);1258 object.body.velocity.y = game.rnd.integerInRange(-220, 200);1259 var text = this.make.text(42, 22, value, {fill: '#f4f0ce'});1260 object.addChild(text);1261 //object.animations.add(object + 'aniamtion', [0, 1, 2, 3, 4,5,6,7, 8, 9, 10, 11, 12 ,13, 14, 15], 15, true).play();1262 this._createGroupPhyscis(objectGroup, this.gameState.physicsGroup);1263 },1264 //Creating Static Objects - Such as collectables 'eats'1265 _createStaticObject: function (amount, objectGroup, value, textValue, image) {1266 for (var i = 0; i < amount; i++) {1267 this._createStaticObjectAndAddToGroup(objectGroup, textValue, image);1268 }1269 },1270 _createStaticObjectAndAddToGroup: function(objectGroup, textValue, image){1271 var object = objectGroup.create(this.bounds.randomX, this.bounds.randomY, image);1272 this.physics.enable(object, Phaser.Physics.ARCADE);1273 var textShown = this.make.text(5, 5, textValue, {fill: '#000000'});1274 object.addChild(textShown);1275 console.log(textValue)1276 this._createGroupPhyscis(objectGroup, this.gameState.physicsGroup);1277 },1278 _addAllStaticObjects: function (amount, listOfGroups, value, textValue, image) {1279 var staticObjectGroup = this.add.group();1280 staticObjectGroup.value = value;1281 staticObjectGroup.text = textValue;1282 listOfGroups.push(staticObjectGroup);1283 this._createStaticObject(amount, staticObjectGroup, value, textValue, image);1284 },1285 //This physics is used for both static and moving objects1286 _createGroupPhyscis: function (objectGroup, physicsGroup) {1287 //Some more physics information for the Shark1288 physicsGroup = this.game.make.group();1289 physicsGroup.create(-50, -50, 'block');1290 objectGroup.add(physicsGroup);1291 objectGroup.setAll('body.collideWorldBounds', true);1292 objectGroup.setAll('body.bounce.x', 1);1293 objectGroup.setAll('body.bounce.y', 1);1294 objectGroup.setAll('body.minBounceVelocity', 0);1295 },1296 //Sub-Functions that happen when a group of object e.g. sharks, jellys, eats have been colldied with1297 _addSharkSolvedMath: function (currentValue, sharkValue, worldSizeX, textPlace) {1298 if (this.gameState.answered <= 9) {1299 this.scoreUI = game.add.text(600, 500, currentValue + ' > ' + sharkValue, {1300 fill: "#24475b",1301 align: "center",1302 fontSize: 151303 });1304 this.scoreUI.fixedToCamera = true;1305 this.scoreUI.cameraOffset.setTo(worldSizeX - 160, 10 + textPlace);1306 console.log('game state answered = ' + this.gameState.answered);1307 this._addPoints();1308 }1309 },1310 _aniamtionSharkSolvedMath: function(currentValue, sharkValue, player){1311 this.solvedEquation = game.add.text(player.x, player.y, currentValue + ' > ' + sharkValue, {fill: "#24475b"});1312 },1313 _animationSharkError: function(currentValue, sharkValue, player){1314 this.wrongEquation = game.add.text(player.x, player.y, currentValue + ' < ' + sharkValue, {fill: "#5b2447"});1315 },1316 _aniamtionJellySolvedMath: function(currentValue, jellyValue, player){1317 this.solvedEquation = game.add.text(player.x, player.y, currentValue + ' < ' + jellyValue, {fill: "#5b2447"});1318 },1319 _animationJellyError: function(currentValue, jellyValue, player){1320 this.wrongEquation = game.add.text(player.x, player.y, currentValue + ' > ' + jellyValue, {fill: "#24475b"});1321 },1322 _addJellySolvedMath: function (currentValue, jellyValue, worldSizeX, textPlace) {1323 this.scoreUI = game.add.text(600, 500, currentValue + ' < ' + jellyValue, {1324 fill: "#5b2447",1325 align: "center"1326 });1327 this.scoreUI.fixedToCamera = true;1328 this.scoreUI.cameraOffset.setTo(worldSizeX - 160, 10 + textPlace);1329 this._addPoints();1330 },1331 //add score 100 for each eat (capped at 10 eats)1332 //need to animate the enemies to fade them out when they reach 10 eats - to show you cannot interact1333 _addPoints: function(){1334 this.comboCount = 100 + (this.gameState.combo * 50);1335 this.gameState.points += this.comboCount;1336 this.pointsText.setText(this.gameState.points);1337 this.checkCombo();1338 this.gameState.combo +=1;1339 // console.log('how big is my combo count? ' + this.comboCount );1340 // console.log('how big is my combo count? ' + this.gameState.combo );1341 // console.log('what is my score? ' + this.gameState.points );1342 },1343 checkCombo: function(){1344 this.comboText.setText(this.gameState.combo);1345 },1346 //what happens when you collid with something1347 sharkAttack: function (player, shark, sharkGroup, sharkValue, image) {1348 if (this.gameState.currentValue <= sharkValue) {1349 //this._animationSharkError(this.gameState.currentValue, sharkValue, player);1350 this.died();1351 }1352 else {1353 shark.kill();1354 this._addSharkSolvedMath(this.gameState.currentValue, sharkValue, this.config.worldSizeX, this.gameState.textPlace);1355 this._aniamtionSharkSolvedMath(this.gameState.currentValue, sharkValue, player);1356 this.gameState.textPlace += 21;1357 this.moreLives();1358 this._createMovingObjectAndAddToGroup(sharkGroup, sharkValue, image);1359 }1360 },1361 jellyAttack: function (player, jelly, jellyGroup, jellyValue, image) {1362 if (this.gameState.currentValue >= jellyValue) {1363 //this._animationJellyError(this.gameState.currentValue, jellyValue, player);1364 this.died();1365 }1366 else {1367 jelly.kill();1368 this._addJellySolvedMath(this.gameState.currentValue, jellyValue, this.config.worldSizeX, this.gameState.textPlace);1369 this._aniamtionJellySolvedMath(this.gameState.currentValue, jellyValue, player);1370 this.gameState.textPlace += 21;1371 this.moreLives();1372 this._createMovingObjectAndAddToGroup(jellyGroup, jellyValue, image);1373 }1374 },1375 checkeatsValueCollected: function(eats, eatsObjectGroup, value, textValue, image){1376 var eatsValue = value;1377 if(eatsValue == 'Double'){1378 var possibleValue = this.gameState.currentValue *2;1379 this._eatsCollected(eatsValue, possibleValue, eats, eatsObjectGroup, value, textValue, image);1380 }1381 else if(eatsValue == 'Half'){1382 var possibleValue = this.gameState.currentValue *0.5;1383 this._eatsCollected(eatsValue, possibleValue, eats, eatsObjectGroup, value, textValue, image);1384 }1385 else if(eatsValue == 'Square'){1386 var possibleValue = this.gameState.currentValue * this.gameState.currentValue;1387 this._eatsCollected(eatsValue, possibleValue, eats, eatsObjectGroup, value, textValue, image);1388 }1389 else if(eatsValue == 'Times10'){1390 var possibleValue = this.gameState.currentValue * 10;1391 this._eatsCollected(eatsValue, possibleValue, eats, eatsObjectGroup, value, textValue, image);1392 }1393 else if(eatsValue == 'Divide10'){1394 var possibleValue = this.gameState.currentValue /10;1395 this._eatsCollected(eatsValue, possibleValue, eats, eatsObjectGroup, value, textValue, image);1396 }1397 else if(eatsValue == 'Power10'){1398 var possibleValue = this.gameState.currentValue * 10;1399 this._eatsCollected(eatsValue, possibleValue, eats, eatsObjectGroup, value, textValue, image);1400 }1401 else if(eatsValue == 'Power-10'){1402 var possibleValue = this.gameState.currentValue /10;1403 this._eatsCollected(eatsValue, possibleValue, eats, eatsObjectGroup, value, textValue, image);1404 }1405 //HOW ON EARTH DO YOU WORK OUT ROOTS????? IN A NICE CLEAN FUNCTION D: D: D:1406 else if(eatsValue == 'Root'){1407 if(this.gameState.currentValue == 4){1408 var possibleValue = 21409 this._eatsCollected(eatsValue, possibleValue, eats, eatsObjectGroup, value, textValue, image);1410 }1411 else if(this.gameState.currentValue == 9){1412 var possibleValue = 31413 this._eatsCollected(eatsValue, possibleValue, eats, eatsObjectGroup, value, textValue, image);1414 }1415 else if(this.gameState.currentValue == 16){1416 var possibleValue = 41417 this._eatsCollected(eatsValue, possibleValue, eats, eatsObjectGroup, value, textValue, image);1418 }1419 else if(this.gameState.currentValue == 25){1420 var possibleValue = 51421 this._eatsCollected(eatsValue, possibleValue, eats, eatsObjectGroup, value, textValue, image);1422 }1423 else if(this.gameState.currentValue == 36){1424 var possibleValue = 61425 this._eatsCollected(eatsValue, possibleValue, eats, eatsObjectGroup, value, textValue, image);1426 }1427 else if(this.gameState.currentValue == 49){1428 var possibleValue = 71429 this._eatsCollected(eatsValue, possibleValue, eats, eatsObjectGroup, value, textValue, image);1430 }1431 else if(this.gameState.currentValue == 64){1432 var possibleValue = 81433 this._eatsCollected(eatsValue, possibleValue, eats, eatsObjectGroup, value, textValue, image);1434 }1435 else1436 {1437 console.log('You cannot pick up anymore')1438 }1439 }1440 //else deals with the 'normal' case where eatsValue is an integer and not a string1441 else{1442 var possibleValue = value + this.gameState.currentValue;1443 this._eatsCollected(eatsValue, possibleValue, eats, eatsObjectGroup, value, textValue, image);1444 }1445 },1446 _eatsCollected: function(eatsValue, possibleValue, eats, eatsObjectGroup, value, textValue, image){1447 if( possibleValue >= this.gameState.playerMinValue && possibleValue <= this.gameState.playerMaxValue ){1448 eats.kill();1449 this.gameState.currentValue = possibleValue;1450 this._createStaticObjectAndAddToGroup(eatsObjectGroup, textValue, image);1451 this.gameState.fullUp = false;1452 this.player.frame = 0;1453 }else{1454 this.gameState.fullUp = true;1455 this.player.frame = 2;1456 console.log('You cannot pick up anymore')1457 }1458 this.Number.setText(this.gameState.currentValue);1459 }...

Full Screen

Full Screen

Using AI Code Generation

copy

Full Screen

1var wpt = require('wpt.js');2var wpt = new WebPageTest('www.webpagetest.org');3wpt.initialCount(function(err, data) {4 if (err) {5 console.log(err);6 } else {7 console.log(data);8 }9});10{11 "data": {12 }13}

Full Screen

Using AI Code Generation

copy

Full Screen

1var wpt = require('./wpt.js');2var test = new wpt();3test.initialCount();4module.exports = function() {5 this.initialCount = function() {6 console.log('initial count');7 }8}

Full Screen

Using AI Code Generation

copy

Full Screen

1var wpt = require('./wpt.js');2var count = wpt.initialCount();3console.log("initial count is " + count);4exports.initialCount = function() {5 return 5;6}7var wpt = require('./wpt.js');8var counter = new wpt.Counter();9console.log("initial count is " + counter.getCount());10exports.Counter = function() {11 var count = 5;12 this.getCount = function() {13 return count;14 }15}16var wpt = require('./wpt.js');17var count = wpt.initialCount();18console.log("initial count is " + count);19var initialCount = function() {20 return 5;21}22module.exports = initialCount;23var wpt = require('./wpt.js');24var counter = new wpt();25console.log("initial count is " + counter.getCount());26var Counter = function() {27 var count = 5;28 this.getCount = function() {29 return count;30 }31}32module.exports = Counter;33In this tutorial, we have discussed the Node.js module system. We have discussed how to create a module and how to export objects from a module. We have also discussed how to import a module and use the exported objects in another file. We have also discussed the module.exports object and how to use it to export objects from a

Full Screen

Using AI Code Generation

copy

Full Screen

1var wpt = require('wpt.js');2var initialCount = wpt.initialCount;3var count = initialCount();4console.log(count);5var initialCount = function() {6 return 0;7}8exports.initialCount = initialCount;9require('./wpt.js')10require('./wpt')11require('./wpt')12require('wpt.js')13require('wpt')14require('/wpt')15require('wpt')16require('wpt.js')17require('wpt')18require('wpt.js')19require('./wpt.js')20require('./wpt')21require('./wpt')22require('./wpt')23require('./wpt.js')24require('./wpt')25require('./wpt')26require('./wpt')27require('./wpt.js')28require('./wpt')29require('./wpt')30require('./wpt

Full Screen

Using AI Code Generation

copy

Full Screen

1var wpt = require('./wpt.js');2wpt.initialCount(100);3exports.initialCount = function(initialCount){4}5var wpt = require('./wpt.js');6wpt.initialCount(100);7module.exports.initialCount = function(initialCount){8}9var wpt = require('./wpt.js');10wpt.initialCount(100);11exports.initialCount = function(initialCount){12}13The module.exports and exports objects are initially set to an empty object {} and are

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run wpt automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful