Advertisement
XArnonX

abstract-image

Feb 16th, 2018
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. var AbstractImage = (function () {
  2.  
  3.   'use strict';
  4.  
  5.  
  6.   function Class(game, map) {
  7.     // references
  8.     this.gameReference = game;
  9.     this.mapReference = map;
  10.  
  11.     this.className = 'AbstractImage';
  12.  
  13.     // properties
  14.     this.image = null;
  15.     this.imageName = null;
  16.     this.imagePath = null;
  17.  
  18.   }
  19.  
  20.  
  21.   // public api
  22.   Class.prototype = {
  23.     // tile management methods
  24.     getTileX: getTileX,
  25.     getTileY: getTileY
  26.   };
  27.  
  28.   return Class;
  29.  
  30.  
  31.   // private methods
  32.  
  33.  
  34.   function getTileX(tileXId) {
  35.     return (ImageConstants.Anchor.X * ImageConstants.SIZE) + (tileXId * ImageConstants.SIZE);
  36.   }
  37.  
  38.   function getTileY(tileYId) {
  39.     return (ImageConstants.Anchor.Y * ImageConstants.SIZE) + (tileYId * ImageConstants.SIZE);
  40.   }
  41.  
  42.  
  43. })();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement