Help me !! | Sololearn: Learn to code for FREE!
Novo curso! Todo programador deveria aprender IA generativa!
Experimente uma aula grƔtis
+ 1

Help me !!

I want to rewrite snake but I have some problems with the code . The problems are that the screen continue to refresh and that the tail doesnā€™t follow the head. https://code.sololearn.com/co37OntiMj6F/?ref=app

24th Dec 2018, 2:46 PM
Agnese Ghisolfo
Agnese Ghisolfo - avatar
1 Resposta
+ 4
The problem is with the following line in the Draw() function: if ( tailX[k]== j && tailY[x]== i) It should be tailY[k] instead of tailY[x]. Then it will work as expected. You can make the code more simpler to use and extend by using classes.
24th Dec 2018, 5:09 PM
Kinshuk Vasisht
Kinshuk Vasisht - avatar