Wyświetlenie elementu na planszy

0

Witam

Mam problem z wyświetleniem elementu który oznaczyłem jako "orb" na planszy "map"

const canvas = document.querySelector('canvas');
const ctx = canvas.getContext('2d');

canvas.width = 1200;
canvas.height = 600;

const cw = canvas.width;
const ch = canvas.height;



const orbSize = 55;
let orbX = cw / 2;
let orbY = ch / 2;


function orb() {
    ctx.fillstyle = 'white';
    ctx.fillRect(orbX, orbY, orbSize, orbSize);
}

function map() {
    ctx.fillStyle = 'darkblue';
    ctx.fillRect(0, 0, cw, ch);
}
function game() {
    map()
    orb()
}

game()

Nie wiem gdzie jest błąd i czemu orb nie chce się wyświetlić. W konsoli nie ma żadnego błędu.

1

Jeśli poprawisz ctx.fillstyle = 'white'; na ctx.fillStyle = 'white';, to element powinien się wyświetlić na planszy.

1 użytkowników online, w tym zalogowanych: 0, gości: 1