Greedy? Many people are most familiar with this game. Today, we will try this little game. When you are bored, you can still find some fun! :)
A simple Snake Game mainly includes two objects: Snake and food.
Snake:
As we all know, a snake crawls, eats, grows, and dies. These are the basic members of a snake, including its characteristics, for example, length, movement direction, speed, and so on; and the behavior of snakes, the snakes will crawl and die, and the display of snakes (draw.
Food:
The food class is relatively simple, mainly because of the display and disappearance of food. If the food class is extended, some types of food can be defined, for example, it is not surprising that after a snake eats, the length of food, slow food, accelerated food, reverse, and an obstacle appear. If you love it, add any function.
Game rules:
Control the snake to eat the food on the screen, eat longer, hit the walls or obstacles to death! That's easy!
The basic object already exists, and it is still the same. In addition to Logic Operation Judgment + loop, a small game is born again!