globals_tokens.js 9.9 KB

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