Jack P. Oakley Portfolio Game Programmer/Designer

Monster Hunter

When I first touched MATLAB as a programming language, I thought it would be fun to make a game out of it, even a simple game.  I made this very short game without knowing much about MATLAB.  Since then, I have become much more familiar with it.  This program download requires either MATLAB or an m file interpreter to run.

%Matlab Monster Hunter Game by Jack P. Oakley

user_name=input('Hello user, I do not recognize you. What is your name? ');
fprintf('Good morning, %s.\n', user_name);
game_choice=input('Would you like to play a game? ');
play_game = (if game_choice == no
	fprintf('Goodbye, %s.\n', user_name);
elseif game_choice == yes
	fprintf('You have a gun, a magic knife, and a stake in your inventory. As you walk along the road, you come across a three way split.\n' ); 
	direction_choice=input('Would you like to head North, East, or West?\n' );
	if direction_choice == North
		fprintf('You come across a vampire!\n' );
		attack_choice=input('What do you defend yourself with? ');
		switch(attack_choice)
		case 'gun'
			fprintf('You shoot the vampire and make him angry. He is upon you in the blink of an eye and drains your body of blood in 3 seconds. You have died. You lose. Goodbye, it was fun playing with you %s.\n', user_name);
		case 'knife'
			fprintf('You stab the vampire with the knife. It only succeeds at making him angry. He turns and drains your body of blood in 3 seconds. You have died. You lose. Goodbye, it was fun playing with you %s.\n', user_name);
		case 'stake'
			fprintf('You stab the vampire through the heart with the wooden stake and he begins to grow old and wither right before your eyes. The vampire has been vanquished. You win. It was nice playing with you %s. Goodbye.\n', user_name);
	elseif direction_choice == East
		fprintf('You come across a ghost!\n' );
		attack_choice=input('What do you defend yourself with? ');
		switch(attack_choice)
		case 'gun'
			fprintf('You shoot the ghost and the bullet passes right through it. It then swoops down and possesses your body and causes you to snap your own neck. You have died. You lose. Goodbye, it was fun playing with you %s.\n', user_name);
		case 'knife'
			fprintf('You stab the ghost with the magic knife. It wails in pain then vanishes. The ghost has been sent to the netherworld. You win. Goodbye, it was fun playing with you %s.\n', user_name);
		case 'stake'
			fprintf('You attempt to stab ghost with the wooden stake. You pass right through the ghost and fall from your forward momentum. You accidentally impale yourself upon the stake. You died. You lose. Goodbye, it was fun playing with you %s.\n', user_name);
	elseif direction_choice == West
		fprintf('You come across a werewolf!\n' );
		attack_choice=input('What do you defend yourself with? ');
		switch(attack_choice)
		case 'gun'
			fprintf('You shoot the werewolf with a silver bullet. He transforms back to his human self and bleads out. The werewolf has been murdered by your hands. You win. Goodbye, it was fun playing with you %s.\n', user_name);
		case 'knife'
			fprintf('You stab the werewolf with the magic knife. He howls then rips out your throat with a single bite. You died. You lose. Goodbye, it was fun playing with you %s.\n', user_name);
		case 'stake'
			fprintf('You stab werewolf with the wooden stake. He howls in pain then devours you. You died. You lose. Goodbye, it was fun playing with you %s.\n', user_name);
	else
		fprintf('You decide not to adventure out and return home. Goodbye, it was fun playing with you %s.\n', user_name);
else
	fprintf('That answer is not recognized as being a valid response. Please try again.');
	play_game;);
fprintf('Thank you for playing, if you would like to play again, type MonsterHunterGame' );