The food was originally a tomato (see here), but someone changed it to a jack-o-lantern for Hacktoberfest (see here).
Let's make it randomly switch between one and the other, let it be a tomato like 70% of the time and a jack-o-lantern like 30%..
Basically, here's what needs to be done.
Create a global variable at the top called food_char or something.
In the draw function where it checks if(!food) we need to have it also generate a random number between 1 and 10, if the number is 7 or greater, set the food_char to the value of the jac-o-lantern character, else set it to the value of the tomato.
Change the ctx.fillText(...) to use the variable instead of the literal character.
The food was originally a tomato (see here), but someone changed it to a jack-o-lantern for Hacktoberfest (see here).
Let's make it randomly switch between one and the other, let it be a tomato like 70% of the time and a jack-o-lantern like 30%..
Basically, here's what needs to be done.
food_char
or something.if(!food)
we need to have it also generate a random number between 1 and 10, if the number is 7 or greater, set thefood_char
to the value of the jac-o-lantern character, else set it to the value of the tomato.ctx.fillText(...)
to use the variable instead of the literal character.This should be a real simple task for someone.