Um, wow, yeah, sure, never thought anyone would have taken an interest.
import java.util.Scanner;
public class HelicopterPilot
{
public static void main(String[] args)
{
Scanner in = new Scanner(System.in);
String command,playagain;
int timer,manual,parachute,wearparachute,falling,safety,book;
playagain = "Y";
while(playagain.indexOf("y")==0 || playagain.indexOf("Y")==0)
{
System.out.println("You are taking a scenic helicopter tour above the South Dakota badlands.");
System.out.println("What do you want to do?");
System.out.print(">");
in.nextLine();
System.out.println("That's all well and good except your helicopter pilot just died.");
System.out.println("If you've never been in this situation before, type HELP. Otherwise, good luck!");
System.out.println("The helicopter starts plummeting wildly.");
timer = 0;
manual = 0;
parachute = 0;
wearparachute = 0;
falling = 0;
safety = 0;
book = 1;
while(timer < 15)
{
System.out.print(">");
command = in.nextLine();
if(falling == 0){
timer = timer + 1;
System.out.println("The helicopter plummets further.");
}
if(falling == 1)
{
timer = timer + 2;
System.out.println("Wheeeee!");
}
if(command.indexOf("HELP") == 0)
{
System.out.println("I reckon you're jolly well fucked.\nYou can try to FLY HELICOPTER or LOOK for something to help you out, or something maybe.\nAlso, you can keep track of the GROUND to help plan your actions.");
}
else if(command.indexOf("LOOK") == 0)
{
int look = (int)(5 * Math.random()) + 1;
if(look == 5 && manual == 0)
{
System.out.println("Awesome! You found a helicopter manual.\nI guess you could READ MANUAL and learn to fly this thing.");
manual = 1;
}
if(look == 4 && parachute == 0)
{
System.out.println("This could be just the thing. You found a parachute!\nYou may get out of this yet.\nWEAR PARACHUTE and JUMP and hope for the best!");
parachute = 1;
}
if(look == 3 || look == 2 || look == 1 || look == 0)
{
System.out.println("In your panicked searching you don't find anything of value.\nThere has to be something around here!");
}
if(falling == 1){
System.out.println("You look at the helicopter you abandoned. It is plummeting towards an orphanage.");
}
}
else if(command.indexOf("WEAR PARACHUTE") == 0)
{
if(parachute == 1)
{
System.out.println("Done! All you have to do is USE PARACHUTE now.");
wearparachute = 1;
if(falling == 1)
{
timer = timer + 1;
}
}
else if(parachute == 0)
{
System.out.println("What parachute?");
}
else if(wearparachute == 1)
{
System.out.println("You already are!");
}
}
else if(command.indexOf("FLY") == 0 && command.length() == 3)
{
if(wearparachute == 1 && falling == 0)
{
System.out.println("You can't fly! You are now free-falling.\nMaybe it's time to USE PARACHUTE.");
falling = 1;
}
if(wearparachute == 0 && falling == 0)
{
System.out.println("You can't fly! You flap your arms wildly.\nYou are now free-falling\nI hope you have a parachute! If so, WEAR PARACHUTE immediately.");
falling = 1;
}
if(falling == 1)
{
System.out.println("You flap your arms like a dumbass and fall like a brick.");
}
if(falling == 0 && wearparachute == 2)
{
System.out.println("You leap boldly out of the helicopter.\nThe tangled parachute lines wrap around your throat.\nYou hang yourself at 10,000 feet.");
timer = timer + 9000;
}
}
else if(command.indexOf("READ") == 0 && command.indexOf("MANUAL") == 5 && command.length() == 11)
{
if(book == 4)
{
book = book + 1;
timer = timer + 3;
System.out.println("You got this shit. For real. Let's floss and fly this son of a bitch outta here.");
}
if(book == 3)
{
System.out.println("You continue studying the manual.");
book = book + 1;
timer = timer + 2;
}
if(book == 2)
{
System.out.println("You narrow down your search to the landing section.\nYou feel a lot more confident now.");
book = book + 1;
timer = timer + 1;
}
if(book == 1)
{
System.out.println("You quickly scan the table of contents of the manual.\nYou feel as if you could find useful information under pressure much more easily.");
book = book + 1;
}
if(command.indexOf("READ") == 0 && timer > 15){
System.out.println("Unfortunately, this book is more interesting to you than the inevitable impact of helicopter on ground.");
}
}
else if(command.indexOf("USE PARACHUTE") == 0)
{
if(falling == 0)
{
System.out.println("Wow you're retarded. You release the parachute inside of the helicopter.\nIt gets tangled up on some shit and is now useless.");
wearparachute = 2;
}
if(falling == 1 && wearparachute == 1)
{
if(((int)(100*Math.random())+1) >= 66)
{
System.out.println("Awesome! You are now floating to safety.\nYou watch the helicopter crash into an orphanage.\nSucks to be them!");
safety = 1;
}
else if(((int)(100*Math.random())+1) < 66)
{
System.out.println("Shit. Parachute malfunction. It happens. Sorry mate...");
wearparachute = 0;
parachute = 0;
}
}
}
else if(command.indexOf("JUMP") == 0 && falling == 0 && wearparachute != 2)
{
System.out.println("You take a deep breath and leap out of the helicopter.\nIf you don't have a parachute, enjoy your suicide.\nIf you do, it's time to USE PARACHUTE.");
falling = 1;
}
else if(command.indexOf("JUMP") == 0 && falling == 0 && wearparachute == 2)
{
System.out.println("You leap boldly out of the helicopter.\nThe tangled parachute lines wrap around your throat.\nYou hang yourself at 10,000 feet.");
timer = timer + 9000;
}
else if(command.indexOf("GROUND") == 0)
{
System.out.println("You briefly look down at the Earth.");
if(timer <= 3)
{
System.out.println("Everything looks so tiny from up here, but the way it's lurching around makes you sick.");
}
else if(timer <= 6)
{
System.out.println("You can make out a lot of detail, and you even see a building down there.\nStrange that it's in the middle of nowhere, though.\nDammit, nevermind that, you're in danger here!");
}
else if(timer <= 9)
{
System.out.println("The ground is approaching at great speed. No hurry, though. Take your time.");
}
else if(timer <= 12)
{
System.out.println("This... does not look good. Impact imminent.");
}
else
{
System.out.println("OH FUUUUUUUUU");
}
}
else if(command.indexOf("FLY") == 0 && command.indexOf("HELICOPTER") == 4)
{
if(manual == 0)
{
System.out.println("You have no idea how to fly a helicopter! You don't even want to risk it.");
}
else if(manual == 1)
{
System.out.println("You flip to a random page in the helicopter manual and grip the throttle.");
if(((int)(100*Math.random())+1) >= 80/book)
{
System.out.println("You base all your hopes on page " + (int)(1000*Math.random() + 1) + ".\n\nAwesome! You skillfully get the flailing helicopter under control.\nYou take it down for a landing.");
safety = 1;
timer = timer + 9000;
}
else
{
System.out.println("You base all your hopes on page " + (int)(1000*Math.random() + 1) + ".\n\nThe helicopter is now falling 50 times faster.\nStraight at an orphanage.\nFuck.\n");
timer = timer + 9000;
}
}
}
else
{
if(falling == 0)
{
System.out.println("You realize you are inside of a wildly careening helicopter 10,000 feet up.\nYou panic");
}
else if(falling == 1)
{
System.out.println("You watch serenely as the ground comes closer and closer.\nYou think you see your house.\nYou also ponder the meaningless of life and parachutes.");
}
}
}
if(safety == 1)
{
System.out.println("Excelsior! You survived! Now go fuck your girlfriend.");
}
if(safety == 0)
{
System.out.println("SPLAT!!!\nYou fucking died.");
}
System.out.println("\nWould you like to play again?");
playagain= in.nextLine();
}
}
}
AFAIK it has to be run in a java compiler, heh. No real interface to speak of. Just the input and output streams.
Also if you play it, there is no parser or any sort of catch for suboptimal input, so if you don't give the game the exact command it wants, it just defaults to a "you panic and do nothing useful" output.
As for the other game, Goblin Kill...
import java.util.Scanner;
public class GoblinKill
{
public static void main(String[] args)
{
Scanner in = new Scanner(System.in);
System.out.println("Welcome to Goblin Kill alpha version 1.00a!");
System.out.println("Conceived and coded with tender loving care by some asshole.");
System.out.println("Before you get to the goblin-killing, let's figure out how good of a fighter you are.");
System.out.println("Type Stat to GET SOME!");
System.out.print(">");
String stats = in.nextLine();
while (stats.indexOf("Stat") != 0 || stats.length() != 4){
if(stats.indexOf("Stat") != 0 || stats.length() != 4){
System.out.println("I said type Stat you stupid fucking asshole.");
System.out.print(">");
stats = in.nextLine();
}
}
System.out.println("Thanks. Your stats are as follows:");
int str = (int)(15 * Math.random()) + 3;
int strmod = (str - 10) / 2;
int dex = (int)(15 * Math.random()) + 3;
int dexmod = (dex - 10) / 2;
int con = (int)(15 * Math.random()) + 3;
int conmod = (con) / 2;
int wis = (int)(15 * Math.random()) + 3;
int wismod = (wis - 10) / 2;
int intel = (int)(15 * Math.random()) + 3;
int intmod = (intel - 10) / 2;
int cha = (int)(15 * Math.random()) + 3;
int chamod = (cha - 10) / 2;
System.out.println("Strength: " + str + " (" + strmod + ") " + "\nDexterity: " + dex +" (" + dexmod + ") " + "\nConstitution: " + con +" (" + conmod + ") " + "\nWisdom: " + wis +" (" + wismod + ") " + "\nIntelligence: " + intel +" (" + intmod + ") " + "\nCharisma: " + cha +" (" + chamod + ")");
System.out.println("Are you a pussy? If you don't like these stats, type Restat.\nYou can only restat 3 times. Otherwise, type OK.");
int restats = 0;
System.out.print(">");
String restat = in.nextLine();
while(restats < 3){
if(restat.indexOf("Restat") == 0 && restat.length() == 6){
restats = restats + 1;
System.out.println("Ok you ingrateful son of a bitch. Fine. How about these.");
str = (int)(15 * Math.random()) + 3;
strmod = (str - 10) / 2;
dex = (int)(15 * Math.random()) + 3;
dexmod = (dex - 10) / 2;
con = (int)(15 * Math.random()) + 3;
conmod = (con - 10) / 2;
wis = (int)(15 * Math.random()) + 3;
wismod = (wis - 10) / 2;
intel = (int)(15 * Math.random()) + 3;
intmod = (intel - 10) / 2;
cha = (int)(15 * Math.random()) + 3;
chamod = (cha - 10) / 2;
System.out.println("Strength: " + str + " (" + strmod + ") " + "\nDexterity: " + dex +" (" + dexmod + ") " + "\nConstitution: " + con +" (" + conmod + ") " + "\nWisdom: " + wis +" (" + wismod + ") " + "\nIntelligence: " + intel +" (" + intmod + ") " + "\nCharisma: " + cha +" (" + chamod + ")");
System.out.println("Satisfied? If so, type OK. If not, try Restat again. You have " + (3 - restats) + " left.");
System.out.print(">");
restat = in.nextLine();
}
else if(restat.indexOf("OK") == 0 && restat.length() == 2){
System.out.println("YEAH LET'S DO THIS SHIT YO");
restats = restats + 9000;
}
else{
System.out.println("Dude you are a fucking asshole. Either type OK or Restat.\nThis is not fucking negotiable. I will kill you.");
System.out.print(">");
restat = in.nextLine();
}
}
if(restats == 3){
System.out.println("Too bad, you're stuck with this shit now.");
}
System.out.println("Oh yeah. Do you want to be a mighty, skilled Fighter, a mysterious Wizard, or a stealthy Rogue?");
System.out.print(">");
in.nextLine();
System.out.println("Fighter it is! You have chosen wisely.");
System.out.println("Ok, here's how this works. You will encounter goblins.\nIt is your divine duty to slaughter these horrid creatures.\nDo you understand?");
System.out.print(">");
in.nextLine();
System.out.println("Good. To kill a goblin, type kill. Just as a warning, the goblins will not hesitate to kill you.\nSo make sure you don't dick around when goblins are about.");
int hitpoints = (con*10)+(conmod*5);
int goblin,gobhp,gobstr,gobstrmod,gobdex,gobdexmod,gobcon,gobconmod,score,check,gobswing,swing,gobdamage,damage;
String command,fightcommand;
score = 0;
System.out.println("Alright, here we go! Tell me a location where you would like to hunt goblins.");
System.out.print(">");
in.nextLine();
System.out.println("That's stupid. You're stupid.");
System.out.println("You are hunting goblins in the forest.\nType look (or l) to look for goblins, type kill (or k) when you find one.");
System.out.println("P.S. Your hitpoints are currently " + hitpoints + ".");
goblin = 0;
while(hitpoints > 0)
{
System.out.print(">");
command = in.nextLine();
if(command.indexOf("look") == 0 || (command.indexOf("l") == 0 && command.length() == 1))
{
check = (int)(100 * Math.random());
if(check >=75)
{
System.out.println("You find a goblin!");
goblin = goblin + 1;
gobstr = (int)(12 * Math.random()) + 3;
gobstrmod = (gobstr - 10) / 2;
gobdex = (int)(12 * Math.random()) + 3;
gobdexmod = (gobdex - 10) / 2;
gobcon = (int)(12 * Math.random()) + 3;
gobconmod = (gobcon - 10) / 2;
gobhp = (gobcon*7)+(gobconmod*5);
while((hitpoints > 0 && goblin == 1))
{
System.out.print(">");
fightcommand = in.nextLine();
while(hitpoints > 0 && gobhp > 0)
{
if(fightcommand.indexOf("kill") == 0 || (fightcommand.indexOf("k") == 0 && fightcommand.length() == 1))
{
swing = dexmod + (int)(20 * Math.random() + 1);
if(swing > (10 + gobdexmod))
{
damage = Math.abs(strmod + (int)(10* Math.random() + 1));
gobhp = gobhp - damage;
System.out.println("You deal the goblin a terrible blow for " + damage + " damage!");
}
else{
System.out.println("The goblin nimbly dodges your attack! Or maybe you just suck.");
}
gobswing = gobdexmod + (int)(20 * Math.random() + 1);
if(gobswing > (10 + dexmod)){
gobdamage = Math.abs(gobstrmod + (int)(10 * Math.random() + 1));
hitpoints = hitpoints - gobdamage;
System.out.println("The goblin bites you or something for " + gobdamage + " damage!");
System.out.println("You have " + hitpoints + " left...");
}
else{
System.out.println("The stupid goblin sucks at fighting.");
}
}
else{
System.out.println("You stand there picking your ass.");
gobswing = Math.abs(gobdexmod + (int)(20 * Math.random() + 1));
if(gobswing > (10 + dexmod)){
gobdamage = gobstrmod + (int)(10 * Math.random() + 1);
hitpoints = hitpoints - gobdamage;
System.out.println("The goblin whacks you up for " + gobdamage + " damage! Maybe you should kill it.");
System.out.println("You have " + hitpoints + " left...");
}
else{
System.out.println("Somehow the goblin manages to miss you.");
}
}
System.out.print(">");
fightcommand = in.nextLine();
}
if(hitpoints > 0){
score = score + 1;
goblin = goblin - 1;
System.out.println("You killed a goblin!\nYou wipe it's blood off your face and prepare for your next challenge.");
}
}
}
else{
System.out.println("You don't see any goblins... yet.");
}
}
else if(command.indexOf("kill") == 0 || (command.indexOf("k") == 0)){
System.out.println("Do you even see a goblin?");
}
else{
System.out.println("That is not a valid command, dumbass. Maybe someday I'll code it in.");
}
}
if(goblin == 1){
System.out.println("You are dead!\nYou killed " + score + " goblins before you bit it.\nGo tell all your friends!");
}
else
{
System.out.println("You and the goblin killed each other in an epic maneuver!\nYou killed " + score + " goblins before you bit it.\nGo tell all your friends!");
}
}
}
This game is notable in that it has the worst fucking gameplay ever. Just spam l until you find a goblin then spam k until it's dead. Rinse, repeat.
Someday I may revisit these. The code isn't as horribly unreadable as I remember. Either one could be the bare-bones skeleton (at least in terms of concept and plot) for a greater project...
Anyway, tell me what you think. Remember: These were my first attempts at coding something for myself, ever. I was in an introductory programming class and got antsy, wanted to jump right in, taught myself a lot. Needless to say I passed that class with flying colors because of all my extracurricular coding.
Also pardon the foul language, I think calculus midterms were stressing me out at the time