Ping Pong



  • Hi Leute,
    wir haben in der schule gerade ein Projekt, wo wir ein Spiel programmieren müssen.
    Meine Gruppe ist nicht beseonders gut in C vielleicht könnt ihr uns helfen, das Spiel zum laufen zu bringen, hier ist der Quellcode:

    // Tennis

    #include<stdio.h>
    #include<math.h>
    #include<dos.h>
    #include<ctype.h>
    #include<conio.h>
    #include<stdlib.h>
    #include<graphics.h>

    #define RUNTER 80
    #define HOCH 72
    #define ESC 27

    int hilfe(void);
    int spielfeld(void);
    void grafikmodus(void);
    void schlaeger(void);
    void ball(void);
    void hochrunter(int);
    char name1[20];
    char name2[20];

    main()
    {
    int auswahl;

    clrscr();
    gotoxy(26,2);
    printf("Willkommen bei Ping Pong");
    gotoxy(2,6);
    printf("Spieler 1:");
    fflush(stdin);
    scanf("%s",&name1);
    gotoxy(2,7);
    printf("Spieler 2:");
    fflush(stdin);
    scanf("%s",&name2);
    printf("Treffen sie ihre Auswahl:\n");
    scanf("%d",&auswahl);
    printf("1 Hilfe");
    if(auswahl==1)
    {
    hilfe();
    }
    spielfeld();
    grafikmodus();
    schlaeger();
    ball();
    getch();
    }

    int hilfe()
    {
    printf("Spielanleitung fr Ping Pong\n");
    printf("Spieler 1 benutzt die Tasten w/s\n");
    printf("Spieler 2 benutzt die Tasten hoch/runter\n");
    printf("Gewonnen hat wer als erster 11 Punkte hat");
    }

    int spielfeld()
    {

    }

    void grafikmodus()
    {

    /* request auto detection */
    int gdriver = DETECT, gmode, errorcode;

    /* initialize graphics mode */
    initgraph(&gdriver, &gmode, "C:\\TC\\BGI");

    /* read result of initialization */
    errorcode = graphresult();

    if (errorcode != grOk) /* an error occurred /
    {
    printf("Graphics error: %s\n", grapherrormsg(errorcode));
    printf("Press any key to halt:");
    getch();
    exit(1); /
    return with error code */
    }

    }

    void schlaeger()
    {
    int a,x;

    // Schl„ger 1

    rectangle(1,1,20,100);

    do
    {
    if(kbhit())
    {
    a=getch();
    if (a == ESC)
    break;
    if(a==0)
    {
    x=getch();
    }
    }

    }
    while();

    // Schl„ger 2

    rectangle(200,200,220,300);

    do
    {
    if(kbhit())
    {
    a=getch();
    if(a==ESC)
    break;
    if(a==0)
    {
    x=getch();
    }
    }
    }
    while();

    getch();
    }

    void hochrunter(int hochrunter)
    {
    int x,y;

    if(x==72)
    {
    }

    if(y==80)
    {
    }
    }

    void ball()
    {
    circle(100,100,10);
    }



  • Sers,

    welchen Compiler nutzt ihr bzw. welche Grafikbibliotheken? Ich habe leider keine "graphics.h".

    MfG
    SaM



  • Hoi, wie sieht denn die Bezahlung aus?

    Bye, TGGC (Wähle deine Helden)



  • SaM schrieb:

    Sers,

    welchen Compiler nutzt ihr bzw. welche Grafikbibliotheken? Ich habe leider keine "graphics.h".

    Sieht nach Borland-Compiler aus.



  • Codetags beim Posten waeren echt wuenschenswert!

    Was genau koennt ihr denn nicht?



  • So ein Schrott ist "out".


Anmelden zum Antworten