Re: 3 doesn't equal 3?
Posted: Fri Aug 02, 2019 11:52 am
Hello there! To be honest there are millions of ways to write snake game. The repo that I provided is very simple and easy to understand. And about the old version - well you can run it quick using the appImages for linux or binaries for windows. But if you want to program in the latest version then here's a youtube video which might help you. The author is an instructor at Harvard Extension School - so you shouldn't have much problem understanding what's going on
And if you don't like watching youtube tutorials then head on to this site. The last time I saw the source-code it was like 150 lines long - so this shouldn't be a head-ache plus everything is modular.
Just as an extra comment- please do not disrespect yourself (even in jokes)
![Eyebrows :brows:](./images/smilies/ms-near-monobrow.png)
But anyways. I downloaded your files. And just a side-comment you don't really need conf.lua in this context. It's useful when publishing game but in this context it's completely unnecessary I'd say. And about your main code- it's humongous and that definitely is not a compliment to a developer. Plus it's broken as well. And I'm no-one to give you advice on programming but - Richard Buckland said this - "It's not the algorithm but the data-structure that is the key to any problem". So rather than working on how to move the snake you should consider "how should I store the snake" and that would be the key to your problem
And finally back to your code. I have seen atleast 5 snake games written in LOVE but not even in one of those did i see anything such as 'alive=true'. Really you should minimize the amount of variables you use - plus the spelling of snake is incorrect (snack
![ROFL :rofl:](./images/smilies/ms-rofl.png)
Also I strongly discourage on using isDown function for this purpose- i remember when I was programming snake (it's super ugly so I didn't upload it on my github. plus it's not even polished
![Awww :3](./images/smilies/ms-three.png)
There are lot more errors which I won't point out- since i don't want to discourage you. Well figuring out things on your own is a good idea but you should also look at how other people solved the same problem. In programming is all about - "finding the best possible solution to a problem?" - so how would you know if your solution is the best unless you compare it with that of your peers.
Regards
![Smile :)](./images/smilies/ms-smile.png)