Card renderer with sprites, tiles

Clash Royale CLAN TAG#URR8PPP
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty margin-bottom:0;
up vote
0
down vote
favorite
This contains the elements of the map rendered in the variables (characters, sprites, tiles). However, I have not yet added any comment for the functions. It does not really help me move forward.
import constants from 'engine/constants';
import MapPoint from 'engine/MapPoint';
import cache, downloadTextures from 'engine/AssetsManager';
var characters = ;
var cells = ;
var sprites = ;
exports.characters = characters;
exports.cells = cells;
exports.sprites = sprites;
const drawTile = ( tileset, tile, width, height ) =>
var image;
var screenX = 0, screenY = 0;
if (tileset)
image = cache.tilesets[tileset][tile];
else
image = cache.tiles[tile];
context.drawImage(image, screenX, screenY, width, height);
;
exports.drawTile = drawTile;
const drawSprite = ( spritesheet, sprite, index, width, height ) =>
var image;
var screenX = 0, screenY = 0;
if (spritesheet)
image = cache.spritesheets[spritesheet][sprite];
else
image = cache.spritesheets[sprite];
context.drawImage(image, screenX, screenY, width, height);
exports.drawSprite = drawSprite;
const setGameMapData = informations =>
const onTexturesLoaded = () =>
characters = informations.characters;
cells = informations.cells;
sprites = informations.textures.filter(texture => texture.sprite)
tiles = informations.textures.filter(texture => texture.tile)
;
downloadTextures(informations.textures, onTexturesLoaded);
;
exports.setGameMapData = setGameMapData;
javascript node.js
add a comment |Â
up vote
0
down vote
favorite
This contains the elements of the map rendered in the variables (characters, sprites, tiles). However, I have not yet added any comment for the functions. It does not really help me move forward.
import constants from 'engine/constants';
import MapPoint from 'engine/MapPoint';
import cache, downloadTextures from 'engine/AssetsManager';
var characters = ;
var cells = ;
var sprites = ;
exports.characters = characters;
exports.cells = cells;
exports.sprites = sprites;
const drawTile = ( tileset, tile, width, height ) =>
var image;
var screenX = 0, screenY = 0;
if (tileset)
image = cache.tilesets[tileset][tile];
else
image = cache.tiles[tile];
context.drawImage(image, screenX, screenY, width, height);
;
exports.drawTile = drawTile;
const drawSprite = ( spritesheet, sprite, index, width, height ) =>
var image;
var screenX = 0, screenY = 0;
if (spritesheet)
image = cache.spritesheets[spritesheet][sprite];
else
image = cache.spritesheets[sprite];
context.drawImage(image, screenX, screenY, width, height);
exports.drawSprite = drawSprite;
const setGameMapData = informations =>
const onTexturesLoaded = () =>
characters = informations.characters;
cells = informations.cells;
sprites = informations.textures.filter(texture => texture.sprite)
tiles = informations.textures.filter(texture => texture.tile)
;
downloadTextures(informations.textures, onTexturesLoaded);
;
exports.setGameMapData = setGameMapData;
javascript node.js
1
Welcome to Code Review! I changed the title so that it describes what the code does per site goals: "State what your code does in your title, not your main concerns about it.". Feel free to edit and give it a different title if there is something more appropriate. Also, per "I think you think of lol" - are you thinking we are laughing out loud?
â Sam Onela
Jan 9 at 18:44
add a comment |Â
up vote
0
down vote
favorite
up vote
0
down vote
favorite
This contains the elements of the map rendered in the variables (characters, sprites, tiles). However, I have not yet added any comment for the functions. It does not really help me move forward.
import constants from 'engine/constants';
import MapPoint from 'engine/MapPoint';
import cache, downloadTextures from 'engine/AssetsManager';
var characters = ;
var cells = ;
var sprites = ;
exports.characters = characters;
exports.cells = cells;
exports.sprites = sprites;
const drawTile = ( tileset, tile, width, height ) =>
var image;
var screenX = 0, screenY = 0;
if (tileset)
image = cache.tilesets[tileset][tile];
else
image = cache.tiles[tile];
context.drawImage(image, screenX, screenY, width, height);
;
exports.drawTile = drawTile;
const drawSprite = ( spritesheet, sprite, index, width, height ) =>
var image;
var screenX = 0, screenY = 0;
if (spritesheet)
image = cache.spritesheets[spritesheet][sprite];
else
image = cache.spritesheets[sprite];
context.drawImage(image, screenX, screenY, width, height);
exports.drawSprite = drawSprite;
const setGameMapData = informations =>
const onTexturesLoaded = () =>
characters = informations.characters;
cells = informations.cells;
sprites = informations.textures.filter(texture => texture.sprite)
tiles = informations.textures.filter(texture => texture.tile)
;
downloadTextures(informations.textures, onTexturesLoaded);
;
exports.setGameMapData = setGameMapData;
javascript node.js
This contains the elements of the map rendered in the variables (characters, sprites, tiles). However, I have not yet added any comment for the functions. It does not really help me move forward.
import constants from 'engine/constants';
import MapPoint from 'engine/MapPoint';
import cache, downloadTextures from 'engine/AssetsManager';
var characters = ;
var cells = ;
var sprites = ;
exports.characters = characters;
exports.cells = cells;
exports.sprites = sprites;
const drawTile = ( tileset, tile, width, height ) =>
var image;
var screenX = 0, screenY = 0;
if (tileset)
image = cache.tilesets[tileset][tile];
else
image = cache.tiles[tile];
context.drawImage(image, screenX, screenY, width, height);
;
exports.drawTile = drawTile;
const drawSprite = ( spritesheet, sprite, index, width, height ) =>
var image;
var screenX = 0, screenY = 0;
if (spritesheet)
image = cache.spritesheets[spritesheet][sprite];
else
image = cache.spritesheets[sprite];
context.drawImage(image, screenX, screenY, width, height);
exports.drawSprite = drawSprite;
const setGameMapData = informations =>
const onTexturesLoaded = () =>
characters = informations.characters;
cells = informations.cells;
sprites = informations.textures.filter(texture => texture.sprite)
tiles = informations.textures.filter(texture => texture.tile)
;
downloadTextures(informations.textures, onTexturesLoaded);
;
exports.setGameMapData = setGameMapData;
javascript node.js
edited Jan 14 at 23:39
Jamalâ¦
30.1k11114225
30.1k11114225
asked Jan 9 at 12:17
ken
325
325
1
Welcome to Code Review! I changed the title so that it describes what the code does per site goals: "State what your code does in your title, not your main concerns about it.". Feel free to edit and give it a different title if there is something more appropriate. Also, per "I think you think of lol" - are you thinking we are laughing out loud?
â Sam Onela
Jan 9 at 18:44
add a comment |Â
1
Welcome to Code Review! I changed the title so that it describes what the code does per site goals: "State what your code does in your title, not your main concerns about it.". Feel free to edit and give it a different title if there is something more appropriate. Also, per "I think you think of lol" - are you thinking we are laughing out loud?
â Sam Onela
Jan 9 at 18:44
1
1
Welcome to Code Review! I changed the title so that it describes what the code does per site goals: "State what your code does in your title, not your main concerns about it.". Feel free to edit and give it a different title if there is something more appropriate. Also, per "I think you think of lol" - are you thinking we are laughing out loud?
â Sam Onela
Jan 9 at 18:44
Welcome to Code Review! I changed the title so that it describes what the code does per site goals: "State what your code does in your title, not your main concerns about it.". Feel free to edit and give it a different title if there is something more appropriate. Also, per "I think you think of lol" - are you thinking we are laughing out loud?
â Sam Onela
Jan 9 at 18:44
add a comment |Â
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fcodereview.stackexchange.com%2fquestions%2f184651%2fcard-renderer-with-sprites-tiles%23new-answer', 'question_page');
);
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
1
Welcome to Code Review! I changed the title so that it describes what the code does per site goals: "State what your code does in your title, not your main concerns about it.". Feel free to edit and give it a different title if there is something more appropriate. Also, per "I think you think of lol" - are you thinking we are laughing out loud?
â Sam Onela
Jan 9 at 18:44