Hello, I'm just new here. I wanted some people to help me with my project. We were tasked to do a game using Turbo C. I already found some games that has source codes like snake, tic toe, etc. I wanted to be slightly different 'cause I know my classmates would just go and research already made codes and make it their own. Can you guys help me? I wanted to ask a lot of questions for our Project. I was planning of creating a visual-novel-like game and a piece of sword slashing or turn based game. What statements can I use with those games?

Yes, we can help you. Please ask specific questions beyond "can you help me?" (the answer is yes) and "what statements can I use?" (the answer is any of them).

I wanted to know how to put dialog boxes or such. 'Cause they're a bit improtant to me
for that visual-novel-like game. Will my proposed games will work? I don't care about the quality, as long as it runs the way I want it to be.

If your OS is windows, then you need to learn windows API programming, ( preferred in Visual C++ ). Here is a tutorial to it.

Simple dialog box can be used by the MessageBox() function.
A simple implementation :

# include <windows.h>

int main()
{
  MessageBox(NULL," Hello World ( MsgBox info here ) ","DialogBox title ",MB_ICONINFORMATION | MB_OK);
}

Check this for more information on MessageBox().

For using this function you need to include windows.h # include <windows.h> but I don't know if Turbo C supports this header. Probably they have something called dos.h header. But it is always preferred not to use Turbo C as its very old.

But sir, we were just instructed to use Turbo C or just C language as a compiler.
We can't use any other compiler other than Turbo C. >.>

I have some games in my mind.. but I can't seem to make them into a source code.
I want to make a little.. turn based game like a bit of Final Fantasy. Can it be possible?

Possible, of course. Doable with your current knowledge of C, the compiler, graphics, etc, only you can decide.

May be you can atleast start off with something and post your first hurdle here. This way we will be able to help you more precisely.

If this is for a class, I would suggest you think of something that would use the skills you've learned in class rather than trying to do something that will take a few months just to learn the basics of techniques you've never touched.

Look at something like Mastermind, Tic Tac Toe, Craps, Hangman. Something that won't take years to design and implement.

The key is design!!! Don't just sit an the computer and start programming. Sit as a desk and figure out how the game is supposed to work and figure out all the details of input, the play, the decisions, the output -- everything to make the game work. Once you figure all that out, it'll be fast and easy to actually write the code...

So don't touch the computer until you've figured out everything you need to do.

commented: very good points +5

Uhh.. I need help in understanding this code. My friend wants me to understand this. I understand some parts of it.. But I don't really know how everything goes. Please I need help. Here's the code, It's a game about Snake and Ladders.

#include<stdlib.h>
#include<stdio.h>
#include<conio.h>
#include<time.h>
#include<dos.h>
#include<graphics.h>

 void details();
 void pass();

