JavaScript
const canvas = document.getElementById("canvas")
var color1 = prompt("Please pick a color.")
var color2 = prompt("Please pick another color.")
var color3 = prompt("Please pick another color.")
var color4 = prompt("Please pick another color.")
var color5 = prompt("Please specify a color for the inner hilt of your sword.")
var color6 = prompt("Please specify a color for the outer hilt of your sword.")
if(color5 === "default" || color6 === "default"){
color5 = "sienna"
color6 = "saddlebrown"
}
const ctx = canvas.getContext("2d")
ctx.scale(10, 10)
var orematrix = [
[1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1],
[1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1],
[1, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 1, 2, 5, 1, 1],
[1, 1, 1, 1, 1, 1, 1, 2, 4, 1, 1, 1, 1, 1, 1, 1],
[1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1],
[1, 1, 1, 1, 1, 2, 5, 1, 1, 1, 2, 3, 1, 1, 1, 1],
[1, 1, 1, 2, 3, 4, 5, 5, 1, 1, 3, 5, 1, 1, 1, 1],
[1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1],
[1, 2, 5, 1, 1, 1, 1, 1, 2, 5, 1, 1, 1, 1, 1, 1],
[1, 1, 1, 1, 1, 1, 1, 2, 3, 4, 5, 1, 1, 1, 1, 1],
[1, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1],
[1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 5, 1, 1, 1],
[1, 1, 1, 1, 1, 1, 1, 1, 2, 3, 3, 4, 5, 5, 1, 1],
[1, 1, 1, 2, 5, 1, 1, 1, 1, 2, 5, 1, 1, 1, 1, 1],
[1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1],
[1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1],
]
orematrix.forEach((row, y) => {
row.forEach((value, x) => {
if(value === 1){
ctx.fillStyle = "darkgray"
ctx.fillRect(x, y, 1, 1)
}
if(value === 2){
ctx.fillStyle = color1
ctx.fillRect(x, y, 1, 1)
}
if(value === 3){
ctx.fillStyle = color2
ctx.fillRect(x, y, 1, 1)
}
if(value === 4){
ctx.fillStyle = color3
ctx.fillRect(x, y, 1, 1)
}
if(value === 5){
ctx.fillStyle = color4
ctx.fillRect(x, y, 1, 1)
}
})
})
const swordMatrix = [
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, 5, 5],
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, 4, 4, 5],
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, 2, 3, 4, 5],
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, 2, 3, 2, 5,...