Get the App
SLTechnology News&Howtos  ›  Development  › 

How to realize simple bouncing Ball in C language

Shulou Source: shulou.com Published: 2022-05-31 17:45:43 10月02日 Update

Most people do not understand the knowledge points of this article "how to achieve a simple bouncing ball in C language", so the editor summarizes the following content, detailed content, clear steps, and has a certain reference value. I hope you can get something after reading this article, let's take a look at this "C language how to achieve a simple bouncing ball" article.

This section uses the printf function to achieve a bouncing ball on the screen, the content is simple and easy to get started, which is what we may use in designing more games in the future.

Draw a stationary ball

We will play the game in the coordinate system as shown in the figure, that is, take the upper left corner of the window as the origin.

We want to display the stationary ball at the coordinates (x, y):

# include int main () {int iJournal j; / / these two quantities are to be used in the loop, so be sure to declare int x = 5; int y = 10; / / output the blank line [x coordinates] for (iS0; I) above the ball

Tags: Ball coordinate output speed boundary loop direction content file space blank line jshield compile language up and down function animation right run one side Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Xiaomi Microsoft macOS MariaDB OPPO Reno