In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-09-15 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)05/31 Report--
In this article, the editor introduces in detail "how C language uses array to realize bouncing ball eliminating brick". The content is detailed, the steps are clear, and the details are handled properly. I hope that this article "how C language uses an array to achieve bouncing ball eliminating bricks" can help you solve your doubts. Let's follow the editor's ideas to learn new knowledge.
First, the effect display:
2. The code is as follows: # include#include#include#include#include#define High 24 / / Game screen size # define Width 36 define Width / global variable int ball_vx,ball_vy;// ball coordinates int ball_vx,ball_vy;// ball speed int canvas [High] [Width] = {0}; int position_x,position_y;// bezel center coordinate int ridus;// bezel radius size int left,right;// bezel left and right size int score=0 / / score / / two-dimensional array stores the corresponding element / / 0 in the game canvas for spaces, 1 for balls, 2 for baffles, 3 for bricks (1 point), 4 for bricks (2 points), 5 for bricks (3 points) void gotoxy (int x STD_OUTPUT_HANDLE int y) / / move the cursor to the (x STD_OUTPUT_HANDLE) position {HANDLE handle=GetStdHandle (STD_OUTPUT_HANDLE); COORD pos; pos.X=x; pos.Y=y; SetConsoleCursorPosition (handle,pos) } void startup () / / initialization of data {int krecoveri; ridus=5; position_x=High-1; position_y=Width/2; left=position_y-ridus; right=position_y+ridus; ball_x=position_x-1; ball_y=position_y; ball_vx=-1; ball_vy=1; canvas [ball _ x] [ball_y] = 1; for (kumbleftmitk)
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
The market share of Chrome browser on the desktop has exceeded 70%, and users are complaining about
The world's first 2nm mobile chip: Samsung Exynos 2600 is ready for mass production.According to a r
A US federal judge has ruled that Google can keep its Chrome browser, but it will be prohibited from
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
About us Contact us Product review car news thenatureplanet
More Form oMedia: AutoTimes. Bestcoffee. SL News. Jarebook. Coffee Hunters. Sundaily. Modezone. NNB. Coffee. Game News. FrontStreet. GGAMEN
© 2024 shulou.com SLNews company. All rights reserved.