oaky's text-based adventure game - made in glorious c
4 posters
Page 1 of 2
Page 1 of 2 • 1, 2
oaky's text-based adventure game - made in glorious c
windows-only version
- Code:
/*
============================================================================
Name : text adventure
Author : oaky
Version : 1.00
Copyright : fuknerds license
Description : sample adventure that can be made with this quality engine
============================================================================
*/
#include <stdio.h>
#include <stdlib.h>
#include <windows.h> // for windoze support
int health = 100;
int armor = 0;
void main() {
startGame(); // Begin game, and continue until the game is beaten.
return 0;
}
void startGame() {
char input; // Only one character in size.
printf(" Text Adventure Game! \n");
printf("You are in a dark room. Your hands are binded. What do you do? \n");
printf("(S)ay 'help!' | (B)reak your bonds | (C)ommit Adultery :>");
scanf("%c",&input); // Pointer for input (determined to be a char by %c)
// Input check
if(input == 's') {
write("You shout for help, but nobody hears you. \n");
write("You slowly starve to death. \n");
update(0,0);
blinkGameOver();
return;
}
if(input == 'b') {
write("As hard as you can, you struggle to break free from the bonds. \n");
write("You slowly starve to death. \n");
update(0,0);
blinkGameOver();
return;
}
if(input == 'c') {
write("Adultery is sinful. \n");
// Zap!
write("You were struck down by the lord. \n");
update(0,0);
blinkGameOver();
return;
}
}
void write(char input[]) { // The glorious write-it-out method.
int i; // Declare counter.
for(i=0;i<strlen(input);i++) {
printf("%c",input[i]);
if(i & 1) { // Every other character.
if(input[i] != " ") { // If the character is not a space.
Beep(400,10);
}
}
Sleep(50);
}
}
void update(int healthAmt, int armorAmt) {
Sleep(1000);
health = healthAmt;
armor = armorAmt; // Set values equal to what is given.
if(health == 0) { // If the game is over, play this noise and print the text as the 'death beep' plays.
Beep(2500,500); // Heart monitor sound.
Beep(0,500);
Beep(2500,600);
Beep(0,700);
Beep(2500,700);
Beep(0,900);
printf("\n HEALTH: %d \n",health);
Beep(2500,3000);
}
else { // Otherwise, just show the health (and armor).
Beep(200,1000);
printf("\n HEALTH: %d \n",health);
}
if(armor > 0) {
printf("ARMOR: %d \n",armor);
}
}
void clearScreen() {
printf("\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n"); // Clear the screen.
// Note: clear-screen speed?
}
void blinkGameOver() {
int i; // Declare counter.
int i2; // Other counter.
printf(" "); // Prints without tapping.
write("GAME OVER \n");
Sleep(1000);
for(i=0; i<1000; i++) {
for(i2=0; i2<10; i2++) {
printf(" GAME OVER \n");
clearScreen();
}
}
}
- Code:
/*
============================================================================
Name : text adventure [posix]
Author : oaky
Version : 1.00
Copyright : fuknerds license
Description : sample adventure that can be made with this quality engine with improved unix functionality
============================================================================
*/
#include <stdio.h>
#include <unistd.h>
#include <curses.h> // needed for that glorious beep
//uncomment the below line if the shit ain't working
//#include <stdlib.h>
int health = 100;
int armor = 0;
void main() {
startGame(); // Begin game!
return 0; // Shit closed successfully
}
void startGame() {
char input; // Only one character in size.
printf(" Text Adventure Game! \n");
printf("You are in a dark room. Your hands are binded. What do you do? \n");
printf("(S)ay 'help!' | (B)reak your bonds | (C)ommit Adultery :>");
scanf("%c",&input); // Pointer for input (determined to be a char by %c)
// Input check
if(input == 's') {
write("You shout for help, but nobody hears you. \n");
write("You slowly starve to death. \n");
update(0,0);
blinkGameOver();
return;
}
if(input == 'b') {
write("As hard as you can, you struggle to break free from the bonds. \n");
write("You slowly starve to death. \n");
update(0,0);
blinkGameOver();
return;
}
if(input == 'c') {
write("Adultery is sinful. \n");
// Zap!
write("You were struck down by the lord. \n");
update(0,0);
blinkGameOver();
return;
}
}
void write(char input[]) { // The glorious write-it-out method.
int i; // Declare counter.
for(i=0;i<strlen(input);i++) {
printf("%c",input[i]);
if(i & 1) { // Every other character.
if(input[i] != " ") { // If the character is not a space.
beep();
}
}
usleep(50);
}
}
void update(int healthAmt, int armorAmt) {
usleep(1000);
health = healthAmt;
armor = armorAmt; // Set values equal to what is given.
if(health == 0) { // If the game is over, play this noise and print the text as the 'death beep' plays.
beep(); // Heart monitor sound.
usleep(500);
beep();
usleep(500);
beep();
usleep(500);
printf("\n HEALTH: %d \n",health);
beep();
flash();
}
else { // Otherwise, just show the health (and armor).
beep();
printf("\n HEALTH: %d \n",health);
}
if(armor > 0) {
printf("ARMOR: %d \n",armor);
}
}
void clearScreen() {
printf("\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n"); // Clear the screen.
// Note: clear-screen speed?
}
void blinkGameOver() {
int i; // Declare counter.
int i2; // Other counter.
printf(" "); // Prints without tapping.
write("GAME OVER \n");
usleep(1000);
for(i=0; i<1000; i++) {
for(i2=0; i2<10; i2++) {
printf(" GAME OVER \n");
clearScreen();
}
}
}
Last edited by seth on Sun Dec 29, 2013 11:38 am; edited 1 time in total
LEADER OF THE FREE WORLD- UNSTOPPABLE
- Posts : 21233
money : 2147483634
bitches : -828
Join date : 2013-02-25
Age : 14
Location : worlds most dangerous hacker
Humor : bench 420 squat 420 deadlift 420
Re: oaky's text-based adventure game - made in glorious c
this would actually run on liniks without any libraries other than stdlib and stdio im pretty sure you can replace 'Sleep' with nanosleep or whatever it's called
LEADER OF THE FREE WORLD- UNSTOPPABLE
- Posts : 21233
money : 2147483634
bitches : -828
Join date : 2013-02-25
Age : 14
Location : worlds most dangerous hacker
Humor : bench 420 squat 420 deadlift 420
Re: oaky's text-based adventure game - made in glorious c
what do i save this as to run it
.exe? .bin? im retarded when it comes to this shit
.exe? .bin? im retarded when it comes to this shit
Last edited by spinnythings on Wed Nov 27, 2013 10:45 pm; edited 2 times in total
Guest- Guest
Re: oaky's text-based adventure game - made in glorious c
lol it's in C you need to compile it and shitspinnythings wrote:what do i save this as to run it
.exe? .bin?
amsk8hurr- shameless shitposter
- Posts : 671
money : 721
bitches : 1
Join date : 2013-11-24
Age : 27
Re: oaky's text-based adventure game - made in glorious c
gonna see if i can compile this on linux for shits and giggles
amsk8hurr- shameless shitposter
- Posts : 671
money : 721
bitches : 1
Join date : 2013-11-24
Age : 27
Re: oaky's text-based adventure game - made in glorious c
lol gayamsk8hurr wrote:lol it's in C you need to compile it and shitspinnythings wrote:what do i save this as to run it
.exe? .bin?
Guest- Guest
Re: oaky's text-based adventure game - made in glorious c
take screenshotsamsk8hurr wrote:gonna see if i can compile this on linux for shits and giggles
Guest- Guest
Re: oaky's text-based adventure game - made in glorious c
i can just cut and pastespinnythings wrote:take screenshotsamsk8hurr wrote:gonna see if i can compile this on linux for shits and giggles
gcc is proudly command-line
amsk8hurr- shameless shitposter
- Posts : 671
money : 721
bitches : 1
Join date : 2013-11-24
Age : 27
Re: oaky's text-based adventure game - made in glorious c
unless your linux has windows.h i dont think it'll work haha
LEADER OF THE FREE WORLD- UNSTOPPABLE
- Posts : 21233
money : 2147483634
bitches : -828
Join date : 2013-02-25
Age : 14
Location : worlds most dangerous hacker
Humor : bench 420 squat 420 deadlift 420
Re: oaky's text-based adventure game - made in glorious c
here hold on i'll try converting it to linuks
LEADER OF THE FREE WORLD- UNSTOPPABLE
- Posts : 21233
money : 2147483634
bitches : -828
Join date : 2013-02-25
Age : 14
Location : worlds most dangerous hacker
Humor : bench 420 squat 420 deadlift 420
Re: oaky's text-based adventure game - made in glorious c
eat my dick fag stop ruining my fun
amsk8hurr- shameless shitposter
- Posts : 671
money : 721
bitches : 1
Join date : 2013-11-24
Age : 27
Re: oaky's text-based adventure game - made in glorious c
compiling anyways
whatever gay facist compiler you use is inferior to gcc btw
whatever gay facist compiler you use is inferior to gcc btw
amsk8hurr- shameless shitposter
- Posts : 671
money : 721
bitches : 1
Join date : 2013-11-24
Age : 27
Re: oaky's text-based adventure game - made in glorious c
replace #include with change 'sleep' to lowercase and divide by 1000 since its in seconds
LEADER OF THE FREE WORLD- UNSTOPPABLE
- Posts : 21233
money : 2147483634
bitches : -828
Join date : 2013-02-25
Age : 14
Location : worlds most dangerous hacker
Humor : bench 420 squat 420 deadlift 420
Re: oaky's text-based adventure game - made in glorious c
gcc ported to windoze called 'mingw'amsk8hurr wrote:compiling anyways
whatever gay facist compiler you use is inferior to gcc btw
LEADER OF THE FREE WORLD- UNSTOPPABLE
- Posts : 21233
money : 2147483634
bitches : -828
Join date : 2013-02-25
Age : 14
Location : worlds most dangerous hacker
Humor : bench 420 squat 420 deadlift 420
Re: oaky's text-based adventure game - made in glorious c
"minimalist gnu for windows"SETH TRAIN wrote:gcc ported to windoze called 'mingw'amsk8hurr wrote:compiling anyways
whatever gay facist compiler you use is inferior to gcc btw
wtf why not just use gnuwin32
amsk8hurr- shameless shitposter
- Posts : 671
money : 721
bitches : 1
Join date : 2013-11-24
Age : 27
Re: oaky's text-based adventure game - made in glorious c
and im almost certain that gcc has an official windongs port
amsk8hurr- shameless shitposter
- Posts : 671
money : 721
bitches : 1
Join date : 2013-11-24
Age : 27
Re: oaky's text-based adventure game - made in glorious c
it doesnt matter none of them will be cross-platform they all need windows.h to use the win32 libraries instead of posix shitamsk8hurr wrote:"minimalist gnu for windows"SETH TRAIN wrote:gcc ported to windoze called 'mingw'amsk8hurr wrote:compiling anyways
whatever gay facist compiler you use is inferior to gcc btw
wtf why not just use gnuwin32
LEADER OF THE FREE WORLD- UNSTOPPABLE
- Posts : 21233
money : 2147483634
bitches : -828
Join date : 2013-02-25
Age : 14
Location : worlds most dangerous hacker
Humor : bench 420 squat 420 deadlift 420
Re: oaky's text-based adventure game - made in glorious c
if windows followed posix guidelines maybe it wouldnt be so fuckin shitty
amsk8hurr- shameless shitposter
- Posts : 671
money : 721
bitches : 1
Join date : 2013-11-24
Age : 27
LEADER OF THE FREE WORLD- UNSTOPPABLE
- Posts : 21233
money : 2147483634
bitches : -828
Join date : 2013-02-25
Age : 14
Location : worlds most dangerous hacker
Humor : bench 420 squat 420 deadlift 420
Re: oaky's text-based adventure game - made in glorious c
oops i should have wrote 'your hands are bound' whatever
LEADER OF THE FREE WORLD- UNSTOPPABLE
- Posts : 21233
money : 2147483634
bitches : -828
Join date : 2013-02-25
Age : 14
Location : worlds most dangerous hacker
Humor : bench 420 squat 420 deadlift 420
Re: oaky's text-based adventure game - made in glorious c
spinnythings is speechless as he imagines the power of my game engine running on pure glorious c
LEADER OF THE FREE WORLD- UNSTOPPABLE
- Posts : 21233
money : 2147483634
bitches : -828
Join date : 2013-02-25
Age : 14
Location : worlds most dangerous hacker
Humor : bench 420 squat 420 deadlift 420
Re: oaky's text-based adventure game - made in glorious c
every le video gayme dev in the world dies at the sound of "HEALTH: 0"
LEADER OF THE FREE WORLD- UNSTOPPABLE
- Posts : 21233
money : 2147483634
bitches : -828
Join date : 2013-02-25
Age : 14
Location : worlds most dangerous hacker
Humor : bench 420 squat 420 deadlift 420
Re: oaky's text-based adventure game - made in glorious c
mfw stupid ammers won't even compile my posix-compliant source code
LEADER OF THE FREE WORLD- UNSTOPPABLE
- Posts : 21233
money : 2147483634
bitches : -828
Join date : 2013-02-25
Age : 14
Location : worlds most dangerous hacker
Humor : bench 420 squat 420 deadlift 420
Re: oaky's text-based adventure game - made in glorious c
dont compile itsa a virus
am- Posts : 1028
money : 1109
bitches : 12
Join date : 2013-11-05
Age : 27
Humor : I don't like amsk8r that much; his autism usually gets the better of him.
Re: oaky's text-based adventure game - made in glorious c
please compile so i know if it works!
LEADER OF THE FREE WORLD- UNSTOPPABLE
- Posts : 21233
money : 2147483634
bitches : -828
Join date : 2013-02-25
Age : 14
Location : worlds most dangerous hacker
Humor : bench 420 squat 420 deadlift 420
Page 1 of 2 • 1, 2
Page 1 of 2
Permissions in this forum:
You cannot reply to topics in this forum
|
|