I\'m making a simple game where you move a ball on a screen and try to avoid other blocks on the screen.
The problem i\'m having is that when I try to evaluate whether y
You need
if (sect == true) { // compares sect with true and checks the result
instead of
if (sect = true) { // sets sect to true and then checks it
Even better would be to use
if (sect) { // checks sect
You are mistakenly assigning the true boolean literal to your variable in if block expression:
if(sect = true)
due to which, the expression is always evaluated to true. This is the reason why you should never compare boolean variables with true or false. Just using sect here would be enough.
Change it to:
if (sect)