Zeldaria After defining shot, set its visible property to false.
shot.visible = false;
In shoot(), after pressing space, set shot's visible property to true.
if (keyDown("space")) {
shot.visible = true;
shot.x = ship.x;
shot.y = ship.y - 40;
shot.velocityY = -8;
}