globals_tokens.js 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299
  1. const baseUrl = './assets/img/'; // Base directory for media
  2. const fallbackImgUrl = './assets/img/fallback.png';
  3. /**
  4. * Preset colors for graphic elements.
  5. * @type {object}
  6. */
  7. const colors = {
  8. // Blues
  9. blueDark: '#02277d', // Line color that indicates right and fraction numbers
  10. blue: '#003cb3', // Subtitle
  11. blueLight: '#92b3e8', //'#a4c6fc',
  12. blueBg: '#cce5ff', // Background color
  13. blueBgInsideLevel: '#a8c0e6', // Background color in squareOne (used for floor gap)
  14. blueMenuLine: '#b7cdf4',
  15. // Reds
  16. redLight: '#d27979', // squareTwo figures
  17. red: '#b30000', // Linecolor that indicates left
  18. redDark: '#730101', // squareTwo figures and some titles
  19. maroon: '#330000', // squareTwo figures and some titles
  20. // Greens
  21. greenLight: '#79d2a1', // squareTwo figures
  22. green: '#00804d', // Title
  23. greenDark: '#005231', // squareTwo figures
  24. // Basics
  25. white: '#fff',
  26. gray: '#1f1f1f',
  27. black: '#000',
  28. brown: '#5a3e0d',
  29. };
  30. const font = {
  31. sizes: {
  32. h1: '48px',
  33. h2: '42px',
  34. h3: '38px',
  35. h4: '36px',
  36. p: '30px',
  37. display: '62px',
  38. },
  39. families: {
  40. default: 'Arial, sans-serif',
  41. btn: 'Arial, sans-serif',
  42. fraction: 'monospace',
  43. },
  44. };
  45. /**
  46. * Preset text styles for game text.<br>
  47. * Contains: font, size, text color and text align.
  48. * @type {object}
  49. */
  50. const textStyles = {
  51. h1_: {
  52. font: `${font.sizes.h1} ${font.families.default}`,
  53. align: 'center',
  54. fill: colors.blue,
  55. },
  56. h2_: {
  57. font: `${font.sizes.h2} ${font.families.default}`,
  58. align: 'center',
  59. fill: colors.blue,
  60. },
  61. h3_: {
  62. font: `${font.sizes.h3} ${font.families.default}`,
  63. align: 'center',
  64. fill: colors.blue,
  65. },
  66. h4_: {
  67. font: `${font.sizes.h4} ${font.families.default}`,
  68. align: 'center',
  69. fill: colors.blue,
  70. },
  71. p_: {
  72. font: `${font.sizes.p} ${font.families.default}`,
  73. align: 'center',
  74. fill: colors.maroon,
  75. },
  76. btn: {
  77. font: `${font.sizes.h2} ${font.families.btn}`,
  78. align: 'center',
  79. fill: colors.white,
  80. increaseLetterSpacing: true,
  81. },
  82. btnLg: {
  83. font: `${font.sizes.h1} ${font.families.btn}`,
  84. align: 'center',
  85. fill: colors.white,
  86. increaseLetterSpacing: true,
  87. },
  88. fraction: {
  89. font: `${font.sizes.display} ${font.families.fraction}`,
  90. align: 'left',
  91. fill: colors.blue,
  92. },
  93. };
  94. /**
  95. * List of URL for all media in the game
  96. * divided 1st by the 'state' that loads the media
  97. * and 2nd by the 'media type' for that state.
  98. *
  99. * @type {object}
  100. */
  101. const url = {
  102. /**
  103. * url.<state>
  104. * where <state> can be: boot, menu, squareOne, squareTwo, circleOne.
  105. */
  106. boot: {
  107. /**
  108. * url.<state>.<media type>
  109. * where <media type> can be: image, sprite, audio <br><br>
  110. *
  111. * image: [ [name, source], ... ] <br>
  112. * sprite: [ [name, source, number of frames], ... ] <br>
  113. * audio: [ [name, [source, alternative source] ], ... ]
  114. */
  115. image: [
  116. ['fallback', fallbackImgUrl],
  117. // scene new level
  118. ['floor_stone_left', baseUrl + 'scene/new_level/floor_stone_left.png'],
  119. ['floor_stone_right', baseUrl + 'scene/new_level/floor_stone_right.png'],
  120. ['floor_stone', baseUrl + 'scene/new_level/floor_stone.png'],
  121. ['wood_shelf', baseUrl + 'scene/new_level/wood_shelf.png'],
  122. ['bg_snow', baseUrl + 'scene/new_level/bg_snow.png'],
  123. // Scene
  124. ['bg_default', baseUrl + 'scene/bg_default.jpg'],
  125. ['bg_map', baseUrl + 'scene/bg_map.png'],
  126. ['bush', baseUrl + 'scene/bush.png'],
  127. ['cloud', baseUrl + 'scene/cloud.png'],
  128. ['flag_red', baseUrl + 'scene/flag_red.png'],
  129. ['flag_green', baseUrl + 'scene/flag_green.png'],
  130. ['floor_grass', baseUrl + 'scene/floor_grass.png'],
  131. ['floor_grass_1', baseUrl + 'scene/floor_grass_1.png'],
  132. ['floor_grass_2', baseUrl + 'scene/floor_grass_2.png'],
  133. ['floor_grass_4', baseUrl + 'scene/floor_grass_3.png'],
  134. ['floor_grass_part_1', baseUrl + 'scene/floor_grass_part_1.png'],
  135. ['floor_grass_part_2', baseUrl + 'scene/floor_grass_part_2.png'],
  136. ['floor_grass_part_4', baseUrl + 'scene/floor_grass_part_3.png'],
  137. ['floor_dirt', baseUrl + 'scene/floor_dirt.png'],
  138. ['floor_dirt_1', baseUrl + 'scene/floor_dirt_1.png'],
  139. ['floor_dirt_2', baseUrl + 'scene/floor_dirt_2.png'],
  140. ['floor_dirt_4', baseUrl + 'scene/floor_dirt_3.png'],
  141. ['floor_road', baseUrl + 'scene/floor_road.png'],
  142. ['rock', baseUrl + 'scene/rock.png'],
  143. ['progress_bar_tile', baseUrl + 'scene/progress_bar_tile.png'],
  144. ['sign', baseUrl + 'scene/sign.png'],
  145. ['sign_broken', baseUrl + 'scene/sign_broken.png'],
  146. ['tree_1', baseUrl + 'scene/tree_1.png'],
  147. ['tree_2', baseUrl + 'scene/tree_2.png'],
  148. ['tree_3', baseUrl + 'scene/tree_3.png'],
  149. ['tree_4', baseUrl + 'scene/tree_4.png'],
  150. // Flags
  151. ['flag_BR', baseUrl + 'flags/br.png'],
  152. ['flag_FR', baseUrl + 'flags/fr.png'],
  153. ['flag_IT', baseUrl + 'flags/it.png'],
  154. ['flag_ES', baseUrl + 'flags/es.png'],
  155. ['flag_US', baseUrl + 'flags/us.png'],
  156. // Navigation icons on the top of the page
  157. ['back', baseUrl + 'icons_navigation/back.png'],
  158. ['show_answer', baseUrl + 'icons_navigation/show_solution.png'],
  159. ['home', baseUrl + 'icons_navigation/home.png'],
  160. ['lang', baseUrl + 'icons_navigation/language.png'],
  161. ['menu', baseUrl + 'icons_navigation/menu.png'],
  162. // Interactive icons
  163. ['answer_correct', baseUrl + 'icons_interactive/answer_correct.png'],
  164. ['answer_wrong', baseUrl + 'icons_interactive/answer_wrong.png'],
  165. ['arrow_down', baseUrl + 'icons_interactive/arrow_down.png'],
  166. // ['close', baseUrl + 'icons_interactive/close.png'],
  167. ['info', baseUrl + 'icons_interactive/info.png'],
  168. ['pointer', baseUrl + 'icons_interactive/pointer.png'],
  169. // Menu icons - Games
  170. ['game_0', baseUrl + 'icons_menu/squareOne.png'], // Square I
  171. ['game_1', baseUrl + 'icons_menu/circleOne.png'], // Circle I
  172. ['game_2', baseUrl + 'icons_menu/squareTwo.png'], // Square II
  173. ['game_3', baseUrl + 'icons_menu/scaleOne.png'], // Scale I
  174. // Menu icons - Info box
  175. ['c1-A', baseUrl + 'info_box/c1-A.png'],
  176. ['c1-A-h', baseUrl + 'info_box/c1-A-h.png'],
  177. ['c1-B-h', baseUrl + 'info_box/c1-B-h.png'],
  178. ['c1-diff-1', baseUrl + 'info_box/c1-diff-1.png'],
  179. ['c1-diff-5', baseUrl + 'info_box/c1-diff-5.png'],
  180. ['c1-label', baseUrl + 'info_box/c1-label.png'],
  181. ['map-c1s2', baseUrl + 'info_box/map-c1s2.png'],
  182. ['map-s1', baseUrl + 'info_box/map-s1.png'],
  183. ['s1-A', baseUrl + 'info_box/s1-A.png'],
  184. ['s1-A-h', baseUrl + 'info_box/s1-A-h.png'],
  185. ['s1-B-h', baseUrl + 'info_box/s1-B-h.png'],
  186. ['s1-diff-1', baseUrl + 'info_box/s1-diff-1.png'],
  187. ['s1-diff-3', baseUrl + 'info_box/s1-diff-3.png'],
  188. ['s1-label', baseUrl + 'info_box/s1-label.png'],
  189. ['s2', baseUrl + 'info_box/s2.png'],
  190. ['s2-A-h', baseUrl + 'info_box/s2-A-h.png'],
  191. ['s2-B-h', baseUrl + 'info_box/s2-B-h.png'],
  192. ['s2-diff-1', baseUrl + 'info_box/s2-diff-1.png'],
  193. ['s2-diff-5', baseUrl + 'info_box/s2-diff-5.png'],
  194. ['s2-label', baseUrl + 'info_box/s2-label.png'],
  195. ['op_plus', baseUrl + 'info_box/op_plus.png'],
  196. ['op_min', baseUrl + 'info_box/op_min.png'],
  197. ['op_mix', baseUrl + 'info_box/op_mix.png'],
  198. ['op_eq', baseUrl + 'info_box/op_eq.png'],
  199. ],
  200. sprite: [
  201. // scene
  202. ['map_place', baseUrl + 'scene/map_place.png', 2],
  203. // Game Sprites
  204. ['kid_walking', baseUrl + 'characters/kid/walking.png', 26],
  205. // Navigation icons on the top of the page
  206. ['audio', baseUrl + 'icons_navigation/audio.png', 2],
  207. // Interactive icons
  208. ['select_input', baseUrl + 'icons_interactive/select_input.png', 2],
  209. ['btn_square', baseUrl + 'icons_interactive/btn_square.png', 2],
  210. // Menu icons - Game modes
  211. ['mode_0', baseUrl + 'icons_menu/squareOne_1.png', 2], // Square I : A
  212. ['mode_1', baseUrl + 'icons_menu/squareOne_2.png', 2], // Square I : B
  213. ['mode_2', baseUrl + 'icons_menu/circleOne_1.png', 2], // Circle I : A
  214. ['mode_3', baseUrl + 'icons_menu/circleOne_2.png', 2], // Circle I : B
  215. ['mode_4', baseUrl + 'icons_menu/squareTwo_1.png', 2], // Square II : A
  216. ['mode_5', baseUrl + 'icons_menu/squareTwo_2.png', 2], // Square II : B
  217. ['mode_6', baseUrl + 'icons_menu/scaleOne_1.png', 2], // Scale I : A
  218. // Menu icons - Math operations
  219. ['operation_plus', baseUrl + 'icons_menu/operation_plus.png', 2],
  220. ['operation_minus', baseUrl + 'icons_menu/operation_minus.png', 2],
  221. ['operation_mixed', baseUrl + 'icons_menu/operation_mixed.png', 2],
  222. ['operation_equals', baseUrl + 'icons_menu/operation_equals.png', 2],
  223. ],
  224. audio: [
  225. // Sound effects
  226. ['beepSound', ['./assets/audio/beep.ogg', './assets/audio/beep.mp3']],
  227. ['okSound', ['./assets/audio/ok.ogg', './assets/audio/ok.mp3']],
  228. ['errorSound', ['./assets/audio/error.ogg', './assets/audio/error.mp3']],
  229. ['popSound', ['', './assets/audio/pop.wav']],
  230. ],
  231. },
  232. squareOne: {
  233. image: [
  234. // Map buildings
  235. ['farm', baseUrl + 'scene/building_farm.png'],
  236. ['garage', baseUrl + 'scene/building_garage.png'],
  237. ],
  238. sprite: [
  239. // Game sprites
  240. ['tractor', baseUrl + 'characters/tractor/tractor.png', 15],
  241. ],
  242. audio: [],
  243. },
  244. squareTwo: {
  245. image: [
  246. // Map buildings
  247. ['house', baseUrl + 'scene/building_house.png'],
  248. ['school', baseUrl + 'scene/building_school.png'],
  249. ],
  250. sprite: [
  251. // Game sprites
  252. ['kid_standing', baseUrl + 'characters/kid/lost.png', 6],
  253. ['kid_running', baseUrl + 'characters/kid/running.png', 12],
  254. ],
  255. audio: [],
  256. },
  257. circleOne: {
  258. image: [
  259. // Map buildings
  260. ['house', baseUrl + 'scene/building_house.png'],
  261. ['school', baseUrl + 'scene/building_school.png'],
  262. // Game images
  263. ['balloon', baseUrl + 'characters/balloon/balloon.png'],
  264. ['balloon_basket', baseUrl + 'characters/balloon/balloon_basket.png'],
  265. ],
  266. sprite: [
  267. // Game sprites
  268. ['kid_running', baseUrl + 'characters/kid/running.png', 12],
  269. ],
  270. audio: [],
  271. },
  272. scaleOne: {
  273. image: [
  274. // Map buildings
  275. ['farm', baseUrl + 'scene/building_farm.png'],
  276. ['garage', baseUrl + 'scene/building_garage.png'],
  277. // Game images
  278. ['scale_base', baseUrl + 'characters/scale/scale_base.png'],
  279. ['scale_arm', baseUrl + 'characters/scale/scale_arm.png'],
  280. ['scale_plate', baseUrl + 'characters/scale/scale_plate.png'],
  281. ],
  282. sprite: [
  283. // Map buildings
  284. ['tractor', baseUrl + 'characters/tractor/tractor.png', 15],
  285. ['floor_snow', baseUrl + 'scene/new_level/floor_snow.png', 9],
  286. ],
  287. audio: [],
  288. },
  289. };