Lua Code error

danieljdavies8

Prominent
Dec 27, 2017
1
0
510
Hey everyone,

I know it may not be the perfect place to ask for this but I do not know where else to ask this question.

I am currently making a mobile game that is written in lua. I want it so that if the player is in a certain place, it will change the background (different town, forest, etc).

This is the code that I have written for this but it doesn't work.

if ((player.x <= display.contentHeight / 3.8) and (player.x >= display.contentHeight / 3.5) and (player.y >= display.contentWidth / 100)) then
enteredViridisTown = 0
enteredViridisTown2 = 1
enteredViridisForest = 0
end

I have a few if statements that will change the backgrounds according to the variable change.
Is there anything that I could do to fix this?

Thank you