-
Notifications
You must be signed in to change notification settings - Fork 5
Home
Vicente Adolfo Bolea Sánchez edited this page Sep 8, 2011
·
4 revisions
Easypong is a PingPong game wrotte in C with NCURSES lib. I did it when i was in my first year of my major. So maybe is too simple. The reason because i did this repository is to try github. But if you want to help me to make a better code, i'll be glad.
You maybe have to install ncurses library. So to install tip:
sudo apt-get install libncurses5-devGo to its directory and tip:
cc pong.c -lncurses -o pongThen:
./pong
Firstly i used a struct like a class, so the struct called "objeto" have 3 members:
- Struct objeto:
- Member x-coordenada called 'x'
- Member y-coordenada called 'y'
- Member counter of puntuation called 'c'
- Member move-vertical called 'movver'
- Member move-horizontal called 'movhor'
- objeto's var
- First stick called 'b1
- Second stick called 'b2'
- The ball called 'b'
- The screen called 'scr'
There is 3 blocks or parts:
- Setting the structur objeto and diferents functions.
- Starting part:
- I declare vars in the first line
- Start the screen and NCURSES setting
- I set all the var
- Principal loop
- Engine function: It check when the ball is in the edge and is make the game rules
- Keyboard control
- Print in the screen