Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // The fishspot is the exact spot where fish will spawn in order to be *fished* by humans.
- ig.module (
- 'game.entities.fishspot'
- )
- .requires (
- 'impact.entity'
- )
- .defines (function() {
- EntityFishspot = ig.Entity.extend( {
- size: {x: 32, y: 32}, // The size of the Sprite (not the spritesheet).
- type: ig.Entity.TYPE.A, // Useful to check collitions against entities.
- checkAgainst: ig.Entity.TYPE.NONE, // We're not checking it against anything.
- collides: ig.Entity.COLLIDES.PASSIVE, // N1NJ4 COMM3N7
- animSheet: new ig.AnimationSheet('media/fishspot.png',32,32), // Spritesheet PATH, X, Y.
- fishAvailable: 25, // The ammount of fish that CAN be fished by humans.
- init: function(x, y, settings, fishAvailable) {
- this.parent(x, y, settings, fishAvailable);
- // Create the animations.
- this.addAnim('someFish', .21, [0,1,2,3,4]);
- this.addAnim('noFish', 0, [5]);
- // Set the starting Animation.
- if( fishAvailable > 0) {
- this.currentAnim = this.anims.someFish;
- } else {
- this.currentAnim = this.anims.noFish;
- }
- },
- // The following is the "Loop" that will update the game constantly in order tu apply updates.
- update: function(fishAvailable) {
- if(fishAvailable > 0) {
- this.currentAnim = this.anims.someFish;
- } else {
- this.currentAnim = this.anims.noFish;
- }
- this.parent();
- }
- });
- })
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement