game.min.js 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349
  1. var m_imageList = "brand_logo load_bar load_element number_context number_score medals blink button_ok button_start title brand_copyright ninja bg top scroll shuriken text_ready text_gameover samurai shuriken_shadow indicator gib hp_bar text_hit score_panel new".split(" "),
  2. m_ninjaPool, m_sumonTimer = 0,
  3. m_samurai, m_shuriken, m_shakingTimer = 0,
  4. m_shaking_y = 0,
  5. m_hitDisplay, m_scoreDisplay, m_scoreFont, m_hpDisplay, m_killCount = 0,
  6. m_notification, m_playing = !1,
  7. m_button_ok, m_button_start, m_shurikenIcon, m_title;
  8. function Ninja() {
  9. this.load(img_ninja, 36, 42, 0, 0, 36, 42);
  10. this.addAnim("run", 8, !0, [0, 1]);
  11. this.play("run", !0);
  12. this.hurtTimer = this.level = this.deadTimer = 0;
  13. this.reset = function (a, c, d) {
  14. this.visible = this.active = !0;
  15. this.speedy = 1 + 0.005 * m_killCount;
  16. this.x = Math.floor(a);
  17. this.y = Math.floor(c);
  18. this.deadTimer = 0;
  19. this.level = d
  20. };
  21. var a = 0;
  22. this.update = function (b) {
  23. 0 >= this.deadTimer ? (this.preUpdate(b), 0 < this.hurtTimer && (this.hurtTimer -= 0.2), this.y += this.speedy, 0 == this.currentAnim.currentFrameIndex && (this.y += this.speedy), this.y >
  24. SCREEN_HEIGHT && (this.visible = this.active = !1, m_shuriken.combo = 0, m_shakingTimer = 0.2, 20 <= m_hpDisplay.health && (m_hpDisplay.health -= 20, 0 >= m_hpDisplay.health && (m_shuriken.active = !1, m_shuriken.visible = !1, m_notification.reset(NOTIFY_GAME_OVER)))), m_shuriken.active && !m_shuriken.isAtHost() && 0 >= this.hurtTimer && !(this.x + this.w < m_shuriken.x || this.x > m_shuriken.x + m_shuriken.w || this.y + this.h < m_shuriken.y || this.y > m_shuriken.y + m_shuriken.h) && (a = m_shuriken.level > this.level + 1 ? this.level + 1 : m_shuriken.level, this.level -=
  25. a, m_shuriken.level -= a, 0 > this.level ? this.deadTimer = 1 : this.hurtTimer = 1, m_scoreContextPool.next().reset(this.x + 0.5 * this.w, this.y + 0.5 * this.h, 10 + 5 * m_shuriken.combo, !0), m_scoreDisplay.score += 10 + 5 * m_shuriken.combo, m_shuriken.onTarget()), this.postUpdate(b)) : (this.deadTimer -= 0.2, 0 >= this.deadTimer && (this.visible = this.active = !1, m_killCount++))
  26. };
  27. this.render = function (a, c, d) {
  28. var e = this.currentAnim.currentFrame + 2 * this.level;
  29. if (0 < this.deadTimer || 0 < this.hurtTimer) e = this.currentAnim.currentFrame + 6;
  30. c = Math.round(this.x -
  31. this.offsetX + c);
  32. d = Math.round(this.y - this.offsetY + d);
  33. 0 >= this.deadTimer ? a.drawImage(this.image, this.frames[e].x, this.frames[e].y, this.frameWidth, this.frameHeight, c, d, this.frameWidth, this.frameHeight) : (a.globalAlpha = this.deadTimer, a.drawImage(this.image, this.frames[e].x, this.frames[e].y, this.frameWidth, this.frameHeight, c, d, this.frameWidth, this.frameHeight), a.globalAlpha = 1)
  34. }
  35. }
  36. function Samurai() {
  37. this.load(img_samurai, 42, 48, 0, 0, 42, 48);
  38. this.addAnim("run", 10, !0, [0, 1]);
  39. this.play("run", !0);
  40. this.deadTimer = 0;
  41. this.reset = function (a, b) {
  42. this.visible = this.active = !0;
  43. this.speedy = 2;
  44. this.x = Math.floor(a);
  45. this.y = Math.floor(b);
  46. this.deadTimer = 0
  47. };
  48. this.update = function (a) {
  49. 0 >= this.deadTimer ? (this.preUpdate(a), this.y += this.speedy, 0 == this.currentAnim.currentFrameIndex && (this.y += this.speedy), this.y > SCREEN_HEIGHT - this.h && (this.visible = this.active = !1, m_sumonTimer = 0.01, m_scoreContextPool.next().reset(this.x +
  50. 0.5 * this.w, this.y + 0.5 * this.h, 100, !0), m_scoreDisplay.score += 100), m_shuriken.isAtHost() || this.x + this.w < m_shuriken.x || this.x > m_shuriken.x + m_shuriken.w || this.y + this.h < m_shuriken.y || this.y > m_shuriken.y + m_shuriken.h || (this.deadTimer = 1, m_shuriken.combo = 0, m_shuriken.deactive(), m_sumonTimer = 0.01), this.postUpdate(a)) : (this.deadTimer -= 0.2, 0 >= this.deadTimer && (this.visible = this.active = !1))
  51. };
  52. this.render = function (a, b, c) {
  53. var d = this.currentAnim.currentFrame;
  54. 0 < this.deadTimer && (d = this.currentAnim.currentFrame + 2);
  55. b =
  56. Math.round(this.x - this.offsetX + b);
  57. c = Math.round(this.y - this.offsetY + c);
  58. 0 >= this.deadTimer ? a.drawImage(this.image, this.frames[d].x, this.frames[d].y, this.frameWidth, this.frameHeight, b, c, this.frameWidth, this.frameHeight) : (a.globalAlpha = this.deadTimer, a.drawImage(this.image, this.frames[d].x, this.frames[d].y, this.frameWidth, this.frameHeight, b, c, this.frameWidth, this.frameHeight), a.globalAlpha = 1)
  59. }
  60. }
  61. function Shuriken() {
  62. this.load(img_shuriken, 27, 27, 0, 0, 27, 27);
  63. this.addAnim("spin", 240, !0, [0, 1, 2, 3]);
  64. this.play("spin", !0);
  65. this.needShadow = !0;
  66. this.host_x = 0.5 * SCREEN_WIDTH;
  67. this.host_y = SCREEN_HEIGHT - 2 * img_top.height;
  68. this.onHand = !1;
  69. this.combo = this.cosa = this.sina = 0;
  70. this.targeted = !1;
  71. this.level = 0;
  72. this.reset = function (a, b, c) {
  73. this.x = Math.floor(a);
  74. this.y = Math.floor(b);
  75. this.visible = this.active = !0;
  76. this.speedy = this.speedx = 0;
  77. this.targeted = this.onHand = !1;
  78. this.level = 0;
  79. c && (this.combo = this.cosa = this.sina = 0)
  80. };
  81. this.isAtHost =
  82. function () {
  83. return 0 == this.speedx && 0 == this.speedy
  84. };
  85. this.fireFrom = function () {
  86. this.isAtHost() && (this.onHand ? (10 < m_shuriken.combo ? (this.speedx = 18 * -this.cosa, this.speedy = 18 * -this.sina) : (this.speedx = 12 * -this.cosa, this.speedy = 12 * -this.sina), this.level = 40 < this.combo ? 3 : 20 < this.combo ? 2 : 1) : this.speedy = this.speedx = 0)
  87. };
  88. this.moveTo = function (a, b) {
  89. if (this.isAtHost()) {
  90. var c = m_math.sqrt((a - this.host_x) * (a - this.host_x) + (b - this.host_y) * (b - this.host_y));
  91. 3 < c ? (this.cosa = (a - this.host_x) / c, this.sina = (b - this.host_y) / c, this.x =
  92. Math.floor(this.host_x + 60 * this.cosa - 0.5 * this.h), this.y = Math.floor(this.host_y + 60 * this.sina - 0.5 * this.w), this.onHand = !0) : (this.sina = this.cosa = 0, this.x = this.host_x - 0.5 * this.w, this.y = this.host_y - 0.5 * this.h, this.onHand = !1)
  93. }
  94. };
  95. this.onTarget = function () {
  96. this.combo++;
  97. this.targeted = !0;
  98. 0 >= this.level && this.deactive()
  99. };
  100. this.deactive = function () {
  101. this.visible = this.active = !1;
  102. this.reset(this.host_x - 0.5 * this.w, this.host_y - 0.5 * this.h, !1)
  103. };
  104. this.update = function (a) {
  105. this.preUpdate(a);
  106. !this.isAtHost() && (this.x += this.speedx,
  107. this.y += this.speedy, 1 < this.level && (0 > this.x || this.x > SCREEN_WIDTH - this.w) && (this.speedx = -this.speedx, this.level--), this.y < -this.h || this.x < -this.w || this.y > SCREEN_HEIGHT || this.x > SCREEN_WIDTH) && (this.targeted || (this.combo = 0), this.deactive());
  108. this.postUpdate(a)
  109. };
  110. this.render = function (a, b, c) {
  111. var d = this.currentAnim.currentFrame + this.flip * this.numberOfFrames,
  112. e = Math.round(this.x - this.offsetX + b),
  113. f = Math.round(this.y - this.offsetY + c);
  114. if (this.isAtHost()) {
  115. var g = Math.floor(3 * m_heartBeat.delta);
  116. a.drawImage(img_indicator,
  117. 0, 0, 21, 21, e + 3, f + 27 + g, 21, 21);
  118. a.drawImage(img_indicator, 21, 0, 21, 21, e + 3, f - 21 - g, 21, 21);
  119. a.drawImage(img_indicator, 42, 0, 21, 21, e - 21 - g, f + 3, 21, 21);
  120. a.drawImage(img_indicator, 63, 0, 21, 21, e + 27 + g, f + 3, 21, 21);
  121. if (this.onHand)
  122. for (var g = (this.x + 0.5 * this.w - this.host_x) / 4, k = (this.y + 0.5 * this.h - this.host_y) / 4, h = 0; 4 > h; h++) e = Math.floor(this.host_x + g * h - this.offsetX + b - 4), f = Math.floor(this.host_y + k * h - this.offsetY + c - 4), a.drawImage(img_gib, 0, 0, 9, 9, e, f, 9, 9)
  123. }
  124. e = Math.round(this.x - this.offsetX + b);
  125. f = Math.round(this.y - this.offsetY + c);
  126. this.needShadow && a.drawImage(img_shuriken_shadow, this.frames[d].x, this.frames[d].y, this.frameWidth, this.frameHeight, e, f + 9, this.frameWidth, this.frameHeight);
  127. a.drawImage(this.image, this.frames[d].x, this.frames[d].y, this.frameWidth, this.frameHeight, e, f, this.frameWidth, this.frameHeight)
  128. }
  129. }
  130. function HitDisplay() {
  131. this.update = function () {};
  132. this.render = function (a, b, c) {
  133. a.drawImage(img_text_hit, b - img_text_hit.width, c + 6);
  134. m_scoreFont.write(a, m_shuriken.combo, b - img_text_hit.width - 3, c, !1, 4)
  135. }
  136. }
  137. function ScoreDisplay() {
  138. this.visible = !1;
  139. this.score = 0;
  140. this.render = function (a, b, c) {
  141. m_scoreFont.write(a, this.score, b, c, !1, 8)
  142. }
  143. }
  144. function HPDisplay() {
  145. this.health = 100;
  146. this.render = function (a, b, c) {
  147. a.drawImage(img_hp_bar, b, c);
  148. c = 3 * Math.floor(40 - 0.4 * this.health);
  149. a.fillRect(b + img_hp_bar.width - 6 - c, 12, c, 9)
  150. }
  151. }
  152. var NOTIFY_READY = 0,
  153. NOTIFY_GAME_OVER = 1;
  154. function ScorePanel() {
  155. this.tween = new dot_VarTween;
  156. this.visible = this.active = !1;
  157. this.score = this.state = 0;
  158. try {
  159. this.best = localStorage && localStorage.getItem("assaultBest") ? localStorage.assaultBest : 0
  160. } catch (a) {
  161. this.best = 0
  162. }
  163. this.needNew = !1;
  164. this.medal = new dot_Medal;
  165. this.reset = function () {
  166. // updateShare(m_scoreDisplay.score);
  167. this.x = SCREEN_WIDTH - img_score_panel.width >> 1;
  168. this.y = SCREEN_HEIGHT;
  169. this.tween.reset(this.y, SCREEN_HEIGHT - img_score_panel.height >> 1, EASE_CUBE_INOUT, 0.5);
  170. this.visible = this.active = !0;
  171. this.state =
  172. 0;
  173. this.needNew = !1;
  174. // Play68.setRankingScoreDesc(m_scoreDisplay.score);
  175. };
  176. this.update = function (a) {
  177. if (!this.tween.finished && (this.tween.update(a), 0 == this.state ? this.y = Math.floor(this.tween.delta) : this.score = Math.floor(this.tween.delta), this.tween.finished))
  178. if (0 == this.state) this.tween.reset(0, m_scoreDisplay.score, EASE_CUBE_INOUT, 2), this.state = 1;
  179. else if (1 == this.state) {
  180. if (this.score > this.best) {
  181. this.best = this.score;
  182. this.needNew = !0;
  183. try {
  184. localStorage && localStorage.setItem("assaultBest", this.best)
  185. } catch (c) {}
  186. }
  187. m_button_ok.reset(SCREEN_WIDTH - m_button_ok.w >> 1, SCREEN_HEIGHT -
  188. img_top.height - 60);
  189. m_button_ok.visible = !0;
  190. 2E5 <= this.score ? this.medal.reset(this.x + 48, this.y + 45, 0) : 1E5 <= this.score ? this.medal.reset(this.x + 48, this.y + 45, 1) : 5E4 <= this.score ? this.medal.reset(this.x + 48, this.y + 45, 2) : 25E3 <= this.score && this.medal.reset(this.x + 48, this.y + 45, 3)
  191. }
  192. this.medal.active && this.medal.update(a);
  193. m_button_ok.active && (m_button_ok.update(a), m_button_ok.justReleased && 1 == this.state && (m_effect.reset(EFFECT_FADE_IN, 0.25, 1), this.state = 2))
  194. };
  195. this.render = function (a, c, d) {
  196. a.drawImage(img_score_panel,
  197. this.x, this.y);
  198. m_scoreFont.write(a, this.score, this.x + 309, this.y + 33, !1, 8);
  199. m_scoreFont.write(a, this.best, this.x + 309, this.y + 96, !1, 8);
  200. this.needNew && a.drawImage(img_new, this.x + 204, this.y + 72);
  201. this.medal.visible && this.medal.render(a, c, d);
  202. m_button_ok.visible && (m_button_ok.render(a, c, d), m_shurikenIcon.preUpdate(0.03), m_shurikenIcon.x = m_button_ok.x - 9 - m_shurikenIcon.w, m_shurikenIcon.y = m_button_ok.y + 6, m_shurikenIcon.render(a, c, d), m_shurikenIcon.x = m_button_ok.x + m_button_ok.w + 9, m_shurikenIcon.y = m_button_ok.y + 6,
  203. m_shurikenIcon.render(a, c, d))
  204. }
  205. }
  206. function Notification() {
  207. this.textImage = null;
  208. this.tween = new dot_VarTween;
  209. this.state = 0;
  210. this.visible = this.active = !1;
  211. this.scorePanel = new ScorePanel;
  212. this.reset = function (a) {
  213. a == NOTIFY_READY ? (this.textImage = img_text_ready, this.stay = !1) : (this.textImage = img_text_gameover, this.stay = !0);
  214. this.tween.reset(0, 1, EASE_CUBE_INOUT, 1);
  215. this.state = 0;
  216. this.visible = this.active = !0;
  217. this.scorePanel.active = !1;
  218. this.scorePanel.visible = !1
  219. };
  220. this.update = function (a) {
  221. this.active && (this.tween.finished || (this.tween.update(a), this.tween.finished &&
  222. (0 == this.state ? (this.tween.reset(0, 1, EASE_CUBE_INOUT, 1), this.state = 1) : 1 == this.state ? this.stay ? (this.tween.reset(SCREEN_HEIGHT - img_scroll.height >> 1, (SCREEN_HEIGHT - 144 >> 1) - img_scroll.height - 18, EASE_CUBE_INOUT, 0.25), this.state = 3, this.scorePanel.reset()) : (this.tween.reset(1, 0, EASE_CUBE_INOUT, 0.5), this.state = 2) : 2 == this.state ? (this.active = this.visible = !1, m_playing = !0) : 3 == this.state && (this.state = 4))), this.scorePanel.active && this.scorePanel.update(a))
  223. };
  224. this.render = function (a, b, c) {
  225. this.visible && (0 == this.state ||
  226. 2 == this.state ? (a.globalAlpha = this.tween.delta, a.drawImage(img_scroll, SCREEN_WIDTH - img_scroll.width >> 1, SCREEN_HEIGHT - img_scroll.height >> 1), a.drawImage(this.textImage, SCREEN_WIDTH - this.textImage.width >> 1, SCREEN_HEIGHT - this.textImage.height >> 1), a.globalAlpha = 1) : 1 == this.state ? (a.drawImage(img_scroll, SCREEN_WIDTH - img_scroll.width >> 1, SCREEN_HEIGHT - img_scroll.height >> 1), a.drawImage(this.textImage, SCREEN_WIDTH - this.textImage.width >> 1, SCREEN_HEIGHT - this.textImage.height >> 1)) : 3 == this.state ? (a.drawImage(img_scroll,
  227. SCREEN_WIDTH - img_scroll.width >> 1, Math.floor(this.tween.delta)), a.drawImage(this.textImage, SCREEN_WIDTH - this.textImage.width >> 1, Math.floor(this.tween.delta) + (img_scroll.height - this.textImage.height >> 1)), this.scorePanel.render(a, b, c)) : 4 == this.state && (a.drawImage(img_scroll, SCREEN_WIDTH - img_scroll.width >> 1, (SCREEN_HEIGHT - 144 >> 1) - img_scroll.height - 18), a.drawImage(this.textImage, SCREEN_WIDTH - this.textImage.width >> 1, (SCREEN_HEIGHT - 144 >> 1) - img_scroll.height - 18 + (img_scroll.height - this.textImage.height >> 1)),
  228. this.scorePanel.render(a, b, c)))
  229. }
  230. }
  231. function Title() {
  232. this.tween = new dot_VarTween;
  233. this.visible = this.active = !1;
  234. this.w = img_title.width;
  235. this.h = img_title.height;
  236. this.x = SCREEN_WIDTH - this.w >> 1;
  237. this.y = -this.h;
  238. this.reset = function () {
  239. this.y = -this.h;
  240. this.tween.reset(-this.h, (SCREEN_HEIGHT >> 1) - this.h, EASE_CUBE_INOUT, 0.25);
  241. this.visible = this.active = !0;
  242. };
  243. this.update = function (a) {
  244. this.tween.finished || (this.tween.update(a), this.y = Math.floor(this.tween.delta))
  245. };
  246. this.render = function (a) {
  247. a.drawImage(img_title, this.x, this.y);
  248. a.drawImage(img_brand_copyright,
  249. SCREEN_WIDTH - img_brand_copyright.width >> 1, SCREEN_HEIGHT - (img_top.height - img_brand_copyright.height >> 1) - img_brand_copyright.height)
  250. }
  251. }
  252. this.gameUpdate = function (a) {
  253. if (m_playing) {
  254. if (0 < m_sumonTimer && (m_sumonTimer -= a, 0 >= m_sumonTimer)) {
  255. m_sumonTimer = 0.5 + 1 * Math.random();
  256. var b = m_ninjaPool.next(),
  257. c = Math.random();
  258. c < 0.001 * m_killCount ? b.reset(Math.random() * (SCREEN_WIDTH - b.w), -b.h, 2) : c < 0.005 * m_killCount ? b.reset(Math.random() * (SCREEN_WIDTH - b.w), -b.h, 1) : b.reset(Math.random() * (SCREEN_WIDTH - b.w), -b.h, 0)
  259. }
  260. m_samurai.active && (m_samurai.update(a), m_samurai.visible && m_samurai.render(m_fgObjectContext, 0, 0))
  261. }
  262. m_ninjaPool.update(a);
  263. m_ninjaPool.render(m_fgObjectContext,
  264. 0, 0);
  265. m_fgObjectContext.drawImage(img_top, Math.floor(0.5 * (SCREEN_WIDTH - img_top.width)), SCREEN_HEIGHT - img_top.height + m_shaking_y);
  266. m_playing && (m_scoreDisplay.visible && (m_scoreDisplay.render(m_fgObjectContext, SCREEN_WIDTH - 6, 6), 1 < m_shuriken.combo && (m_hitDisplay.update(a), m_hitDisplay.render(m_fgObjectContext, SCREEN_WIDTH - 6, SCREEN_HEIGHT - img_text_hit.height - 12)), m_hpDisplay.render(m_fgObjectContext, 6, 6)), 0 < m_shakingTimer && (m_shakingTimer -= a, m_shaking_y = 0 >= m_shakingTimer ? 0 : Math.floor(6 * Math.random())));
  267. m_playing && m_shuriken.active && 0 < m_hpDisplay.health && (m_shuriken.update(a), m_shuriken.render(m_fgObjectContext, 0, 0));
  268. m_notification.active && (m_notification.update(a), m_notification.render(m_fgObjectContext, 0, 0));
  269. m_button_start.active && (m_title.update(a), m_title.render(m_fgObjectContext, 0, 0), m_button_start.update(a), m_button_start.render(m_fgObjectContext, 0, 0), m_shurikenIcon.preUpdate(0.03), m_shurikenIcon.x = m_button_start.x - 9 - m_shurikenIcon.w, m_shurikenIcon.y = m_button_start.y + 6, m_shurikenIcon.render(m_fgObjectContext,
  270. 0, 0), m_shurikenIcon.x = m_button_start.x + m_button_start.w + 9, m_shurikenIcon.y = m_button_start.y + 6, m_shurikenIcon.render(m_fgObjectContext, 0, 0), m_button_start.justReleased && m_effect.finished && m_effect.reset(EFFECT_FADE_IN, 0.25, 3));
  271. m_effect.finished && (1 == m_effect.info ? (gameInit(), m_effect.reset(EFFECT_FADE_OUT, 0.25, 2)) : 3 == m_effect.info && (m_notification.reset(NOTIFY_READY), adRemove(), m_title.active = !1, m_title.visible = !1, m_button_start.active = !1, m_button_start.visible = !1, m_shuriken.reset(0.5 * (SCREEN_WIDTH -
  272. m_shuriken.w), SCREEN_HEIGHT - 2 * img_top.height), m_effect.reset(EFFECT_FADE_OUT, 0.25, 4)))
  273. };
  274. this.gameInit = function () {
  275. Ninja.prototype = new dot_Sprite;
  276. Ninja.prototype.constructor = Ninja;
  277. Samurai.prototype = new dot_Sprite;
  278. Samurai.prototype.constructor = Samurai;
  279. Shuriken.prototype = new dot_Sprite;
  280. Shuriken.prototype.constructor = Shuriken;
  281. m_scoreFont = new dot_NumberFont;
  282. m_scoreFont.load(img_number_score, 24, 30);
  283. m_scoreDisplay = new ScoreDisplay;
  284. m_scoreDisplay.visible = !0;
  285. m_scoreDisplay.score = 0;
  286. m_hitDisplay = new HitDisplay;
  287. m_hpDisplay = new HPDisplay;
  288. m_ninjaPool = new dot_ObjectPool;
  289. m_ninjaPool.create(Ninja, 30);
  290. m_ninjaPool.needUpdateReverse = !0;
  291. m_samurai = new Samurai;
  292. m_samurai.reset(0.5 * (SCREEN_WIDTH - m_samurai.w), -m_samurai.h);
  293. m_shuriken = new Shuriken;
  294. m_shuriken.reset(0.5 * (SCREEN_WIDTH - m_shuriken.w), SCREEN_HEIGHT - 2 * img_top.height);
  295. m_backgroundContext.drawImage(img_bg, 0, Math.floor(0.5 * (SCREEN_HEIGHT - img_bg.height)));
  296. m_notification = new Notification;
  297. m_button_ok = new dot_Button;
  298. m_button_ok.create(img_button_ok, img_button_ok.width, img_button_ok.height);
  299. m_button_start = new dot_Button;
  300. m_button_start.create(img_button_start,
  301. img_button_start.width, img_button_start.height);
  302. m_button_start.reset(SCREEN_WIDTH - m_button_start.w >> 1, SCREEN_HEIGHT - img_top.height - 60);
  303. m_button_start.visible = !0;
  304. m_title = new Title;
  305. m_title.reset();
  306. m_playing = !1;
  307. m_killCount = m_sumonTimer = 0;
  308. m_shurikenIcon = new dot_Sprite;
  309. m_shurikenIcon.load(img_shuriken, 27, 27, 0, 0, 27, 27);
  310. m_shurikenIcon.addAnim("spin", 240, !0, [0, 1, 2, 3]);
  311. m_shurikenIcon.play("spin", !0);
  312. m_shurikenIcon.reset(10, 10);
  313. m_fgObjectContext.fillStyle = "#000000"
  314. };
  315. this.touchPressed = function (a) {
  316. var b;
  317. 0 < a.targetTouches.length && (b = a.targetTouches[0].pageX - m_backgroundCanvas.offsetLeft, a = a.targetTouches[0].pageY - m_backgroundCanvas.offsetTop, m_shuriken.active && m_shuriken.moveTo(b, a), m_button_ok.active && b > m_button_ok.x && b < m_button_ok.x + m_button_ok.w && a > m_button_ok.y && a < m_button_ok.y + m_button_ok.h && (m_button_ok.pressing = !0), m_button_start.active && b > m_button_start.x && b < m_button_start.x + m_button_start.w && a > m_button_start.y && a < m_button_start.y + m_button_start.h && (m_button_start.pressing = !0))
  318. };
  319. this.touchReleased = function (a) {
  320. var b;
  321. 0 < a.changedTouches.length && (b = a.changedTouches[0].pageX - m_backgroundCanvas.offsetLeft, a = a.changedTouches[0].pageY - m_backgroundCanvas.offsetTop, m_shuriken && m_shuriken.active && m_shuriken.fireFrom(b, a), m_button_ok && m_button_ok.active && b > m_button_ok.x && b < m_button_ok.x + m_button_ok.w && a > m_button_ok.y && a < m_button_ok.y + m_button_ok.h && (m_button_ok.pressing = !1), m_button_start && m_button_start.active && b > m_button_start.x && b < m_button_start.x + m_button_start.w && a > m_button_start.y && a <
  322. m_button_start.y + m_button_start.h && (m_button_start.pressing = !1))
  323. };
  324. this.mousePressed = function (a) {
  325. var b;
  326. b = a.pageX - m_backgroundCanvas.offsetLeft;
  327. a = a.pageY - m_backgroundCanvas.offsetTop;
  328. m_shuriken && m_shuriken.active && m_shuriken.moveTo(b, a);
  329. m_button_ok && m_button_ok.active && b > m_button_ok.x && b < m_button_ok.x + m_button_ok.w && a > m_button_ok.y && a < m_button_ok.y + m_button_ok.h && (m_button_ok.pressing = !0);
  330. m_button_start && m_button_start.active && b > m_button_start.x && b < m_button_start.x + m_button_start.w && a > m_button_start.y && a < m_button_start.y + m_button_start.h && (m_button_start.pressing = !0)
  331. };
  332. this.mouseReleased = function (a) {
  333. var b;
  334. b = a.pageX - m_backgroundCanvas.offsetLeft;
  335. a = a.pageY - m_backgroundCanvas.offsetTop;
  336. m_shuriken && m_shuriken.active && m_shuriken.fireFrom(b, a);
  337. m_button_ok && m_button_ok.active && b > m_button_ok.x && b < m_button_ok.x + m_button_ok.w && a > m_button_ok.y && a < m_button_ok.y + m_button_ok.h && (m_button_ok.pressing = !1);
  338. m_button_start && m_button_start.active && b > m_button_start.x && b < m_button_start.x + m_button_start.w && a > m_button_start.y && a < m_button_start.y + m_button_start.h && (m_button_start.pressing = !1)
  339. };