Guest User

Untitled

a guest
Nov 3rd, 2020
45
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.     static renderEntities () {
  2.  
  3.         let entitiesToDraw: Entity[] = GameData.playersList.concat(GameData.enemies)
  4.         entitiesToDraw.sort((a, b) => {
  5.             return a.y - b.y
  6.         })
  7.  
  8.         entitiesToDraw.forEach((entity: Entity) => {
  9.             entity.draw()
  10.         })
  11.     }
  12.  
  13. draw () {
  14.         CTX.drawImage(
  15.             this.image, CYCLE_LOOP[this.currentLoopIndex] * 32,
  16.             this.currentDirection * 48, 32, 48, this.x + GameData.horizontalMargin,
  17.             this.y + GameData.verticalMargin, 32, 48
  18.         );
  19.     }
Advertisement
Add Comment
Please, Sign In to add comment