Guest User

Untitled

a guest
Jul 21st, 2018
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.89 KB | None | 0 0
  1. diff --git a/web/js/game.js b/web/js/game.js
  2. index ee569f7..aff43b3 100644
  3. --- a/web/js/game.js
  4. +++ b/web/js/game.js
  5. @@ -169,7 +169,7 @@ $(function(){
  6. .addSprite( "walk_left", {posx: 0, posy: 0, width: PLAYER_WIDTH, height: PLAYER_HEIGHT} )
  7. .addSprite( "walk_right", {posx: 0, posy: 0, width: PLAYER_WIDTH, height: PLAYER_HEIGHT} );
  8.  
  9. -
  10. + var _handle;
  11. var _anims = [
  12. {
  13. name: 'player-c64',
  14. @@ -201,12 +201,15 @@ $(function(){
  15. imageURL: "/img/game/snaps/"+(Math.floor(Math.random()*155)+1)+".png",
  16. type: $.gameQuery.ANIMATION_CALLBACK
  17. });
  18. - setTimeout( function() {
  19. - $("#c64").setAnimation(
  20. - _anims[0].anim_sets[0].anims[2].animation,
  21. - _anims[0].anim_sets[0].anims[2].callback
  22. - );
  23. - }, 3000);
  24. + if( !_handle ){
  25. + _handle = setTimeout( function() {
  26. + $("#c64").setAnimation(
  27. + _anims[0].anim_sets[0].anims[2].animation,
  28. + _anims[0].anim_sets[0].anims[2].callback
  29. + );
  30. + _handle = undefined;
  31. + }, 3000);
  32. + }
  33. },
  34. animation: new $.gameQuery.Animation({
  35. imageURL: "/img/game/decrunch.png",
  36. @@ -218,12 +221,15 @@ $(function(){
  37. },
  38. {
  39. x: 832, y: 230, w: 102, h:64, callback: function(){
  40. - setTimeout( function() {
  41. - $("#c64").setAnimation(
  42. - _anims[0].anim_sets[0].anims[0].animation,
  43. - _anims[0].anim_sets[0].anims[0].callback
  44. - );
  45. - }, 10000);
  46. + if( !_handle ){
  47. + _handle = setTimeout( function() {
  48. + $("#c64").setAnimation(
  49. + _anims[0].anim_sets[0].anims[0].animation,
  50. + _anims[0].anim_sets[0].anims[0].callback
  51. + );
  52. + _handle = undefined;
  53. + }, 10000);
  54. + }
  55. },
  56. animation: new $.gameQuery.Animation({
  57. imageURL: "/img/game/snaps/"+(Math.floor(Math.random()*155)+1)+".png",
Add Comment
Please, Sign In to add comment