void main()
{
 int i,j,v,count=0;
 char ch;
 details();
 pass();
  clrscr();
  printf("\n\n\n\t\t  ");
 textcolor(9);
 cprintf(" Welcome to the Games World\n\n\n");
 textcolor(4);
 printf("\n\n\n\n\t\t\t");
 cprintf(" Snake  & Ladder\n\n\n");
 printf("\t\t\t\t\t ");
 for(i=0;count<100;i++)
 {
   for(j=100;j>0;j--)
  {
   textcolor(5);
    if(j==4 || j==9 || j==1 || j==21 || j==28 || j==36 || j==51 || j==71 || j==80)
    cprintf("%2d#     ",j);
    else if(j==16 || j==47 || j==49 || j==56 || j==62|| j==64 || j==87 || j==93 || j==95||j==98)
    cprintf("%2d%c     ",j,1);
    else if(j==count)
    {
    textcolor(BLINK + (WHITE));
    cprintf("%2d      ",j);
    }
    else
    cprintf("%2d      ",j);
   }

  textcolor(5);
  puts("\n\n\n\n\n\n\n");
  cprintf("Press any key to throw the die\n");
  textcolor(5);
  puts("");
  cprintf("No. of thrown is %d",i);
  printf("\n\n\nTo Quit Press Y");
  ch=getch();
  if(ch=='Y' || ch=='y')
   exit(0);
  clrscr();
  puts("\n\n\t\t\tSnake  & Ladder\n\n");
  randomize();
  v=rand()%6+1;
  printf("\n\nThe value you have got is %d\n",v);
  count += v;
  printf("\nNow you are in %d position\n\n\n",count);
  ss:
  if(count==100)
  {
   clrscr();
   textmode(BW40);
   textcolor(10);
   cprintf("\n\n\nYou Won the game!!!");
   printf("\n\n\n  Congratulations !!!\n\n You have reached the goal\n");
   break;
  }
  else if(count>100)
  {
  clrscr();
   puts("\n\n\n\n\n\n\n\nSorry You crossed the limit!!!\nGo back!!!!\n");
   count-=v;
  }
  puts("");
  if(count==4)
   {
    textcolor(BLINK + (GREEN));
    cprintf("\n\n\nLADDER\n");
    printf(" \n\nCongratulations!!!\n You have got a promotion from %d\n",count);
    count+=10;
    printf("Now you are in %d position\n\n",count);
   }
   else if(count==9)
   {
    textcolor(BLINK + (GREEN));
    cprintf("\n\n\nLADDER\n");
    printf(" \n\nCongratulations!!!\n You have got a promotion from   %d\n",count);
    count+=22;
    printf("Now you are in %d position\n\n",count);
   }
   else if(count==1)
   {
    textcolor(BLINK + (GREEN));
    cprintf("\n\n\nLADDER\n");
    printf(" \n\nCongradulations!!!\n You have got a promotion from   %d\n",count);
    count+=37;
    printf("Now you are in %d position\n\n",count);
   }
   else if(count==28)
   {
    textcolor(BLINK + (GREEN));
    cprintf("\n\n\nBIG LADDER\n");
    printf(" \n\nCongradulations!!!\n You have got a promotion from    %d\n",count);
    count=84;
    printf("Now you are in %d position\n\n",count);
   }
   else if(count==36)
   {
    textcolor(BLINK + (GREEN));
    cprintf("\n\n\nLADDER\n");
    printf(" \n\nCongradulations!!!\n You have got a promotion from   %d\n",count);
    count=57;
    printf("Now you are in %d position\n\n",count);
   }
   else if(count==51)
   {
    textcolor(BLINK + (GREEN));
    cprintf("\n\n\nLADDER\n");
    printf(" \n\nCongradulations!!!\n You have got a promotion from   %d\n",count);
    count=67;
    printf("Now you are in %d position\n\n",count);
   }
   else if(count==71)
   {
    textcolor(BLINK + (GREEN));
    cprintf("\n\n\nLADDER\n");
    printf(" \n\nCongradulations!!!\n You have got a promotion from   %d \n",count);
    count=91;
    printf("Now you are in %d position\n\n",count);
   }
   else if(count==80)
   {
    textcolor(BLINK + (GREEN));
    cprintf("\n\n\nLADDER\n");
    printf(" \n\nCongradulations!!!\n You have got a promotion from   %d\n",count);
    count=100;
    printf("Now you are in %d position\n\n",count);
    goto ss;
   }
  else if(count==16)
  {
  textcolor(BLINK + (GREEN));
   cprintf("\n\nSNAKE\n");
   printf("\n\n\n\nSorry!!!!\nGo back ");
   printf("You have been missed from %d",count);
   count=6;
   delay(25);
   printf("\nNow you are in %d position\n\n",count);
  }
    else if(count==47)
  {
  textcolor(BLINK + (GREEN));
   cprintf("\n\n\nSNAKE\n");
   puts("\n\n\n\n\nSorry!!!\nGo back ");
   printf("You have been missed from %d",count);
   count=26;
   delay(25);
   printf("\nNow you are in %d position\n\n",count);
  }
    else if(count==49)
  {
  textcolor(BLINK + (GREEN));
   cprintf("\n\n\nSNAKE\n");
   puts("\n\n\n\n\nSorry!!!\nGo back ");
   printf("You have been missed from %d",count);
   count=11;
   delay(25);
   printf("\nNow you are in %d position\n\n",count);
  }
    else if(count==56)
  {
  textcolor(BLINK + (GREEN));
   cprintf("\n\n\nSNAKE\n");
   puts("\n\n\n\n\nSorry!!!\nGo back ");
   printf("You have been missed from %d",count);
   count=53;
   delay(25);
   printf("\nNow you are in %d position\n\n",count);
  }
    else if(count==62)
  {
  textcolor(BLINK + (GREEN));
   cprintf("\n\n\nBIG SNAKE\n");
   puts("\n\n\n\n\nSorry!!!\nGo back ");
   printf("You have been missed from %d",count);
   count=18;
   delay(25);
   printf("\nNow you are in %d position\n\n",count);
  }
    else if(count==64)
  {
  textcolor(BLINK + (GREEN));
   cprintf("\n\n\nSNAKE\n");
   puts("\n\n\n\n\nSorry!!!\nGo back ");
   printf("You have been missed from %d",count);
   count=60;
   delay(25);
   printf("\nNow you are in %d position\n\n",count);
  }
    else if(count==87)
  {
  textcolor(BLINK + (GREEN));
   cprintf("\n\n\nSNAKE\n");
   puts("\n\n\n\n\nSorry!!!\nGo back ");
   printf("You have been missed from %d",count);
   count=24;
   delay(25);
   printf("\nNow you are in %d position\n\n",count);
  }
    else if(count==93)
  {
  textcolor(BLINK + (GREEN));
   cprintf("\n\n\nSNAKE\n");
   puts("\n\n\n\n\nSorry!!!\nGo back ");
   printf("You have been missed from %d",count);
   count=73;
   delay(25);
   printf("\nNow you are in %d position\n\n",count);
  }
    else if(count==95)
  {
  textcolor(BLINK + (GREEN));
   cprintf("\n\n\nSNAKE\n");
   puts("\n\n\n\n\nSorry!!!\nGo back ");
   printf("You have been missed from %d",count);
   count=75;
   delay(25);
   printf("\nNow you are in %d position\n\n",count);
  }
    else if(count==98)
  {
  textcolor(BLINK + (GREEN));
   cprintf("\n\n\nSNAKE\n");
   puts("\n\n\n\n\nSorry!!!\nGo back ");
   printf("You have been missed from %d",count);
   count=78;
   delay(25);
   printf("\nNow you are in %d position\n\n",count);
  }
   }
  printf("\n\n\nNo. of chances you have taken to reach the goal is %d turns.",i+1);
  if(i<=30)
  {
   textcolor(BLINK+(14));
   puts("\n\n");
   cprintf("\tRECORD BREAKER\t");
   puts("");
   cprintf(" ______ _____  ");

   printf("\nYou are a");
   textcolor(BLINK+(RED));
   cprintf("Lucky Fellow");
   printf(" to reach goal within 30 chances");
   }


    getch();
  }

  void details()
  {
   int i,j;
   clrscr();
   delay(250);
   gotoxy(1,5);
   textcolor(5);
   for(i=1;i<=25;i++)
   {
    delay(250);
    cprintf("%c",17);
    cprintf("%c",15);
    cprintf("%c",16);
   }

   textcolor(5);
   printf("\n\n\n\n\n\n\n\n\n\n\n\n\n");
   printf("\n\n\n\n\n\n\n\n\n");
   printf("\n\n\n\n\n\n\n\n\n");
   printf("\n\n\n\n\n\n\n\n\n");
   for(i=1;i<=25;i++)
   {
    delay(250);
    cprintf("%c",17);
    cprintf("%c",15);
    cprintf("%c",16);
   }
   puts("");


   gotoxy(1,6);
   textcolor(6);
   for(i=1;i<9;i++)
   {

    delay(250);
    printf("%c\t\t\t\t\t\t\t\t\t %c\n",30,30);

    printf("%c\t\t\t\t\t\t\t\t\t %c\n",15,15);
    printf("%c\t\t\t\t\t\t\t\t\t %c\n",31,31);
    printf("\n\n");
   }

Uhh.. I need help in understanding this code. My friend wants me to understand this. I understand some parts of it..

Which parts don't you understand? Nobody is going to explain the whole program line by line, and we can't read your mind. I fail to see what's so difficult about asking a specific question.

Oh sorry. My bad. I don't know how the " void " part goes. I... just really don't know why it was there in the first place.. Specific void parts that I don't know was the void main, void details and void pass.I know gotoxy and such... j-just that void.. urgh..

void as a return type for a function means nothing more than the function doesn't return anything. It ultimately just means that you can't do this:

void function();

...

some_variable = function(); /* Can't do it, function doesn't return anything */

But why does it have something beneath that void? Does the info beneath it automatically works? Or is it other way around? If it was nothing, then why it was there? @_@

I'll suggest that you reread your book's chapter on functions, because you clearly don't understand the concept.

...
But I don't have any books, plus.. we didn't reached advanced functions like that..
I only know until array and characters.

Can I have your explanation on what voids are? Maybe I can understand it. ._.

A "void" is an empty area - like "space is mostly a huge void". It also means "amounting to nothing" as in "the lawsuit was made null and void".

So a void function is any function that returns nothing. It may say "return" at the end of it, but it will have no value after the word "return", and the use of the "return" word is strongly discouraged.

so.. it's just empty, like a null set? o.o
hmm.. so.. uhh.. the thingies beneath it.. still works?
thingies, I mean the gotoxy under that void main, the if-else statements..
does it still works? o.o

Yes. The void part only refers to the return value of the function, not the actual computation. The function runs; it simply doesn't have a return value.

BTW, strictly speaking, it should be int main() not void main(). The main() function does in fact return a value to the operating system, which is used to test the status of the program. The void main() is a common misunderstanding, often perpetuated by 'professors' who don't actually know what they are supposed to be teaching, but it is not portable and only some compilers accept it at all.

Oh cool. I understand it, somehow. xD
Thanks a lot guys. :D

But I don't have any books

I can't see any way that could go wrong. :rolleyes: Here, read this.

plus.. we didn't reached advanced functions like that..

Functions returning void are conceptually more basic than functions returning a non-void type. You're placing an unreasonable weight on the word "void" to mean something far more complex than it really does.

Can I have your explanation on what voids are? Maybe I can understand it. ._.

Maybe you can, but since I already explained what void means in the context of a return type and you didn't understand it, I'm not optimistic that repeating myself will change things until you have a stronger understanding of functions in general.

Can anyone plzzz send me code of car racing game using c language.... I need it ASAP.... Plzzzz reply....

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.