VASTLY improved how I generate tiles and tiledata
This commit is contained in:
@@ -1,21 +1,21 @@
|
||||
const arrayToString = arr => {
|
||||
const b = arr.map(n => {
|
||||
return '0x' + (n.toString(16).padStart(2, '0').toUpperCase());
|
||||
});
|
||||
|
||||
let str = '';
|
||||
for(let i = 0; i < b.length; i += 16) {
|
||||
str += ' ';
|
||||
for(let x = i; x < Math.min(i+16, b.length); x++) {
|
||||
str += b[x];
|
||||
str += ',';
|
||||
}
|
||||
str += '\n';
|
||||
}
|
||||
|
||||
return str;
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
arrayToString
|
||||
const arrayToString = arr => {
|
||||
const b = arr.map(n => {
|
||||
return '0x' + (n.toString(16).padStart(2, '0').toUpperCase());
|
||||
});
|
||||
|
||||
let str = '';
|
||||
for(let i = 0; i < b.length; i += 16) {
|
||||
str += ' ';
|
||||
for(let x = i; x < Math.min(i+16, b.length); x++) {
|
||||
str += b[x];
|
||||
str += ',';
|
||||
}
|
||||
str += '\n';
|
||||
}
|
||||
|
||||
return str;
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
arrayToString
|
||||
}
|
Reference in New Issue
Block a user