What is the best way to fix this

it is saying failed cast on null and i want to fix it. and get the arrays working.

Usually failed cast on null errors happen when you try to do something with a variable before its been set. I dont know much of anything about javascript so i cant help much beyond that.

thank you, i solved it using an old post.

It was trying to run the set position before the sprite was created even though it was below it;
I made a function which seemed to solve it.

here was the solution:

function location(sprite: Sprite, column: number, row: number) {
    sprite.x = column * 16
    sprite.y = row * 16
}
2 Likes