C-language mini-game development of Snake

Source: Internet
Author: User

Winter vacation period, think of C language can develop a snake game should be a good thing! But the C language learning process has always been the character interface programming, how can have "graphical" effect? So the small part of the Niang,

Google and other web site search, found some useful Win32 API functions, so the small part of the heart suddenly excited up, with these API functions may be able to achieve yo! Let's go!

Before programming, the idea of small series is such that the snake games should be achieved by:

1. The snake should be able to move independently under conditions of no control.

2. The player can control the direction of the snake through WASD keys.

3. During operation, if the snake hits the wall or its own body, the game is over, giving a message.

4. When a food is eaten, the next food should appear immediately, in a random position.

The plan starts on January 20 and ends on January 22 for a total of three days. After the goal is set, the work begins formally!

The development process of the snake is gradual, the small part is first from the realization of the site, and then to the realization and movement of the body of the snake, and then the realization of food, and finally the player through the keyboard to control the direction of the snake. In fact, the mini-series began on January 20.

It didn't end until January 23, for a total of 4 days. Beyond the expected day. The main use of the development is a variety of WIN32 API functions, such as the original control of the cursor position, the player hit the keyboard listener, as well as the interface background color and so on. The tool used in small series is the Codeblocks integrated development environment, a very small IDE, in short, after 4 days of development, the final finished product and the expected target is basically the same. Here are the following:

  

C-language mini-game development of Snake

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.