Hi, I'm a student in Computer Science and we have a machine project due on August 20. The problem is, the professor only taught us the basics of C programming, the functions, switch statements and whatnot, and now they're giving us a project about making a game. The game is similar to Tetris in the way that there are things falling down. Because the overall project was too difficult to do, I thought of learning how to code falling texts first. Here is my code so far.
**mp.h is a user-defined header file that was given to us.
What I got so far is making the text fall down, only not in a straight line, but when it reaches the bottom I need it to go back up and choose another random x position and fall down in a straight line. Those two problems are what I have difficulty solving. Any help given is appreciated. ThanksCode:#include <stdio.h> #include <windows.h> #include <mp.h> #include <conio.h> void setBackground(unsigned short int color); int pickRandom(int min, int max); void delay(unsigned long milisec); void playSoundBeep(); void gotoxy(int x,int y); void setx(int x); void sety(int y); char getKeypressed(); void setScoreTo(int s); // sets the score to s void changeScoreBy(int x); // increments the score by x. If x is positive the score is increased. If x is negative the score is decreased. void showScore(); // shows the current score int getScore(); // returns the current score void clrscr(void); int getx(void); int gety(void); int main() { int lives = 3; int x1 = 0, y = 0; int x = getx(); setBackground(BLUE); do{ clrscr(); gotoxy(5, y); printf("T"); gotoxy(5, y++); delay(200); } while(y < 24); getch(); }![]()



LinkBack URL
About LinkBacks



