![]() I prevent players from doing that by implementing temporary direction, that reads the current direction at the begining of a time period (or refresh rate - it is the same here). Most of the games doesn't allow you to change from Right to Left (or Up to Down etc.) in one step, but this is allowed. What's the most interesting I guess is the fact, that almost all snake tutorials around the internet allow you (if you are fast enough) to bug the game with those simple steps: Assume, that the snake moves to the Right, timer is set to some amount of time, and if you manage to press Up or Down arrow and then very fast Left (when the timer hasn't gone off), the snake will move backwards and finally eat himself. ![]() ![]() Score is related to speed value (score for food is the same as the number of speed). ![]() I have added some buttons to stop/pause the game (can be done by pressing Space as well) and choose speed. The game works just fine, I have encountered one issue though - the Food condition to not to create new food on current snake position is not working, and to be honest with you - I have been trying to solve it, but forgot about it and now when I am posting this I have this in my mind one more time. I put my code below to ask you for a review and ask you if this can be considered a good and clean code?
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |