Only right direction is shown on console


Only right direction is shown on console even when other keys are pressed,plz help

@aatish08
There was nothing on the code
Please look into it again and send the code

its not getting saved on coding blocks ide,any other means to share the code

@aatish08
You can share github link, ideone etc as well

@aatish08
I think the issue is with your event listener for key down
Please see if you can share your code on github then I can see it happening visually

@aatish08
You made a silly mistake
snake.direction = “left” -> Right way ( Assignment operation )
snake.direction == “left” -> What you did ( Comparison operation )

Please close the doubt if your query is resolved.

1 Like

Oh!! Thank you so much ,appreciate your efforts for resolving this doubt

also sir,the issue is resolved but the food box is not generating randomly,plz help with that

@aatish08 buddy
Please see Instructor’s code once again and try to find the error once
Might be a similar issue like this one
If you still cant find it after comparison then I’ll be happy to help you

Ok sir will check it