spaceinvaders-animations.js 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248
  1. /*
  2. * Copyright (c) 2013 Fabrice ECAILLE aka Febbweiss
  3. *
  4. * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
  5. *
  6. * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
  7. *
  8. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  9. */
  10. var ALIENS_WIDTH = 24,
  11. ALIENS_HEIGHT = 17,
  12. IMAGES_PREFIX = "images/",
  13. EXPLOSION_BIG = IMAGES_PREFIX + "explosion_big.png",
  14. EXPLOSION_BIG_RATE = 50,
  15. EXPLOSION_SMALL = IMAGES_PREFIX + "explosion_small.png",
  16. EXPLOSION_SMALL_RATE = 50;
  17. var EXPLOSIONS = {
  18. BIG : [
  19. {
  20. animation : new $.gQ.Animation({
  21. imageURL : EXPLOSION_BIG,
  22. numberOfFrame : 8,
  23. delta : 128,
  24. rate : EXPLOSION_BIG_RATE,
  25. type : $.gQ.ANIMATION_HORIZONTAL | $.gQ.ANIMATION_CALLBACK
  26. }),
  27. width : 128,
  28. height: 128
  29. },
  30. {
  31. animation : new $.gQ.Animation({
  32. imageURL : EXPLOSION_BIG,
  33. offsety : 128,
  34. numberOfFrame : 8,
  35. delta : 128,
  36. rate : EXPLOSION_BIG_RATE,
  37. type : $.gQ.ANIMATION_HORIZONTAL | $.gQ.ANIMATION_CALLBACK
  38. }),
  39. width : 128,
  40. height: 128
  41. },
  42. {
  43. animation : new $.gQ.Animation({
  44. imageURL : EXPLOSION_BIG,
  45. offsety : 256,
  46. numberOfFrame : 8,
  47. delta : 128,
  48. rate : EXPLOSION_BIG_RATE,
  49. type : $.gQ.ANIMATION_HORIZONTAL | $.gQ.ANIMATION_CALLBACK
  50. }),
  51. width : 128,
  52. height: 128
  53. },
  54. {
  55. animation : new $.gQ.Animation({
  56. imageURL : EXPLOSION_BIG,
  57. offsety : 384,
  58. numberOfFrame : 8,
  59. delta : 128,
  60. rate : EXPLOSION_BIG_RATE,
  61. type : $.gQ.ANIMATION_HORIZONTAL | $.gQ.ANIMATION_CALLBACK
  62. }),
  63. width : 128,
  64. height: 128
  65. },
  66. {
  67. animation : new $.gQ.Animation({
  68. imageURL : EXPLOSION_BIG,
  69. offsety : 512,
  70. numberOfFrame : 8,
  71. delta : 128,
  72. rate : EXPLOSION_BIG_RATE,
  73. type : $.gQ.ANIMATION_HORIZONTAL | $.gQ.ANIMATION_CALLBACK
  74. }),
  75. width : 128,
  76. height: 128
  77. },
  78. {
  79. animation : new $.gQ.Animation({
  80. imageURL : EXPLOSION_BIG,
  81. offsety : 640,
  82. numberOfFrame : 8,
  83. delta : 128,
  84. rate : EXPLOSION_BIG_RATE,
  85. type : $.gQ.ANIMATION_HORIZONTAL | $.gQ.ANIMATION_CALLBACK
  86. }),
  87. width : 128,
  88. height: 128
  89. },
  90. {
  91. animation : new $.gQ.Animation({
  92. imageURL : EXPLOSION_BIG,
  93. offsety : 768,
  94. numberOfFrame : 8,
  95. delta : 128,
  96. rate : EXPLOSION_BIG_RATE,
  97. type : $.gQ.ANIMATION_HORIZONTAL | $.gQ.ANIMATION_CALLBACK | $.gQ.ANIMATION_ONCE
  98. }),
  99. width : 128,
  100. height: 128
  101. },
  102. {
  103. animation : new $.gQ.Animation({
  104. imageURL : EXPLOSION_BIG,
  105. offsety : 896,
  106. numberOfFrame : 8,
  107. delta : 128,
  108. rate : EXPLOSION_BIG_RATE,
  109. type : $.gQ.ANIMATION_HORIZONTAL | $.gQ.ANIMATION_CALLBACK | $.gQ.ANIMATION_ONCE
  110. }),
  111. width : 128,
  112. height: 128
  113. }
  114. ],
  115. SMALL : [
  116. {
  117. animation : new $.gQ.Animation({
  118. imageURL : EXPLOSION_SMALL,
  119. numberOfFrame : 10,
  120. delta : 64,
  121. rate : EXPLOSION_SMALL_RATE,
  122. type : $.gQ.ANIMATION_HORIZONTAL | $.gQ.ANIMATION_CALLBACK | $.gQ.ANIMATION_ONCE
  123. }),
  124. width : 64,
  125. height: 64
  126. }
  127. ]
  128. }
  129. var WORLD = {
  130. farm : {
  131. hero : {
  132. ship : {
  133. animation : new $.gameQuery.Animation({
  134. imageURL : IMAGES_PREFIX + "farm.png"
  135. }),
  136. width : 48,
  137. height : 24,
  138. posx : 0,
  139. posy : 17
  140. },
  141. /*cockpit : {
  142. animation : new $.gameQuery.Animation({
  143. imageURL : IMAGES_PREFIX + "farm.png",
  144. offsety : 24,
  145. offsetx : 20
  146. }),
  147. width : 20,
  148. height : 33,
  149. posx : 28,
  150. posy : 3
  151. },*/
  152. smallWheel : {
  153. animation : new $.gameQuery.Animation({
  154. imageURL : IMAGES_PREFIX + "farm.png",
  155. offsetx : 0,
  156. offsety : 24
  157. }),
  158. posx : 4,
  159. posy : 30,
  160. width: 14,
  161. height: 14
  162. },
  163. bigWheel : {
  164. animation : new $.gameQuery.Animation({
  165. imageURL : IMAGES_PREFIX + "farm.png",
  166. offsetx : 0,
  167. offsety : 38
  168. }),
  169. width : 19,
  170. height : 19,
  171. posx : 25,
  172. posy : 27
  173. }
  174. },
  175. alien : {
  176. animation : new $.gQ.Animation({
  177. imageURL : IMAGES_PREFIX + "invader.png",
  178. numberOfFrame : 2,
  179. delta : ALIENS_WIDTH,
  180. rate : 400,
  181. type : $.gQ.ANIMATION_HORIZONTAL
  182. }),
  183. width : ALIENS_WIDTH,
  184. height : ALIENS_HEIGHT
  185. },
  186. ufo : {
  187. animation: new $.gQ.Animation({imageURL: IMAGES_PREFIX + "ufo.png"}),
  188. width: 48,
  189. height: 32,
  190. posy: 10
  191. },
  192. life : {
  193. animation : new $.gameQuery.Animation({
  194. imageURL : IMAGES_PREFIX + "farm.png",
  195. offsetx : 14,
  196. offsety : 24
  197. }),
  198. width: 32,
  199. height: 16
  200. },
  201. weapons : {
  202. corn : {
  203. animation : new $.gameQuery.Animation({
  204. imageURL : IMAGES_PREFIX + "farm.png",
  205. offsetx : 19,
  206. offsety : 37
  207. }),
  208. width: 19,
  209. height: 19
  210. },
  211. carot : {
  212. animation : new $.gameQuery.Animation({
  213. imageURL : IMAGES_PREFIX + "farm.png",
  214. offsetx : 38,
  215. offsety : 37
  216. }),
  217. width: 19,
  218. height: 19
  219. },
  220. gun : {
  221. animation : new $.gameQuery.Animation({
  222. imageURL : IMAGES_PREFIX + "farm.png",
  223. offsetx : 57,
  224. offsety : 37
  225. }),
  226. width: 19,
  227. height: 19
  228. }
  229. },
  230. backgrounds : {
  231. farm: {
  232. background1 : {
  233. animation : new $.gQ.Animation({
  234. imageURL : IMAGES_PREFIX + "background.png"
  235. })
  236. },
  237. background2 : {
  238. animation : new $.gQ.Animation({
  239. imageURL : IMAGES_PREFIX + "background2.png"
  240. })
  241. }
  242. }
  243. }
  244. }
  245. };