Need help with Canvas refresh, very glitchy and flashing, and im using setInterval. Dont know how to use requestanimation frame, any help is great
//initiates entire game
function fullLoader() {
setInterval(drawPoke, fps);
setInterval(drawHaunt, fps);
setInterval(drawChar, fps);
setInterval(drawDusk, fps);
setInterval(refresh, 1000/30);
}
function refresh() {
con.clearRect(0, 0, canvas.width, canvas.height)
}
The function are drawings or png images and are set to relaod at the interval of fps which is set to 30.