Score doesn't work at all, NEED HELP ASAP(before Friday, this is very important)
The variable for the score in my game doesn't want to increase, and it is really bad because I have to print this variable, and it also decides the outcome of the game. [Candy = class
constructor = function(x, y) this.x = x this.y = y end
visible = true
candyColllisionCheck = function()
if distance(player.x, player.y, x, y) < 16 then
numCandy += 0.3
this.visible = false
end
end
end ] <- this is the class that creates candies and it is also supposed to increase the variable numCandy (which is declared in the main init function) by 1 everytime the playey touches the candy. The candy dissapears as it is supposed to after the touch, but the variable numCandy doesn't increase
[ init = function()
numCandy = 0
player = object
x = 0
y = 0
s = 1.5
w = 20
l = 30
image = "walk_down"
end
candy1 = new Candy(-97, 70)
end] <- this is the init() function, in case it is needed
[candy1.candyColllisionCheck()] <= this is how I called the function in the updateGame()function, which is later called in the update()
[ screen.drawText("Candies collected: " + numCandy + "/9", -52, 90, 10,"rgb(0,23,15)" ) ] <- and this is how I print the score, this is inside drawGame() function, whic is called in the draw() function

