Advertisement
Guest User

Untitled

a guest
Oct 6th, 2012
107
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // The fishspot is the exact spot where fish will spawn in order to be *fished* by humans.
  2.  
  3. ig.module (
  4.     'game.entities.fishspot'
  5. )
  6. .requires (
  7.     'impact.entity'
  8. )
  9. .defines (function() {
  10.     EntityFishspot = ig.Entity.extend( {
  11.         size: {x: 32, y: 32}, // The size of the Sprite (not the spritesheet).
  12.         type: ig.Entity.TYPE.A, // Useful to check collitions against entities.
  13.         checkAgainst: ig.Entity.TYPE.NONE, // We're not checking it against anything.
  14.         collides: ig.Entity.COLLIDES.PASSIVE, // N1NJ4 COMM3N7
  15.         animSheet: new ig.AnimationSheet('media/fishspot.png',32,32), // Spritesheet PATH, X, Y.
  16.         fishAvailable: 25, // The ammount of fish that CAN be fished by humans.
  17.  
  18.         init: function(x, y, settings, fishAvailable) {
  19.             this.parent(x, y, settings, fishAvailable);
  20.  
  21.             // Create the animations.
  22.             this.addAnim('someFish', .21, [0,1,2,3,4]);
  23.             this.addAnim('noFish', 0, [5]);
  24.             // Set the starting Animation.
  25.             if( fishAvailable > 0) {
  26.                 this.currentAnim = this.anims.someFish;
  27.             } else {
  28.                 this.currentAnim = this.anims.noFish;
  29.             }
  30.         },
  31.  
  32.         // The following is the "Loop" that will update the game constantly in order tu apply updates.
  33.         update: function(fishAvailable) {
  34.             if(fishAvailable > 0) {
  35.                 this.currentAnim = this.anims.someFish;
  36.             } else {
  37.                 this.currentAnim = this.anims.noFish;
  38.             }
  39.             this.parent();
  40.         }
  41.     });
  42. })
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement