Snake game: start screen and two players

One thing to begin: the draw() function is defined multiple times in the code, which is not allowed in Processing. You should only define it once, and then use conditional statements to control which screen (start or game) is drawn each frame.

Now, it appears that you are trying to implement a complex program without fully understanding the fundamentals of the Processing language. In order to create working programs in Processing, it is important to have a solid foundation in the basics of the language, such as variables, data types, control structures, functions, and other core concepts. Without this foundation, it can be difficult to understand and troubleshoot your code when things don’t work as expected.

I encourage you to take some time to go back and learn the fundamentals of Processing. The Processing website has a great collection of tutorials and examples that can help you get started. You can also try working through some simple projects and challenges to practice your skills and build your confidence. As you learn the basics, you will be better equipped to tackle more complex programs and ideas.

Remember that learning to code is a process, and it can take time and persistence to develop your skills. Don’t be discouraged if you encounter challenges or setbacks along the way. Just keep practicing, experimenting, and asking questions, and you will eventually be able to create the programs that you want to make.

PS: I formatted your code. In the future please use code formatting to make it easier for people to help. See the example below:

Note: part of this message was generated with ChatGPT

3 Likes