Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include "gfx.h"
- #include <stdlib.h>
- #include <time.h>
- int score_add(int score1);
- int score_minus(int score1);
- int guess_add(int guess1);
- int guess_minus(int guess1);
- int main()
- { //146
- char c;
- char *test = "Would you like to play a game? Y/N" ;
- char *levelone = "LEVEL 1-1";
- char *leveltwo = "LEVEL 1-2";
- char *levelthree = "LEVEL 1-3";
- char *levelfour = "LEVEL 1-4";
- char *levelfive = "LEVEL 1-5";
- char *between = "Left click the mouse to continue";
- char *red = "RED";
- char *lblue = "LIGHT BLUE";
- char *dblue = "DARK BLUE";
- char *yellow = "YELLOW";
- char *dgreen = "DARK GREEN";
- char *lgreen = "LIGHT GREEN";
- char *brown = "BROWN";
- char *purple ="PURPLE";
- char *pink = "PINK";
- char *black = "BLACK";
- char *correct = "CORRECT";
- char *wrong = "WRONG";
- char *guessone = "You have 1 guesses left";
- char *guesstwo = "You have 2 guesses left";
- char *guessthree = "You have 3 guesses left";
- char *scorezero = "SCORE = 0";
- char *scoreone = "SCORE = 1";
- char *scoretwo = "SCORE = 2";
- char *scorethree = "SCORE = 3";
- char *scorefour = "SCORE = 4";
- char *scorefive = "SCORE = 5";
- char *end = "Okay, Please come again!";
- char *end1 = "Press any key to exit";
- int x,y,score,guess;
- char n;
- guess = 3;
- score = 0;
- gfx_open(3000,1000,"bew");
- gfx_clear_color(255,255,255);
- gfx_clear();
- gfx_color(0,0,0);
- gfx_text(test,800,500);
- while (1) {//143
- c = gfx_wait();
- x = gfx_xpos();
- y = gfx_ypos();
- if (c==0x01)
- {
- }
- /* else
- {
- printf("%c \n",c);
- printf("Mouse pos xpos is %d and ypos is %d \n", gfx_xpos(),gfx_ypos());
- }
- if ((x >= 200 && x <= 400) && (y >= 100 && y <= 300))
- {//123
- printf("Correct \n");
- //gfx_color(255,255,0);
- //gfx_fillcircle(50,500,100);
- }//121*/
- //c = gfx_wait();
- if ((c =='Y') || (c == 'y'))
- //level one(91 - 183)
- {//165
- gfx_clear();
- gfx_text(levelone,1100,100);
- gfx_text(red,100,100);
- gfx_text(scorezero,100,200);
- gfx_text(guessthree,100,300);
- // setting line color
- gfx_color(0,0,0);
- //drawing vertical grid
- gfx_line(600,0,600,1000);
- gfx_line(800,0,800,1000);
- gfx_line(1000,0,1000,1000);
- //drawing horizontal grid
- gfx_line(600,200,1000,200);
- gfx_line(600,400,1000,400);
- gfx_line(600,600,1000,600);
- gfx_line(600,800,1000,800);
- gfx_line(600,1000,1000,1000);
- // drawing in circles with different colors
- gfx_color(0,0,0); //black
- gfx_fillcircle(700,100,150);
- gfx_color(255,0,0); //red
- gfx_fillcircle(900,100,150);
- gfx_color(0,255,0); //light green
- gfx_fillcircle(700,300,150);
- gfx_color(0,0,255); //light blue
- gfx_fillcircle(900,300,150);
- gfx_color(255,255,0); //yellow
- gfx_fillcircle(700,500,150);
- gfx_color(0,128,0); //dark green
- gfx_fillcircle(900,500,150);
- gfx_color(255,0,255); //pink
- gfx_fillcircle(700,700,150);
- gfx_color(128,0,128); //purple
- gfx_fillcircle(900,700,150);
- gfx_color(0,0,100); //dark blue
- gfx_fillcircle(700,900,150);
- gfx_color(65,42,42); //brown
- gfx_fillcircle(900,900,150);
- x = gfx_wait();
- if ((x >= 800 && x <= 1000) || (y >= 0 && y <= 200)) // correct decision
- {//140
- gfx_clear();
- gfx_text(correct,800,300);
- score = score_add(score);
- gfx_text(scoreone,800,400);
- gfx_text(guessthree,800,450);
- gfx_text(between,800,500);
- printf("%d\n",score);
- c = gfx_wait();
- gfx_clear();
- }//136
- else // wrong decision
- {//163
- gfx_clear();
- gfx_text(wrong,800,300);
- guess = guess_minus(guess);
- gfx_text(scorezero,800,400);
- gfx_text(guesstwo,800,450);
- gfx_text(between,800,500);
- printf("%d\n",guess);
- c = gfx_wait();
- gfx_clear();
- }//155
- if (score == 1)
- {
- gfx_text(guessthree,100,250);
- gfx_text(scoreone,100,200);
- }
- if (guess == 2)
- {
- gfx_text(guesstwo,100,250);
- gfx_text(scorezero,100,200);
- }
- //level two(186 - 295)
- gfx_text(leveltwo,1100,100);
- gfx_text(lblue,100,100);
- // setting line color
- gfx_color(0,0,0);
- //drawing vertical grid
- gfx_line(600,0,600,1000);
- gfx_line(800,0,800,1000);
- gfx_line(1000,0,1000,1000);
- //drawing horizontal grid
- gfx_line(600,200,1000,200);
- gfx_line(600,400,1000,400);
- gfx_line(600,600,1000,600);
- gfx_line(600,800,1000,800);
- gfx_line(600,1000,1000,1000);
- // drawing in circles with different colors
- gfx_color(255,0,255); //pink
- gfx_fillcircle(700,100,150);
- gfx_color(255,255,0); //yellow
- gfx_fillcircle(900,100,150);
- gfx_color(255,0,0); //red
- gfx_fillcircle(700,300,150);
- gfx_color(0,0,100); //dark blue
- gfx_fillcircle(900,300,150);
- gfx_color(65,42,42); //brown
- gfx_fillcircle(700,500,150);
- gfx_color(0,128,0); //dark green
- gfx_fillcircle(900,500,150);
- gfx_color(0,0,0); //black
- gfx_fillcircle(700,700,150);
- gfx_color(0,255,0); //light green
- gfx_fillcircle(900,700,150);
- gfx_color(0,0,255); //light blue
- gfx_fillcircle(700,900,150);
- gfx_color(128,0,128); //purple
- gfx_fillcircle(900,900,150);
- x = gfx_wait();
- gfx_color(0,0,0);
- if ((x >= 600 && x <= 800) || (y >= 800 && y <= 1000)) // correct condition
- {
- if (score == 1)
- {//140
- gfx_clear();
- gfx_text(correct,800,300);
- score = score_add(score);
- gfx_text(scoretwo,800,400);
- gfx_text(guessthree,800,450);
- gfx_text(between,800,500);
- printf("%d\n",score);
- c = gfx_wait();
- gfx_clear();
- }//136
- else if (score == 0)
- {//140
- gfx_clear();
- gfx_text(correct,800,300);
- score = score_add(score);
- gfx_text(scoreone,800,400);
- gfx_text(guesstwo,800,450);
- gfx_text(between,800,500);
- printf("%d\n",score);
- c = gfx_wait();
- gfx_clear();
- }//136
- }
- else//wrong condition
- {//163
- if (guess == 3)
- {
- gfx_clear();
- gfx_text(wrong,800,300);
- guess = guess_minus(guess);
- gfx_text(scoreone,800,400);
- gfx_text(guesstwo,800,450);
- gfx_text(between,800,500);
- printf("%d\n",guess);
- c = gfx_wait();
- gfx_clear();
- }//155
- else if(guess == 2)
- {
- gfx_clear();
- gfx_text(wrong,800,300);
- guess = guess_minus(guess);
- gfx_text(scorezero,800,400);
- gfx_text(guessone,800,450);
- gfx_text(between,800,500);
- printf("%d\n",guess);
- c = gfx_wait();
- gfx_clear();
- }//155
- }
- if (score == 2)
- {
- gfx_text(guessthree,100,250);
- gfx_text(scoretwo,100,200);
- }
- if (score == 1)
- {
- gfx_text(guesstwo,100,250);
- gfx_text(scoreone,100,200);
- }
- if (score == 0)
- {
- gfx_text(guessone,100,250);
- gfx_text(scorezero,100,200);
- }
- gfx_text(levelthree,1100,100);
- gfx_text(black,100,100);
- // setting line color
- gfx_color(0,0,0);
- //drawing vertical grid
- gfx_line(600,0,600,1000);
- gfx_line(800,0,800,1000);
- gfx_line(1000,0,1000,1000);
- //drawing horizontal grid
- gfx_line(600,200,1000,200);
- gfx_line(600,400,1000,400);
- gfx_line(600,600,1000,600);
- gfx_line(600,800,1000,800);
- gfx_line(600,1000,1000,1000);
- // drawing in circles with different colors
- gfx_color(0,0,255); //light blue
- gfx_fillcircle(700,100,150);
- gfx_color(255,0,255); //pink
- gfx_fillcircle(900,100,150);
- gfx_color(0,0,100); //dark blue
- gfx_fillcircle(700,300,150);
- gfx_color(0,255,0); //light green
- gfx_fillcircle(900,300,150);
- gfx_color(65,42,42); //brown
- gfx_fillcircle(700,500,150);
- gfx_color(0,0,0); //black
- gfx_fillcircle(900,500,150);
- gfx_color(0,128,0); //dark green
- gfx_fillcircle(700,700,150);
- gfx_color(128,0,128); //purple
- gfx_fillcircle(900,700,150);
- gfx_color(255,0,0); //red
- gfx_fillcircle(700,900,150);
- gfx_color(255,255,0); //yellow
- gfx_fillcircle(900,900,150);
- x = gfx_wait();
- gfx_color(0,0,0);
- if ((x >= 800 && x <= 1000) || (y >= 400 && y <= 600)) // correct condition
- {
- if (score == 1)
- {//140
- gfx_clear();
- gfx_text(correct,800,300);
- score = score_add(score);
- gfx_text(scoretwo,800,400);
- gfx_text(guessthree,800,450);
- gfx_text(between,800,500);
- printf("%d\n",score);
- c = gfx_wait();
- gfx_clear();
- }//136
- else if (score == 0)
- {//140
- gfx_clear();
- gfx_text(correct,800,300);
- score = score_add(score);
- gfx_text(scoreone,800,400);
- gfx_text(guesstwo,800,450);
- gfx_text(between,800,500);
- printf("%d\n",score);
- c = gfx_wait();
- gfx_clear();
- }//136
- }
- else//wrong condition
- {//163
- if (guess == 3)
- {
- gfx_clear();
- gfx_text(wrong,800,300);
- guess = guess_minus(guess);
- gfx_text(scoreone,800,400);
- gfx_text(guesstwo,800,450);
- gfx_text(between,800,500);
- printf("%d\n",guess);
- c = gfx_wait();
- gfx_clear();
- }//155
- else if(guess == 2)
- {
- gfx_clear();
- gfx_text(wrong,800,300);
- guess = guess_minus(guess);
- gfx_text(scorezero,800,400);
- gfx_text(guessone,800,450);
- gfx_text(between,800,500);
- printf("%d\n",guess);
- c = gfx_wait();
- gfx_clear();
- }//155
- }//66
- }//92
- }//47
- }//8
- int score_add(int score1)
- {
- score1 = score1 + 1;
- return(score1);
- }
- int score_minus(int score1)
- {
- score1 = --score1;
- return(score1);
- }
- int guess_add(int guess1)
- {
- guess1 = ++guess1;
- return(guess1);
- }
- int guess_minus(int guess1)
- {
- guess1 = --guess1;
- return(guess1);
- }
Add Comment
Please, Sign In to add comment