Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- static renderEntities () {
- let entitiesToDraw: Entity[] = GameData.playersList.concat(GameData.enemies)
- entitiesToDraw.sort((a, b) => {
- return a.y - b.y
- })
- entitiesToDraw.forEach((entity: Entity) => {
- entity.draw()
- })
- }
- draw () {
- CTX.drawImage(
- this.image, CYCLE_LOOP[this.currentLoopIndex] * 32,
- this.currentDirection * 48, 32, 48, this.x + GameData.horizontalMargin,
- this.y + GameData.verticalMargin, 32, 48
- );
- }
Advertisement
Add Comment
Please, Sign In to add comment