Module #1 (Tahsina Bintay Azam)#15
Module #1 (Tahsina Bintay Azam)#15tahsina-azam wants to merge 3 commits intorecruit-org:module-1from
Conversation
pages/index.js
Outdated
|
|
||
| var dumX=head.x + direction.x; | ||
| var dumY=head.y + direction.y; | ||
| if(head.x + direction.x>24){ |
There was a problem hiding this comment.
head.x + direction.x is dumX right?
|
for multiple foods, you could use an array of foods instead of 4 food states. creating more states is redundant and also hard to manage, you know how hard it is to manage those 4 foods. |
Corei13
left a comment
There was a problem hiding this comment.
Let's do a refactor so you use an array of food, instead of four separate food objects. That will simplify the code a lot!
Use my video or other PRs as reference, and ask in the channel if there's any questions.
okay, I will use an array of food using your video as a reference, actually, I wanted to use an array, But I was unable to create one so I opted for four different foods. I thought when it would be the time for the fourth food to appear it would also be the time for the first food to disappear if I put four foods in a loop with 3-sec interval, and in case of any food getting eaten by the snake in the meantime, I just relocated it out of the grid as it would again appear when its turn will come. But it also didn't work properly :") |
No description provided.