954,499 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

requesting a c programme for simple game

I have heard that games can be built using c language. I request someone to post the code for a simple game.(if possible,simple code too)..

sagar d
Newbie Poster
5 posts since Jun 2010
Reputation Points: 6
Solved Threads: 0
 

It's true. You can build games using C. But you can build better using C++.
Object oriented design helps a lot when you model the game world, entities
and entity interactions. Plus, there are very good libraries available to help.

As for your code request, I guess there are a couple of things I can give you...

The first was my first attempt to write a console based snake game. I attach the cpp file.

The second was an attempt to seduce a girl with an advanced version of the above.
You can get it here -> http://www.4shared.com/file/NXIQiQFA/love_snake.html

I'd appreciate it if you didn't ask whether the attempt was successful or not.

Attachments snake.cpp (8.88KB)
m4ster_r0shi
Posting Whiz in Training
230 posts since Mar 2010
Reputation Points: 154
Solved Threads: 31
 
I'd appreciate it if you didn't ask whether the attempt was successful or not.


Way to answer the question without it being asked. ;) If you'd rather not have someone ask, then clearly the attempt was unsuccessful.

Narue
Bad Cop
Administrator
15,460 posts since Sep 2004
Reputation Points: 6,464
Solved Threads: 1,401
 
...then clearly the attempt was unsuccessful.


Either that or that's what I want other people to believe.

m4ster_r0shi
Posting Whiz in Training
230 posts since Mar 2010
Reputation Points: 154
Solved Threads: 31
 
I have heard that games can be built using c language. I request someone to post the code for a simple game.(if possible,simple code too)..

I hope this will help check it out http://www.c.happycodings.com/Games_and_Graphics/code29.html

platinum8
Junior Poster
Banned
107 posts since Jul 2008
Reputation Points: 1
Solved Threads: 3
Infraction Points: 10
 

thanks a lot guys:)

sagar d
Newbie Poster
5 posts since Jun 2010
Reputation Points: 6
Solved Threads: 0
 

but if i copy the program in a note pad,how do i save it as a .cpp file so that i can open it using c?
n m really sry 4 u master roshi,wish u get a better gal next time:D

sagar d
Newbie Poster
5 posts since Jun 2010
Reputation Points: 6
Solved Threads: 0
 

& Mr.platinum 8. there are quite a number of errors in the program... pls,can u fix them up & help.

sagar d
Newbie Poster
5 posts since Jun 2010
Reputation Points: 6
Solved Threads: 0
 

Uh, perhaps you'd like to share the code?

but if i copy the program in a note pad,how do i save it as a .cpp file so that i can open it using c? n m really sry 4 u master roshi,wish u get a better gal next time

The standard file extension for C source files is .c, not .cpp.

imkj
Newbie Poster
10 posts since Jun 2010
Reputation Points: 10
Solved Threads: 1
 

If I may suggest ... C in a Nutshell from O'Reilly.

Kiss_and
Newbie Poster
7 posts since Jan 2008
Reputation Points: 10
Solved Threads: 1
 

Or, if you want a comprehensive guide, try "The C Programming Language" by Dennis Ritchie and Brian Kernighan. Dennis Ritchie was one of the original developers of C, the other being Ken Thompson (credited because he invented B -- the predecessor of C).

Here's a link:
http://www.amazon.com/Programming-Language-2nd-Brian-Kernighan/dp/0131103628/ref=sr_1_1?ie=UTF8&qid=1309996480&sr=8-1

imkj
Newbie Poster
10 posts since Jun 2010
Reputation Points: 10
Solved Threads: 1
 

@imkj:the code is the same thats above... both the links(4shared & c.happycodings.com) have got errors(sadly,too many)...

sagar d
Newbie Poster
5 posts since Jun 2010
Reputation Points: 6
Solved Threads: 0
 
@imkj:the code is the same thats above... both the links(4shared & c.happycodings.com) have got errors(sadly,too many)...


Then you should happily contact the author and askthem to rewrite it for you.

WaltP
Posting Sage w/ dash of thyme
Moderator
10,506 posts since May 2006
Reputation Points: 3,348
Solved Threads: 944
 
Then you should happily contact the author and ask them to rewrite it for you.

Or at least show some effort, and then, if you're still encountering errors, you can post the code in question. (The code generating errors, not the entire source file)

imkj
Newbie Poster
10 posts since Jun 2010
Reputation Points: 10
Solved Threads: 1
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You
View similar articles that have also been tagged: