Home
Start a new game
Explore games
Help
Log in or sign up
Log in
Username
Password (
Forgot it?
)
×
New to Playfic?
Full Name
Email
Username
Password
Password (confirm)
Are you sure about this?
AP CSP Create Project
by
Anish Gupta
Played 1,020 times
View game source
(spoilers!)
Download the
.z8 file
Source Code
"An Adventurer's Tale" When play begins: now the left hand status line is "You: [current hit points of player]HP"; now the right hand status line is "Beast: [current hit points of Beast]HP"; SwordTaken is a truth state that varies. SwordTaken is false. [checks if the sword has been taken] ShieldTaken is a truth state that varies. ShieldTaken is false. [checks if the shield has been taken] Armory is a room. "You find yourself in a shop that sells weapons and armor. You were tasked by the village master to defeat the wild beast lurking in the forest to the north and you are currently preparing for the confrontation. With the money you have left, you may want a good weapon for the journey ahead." Grassy Field is a room. Inside from Grassy Field is Armory. "In this open area, the forest lies up north, you can hear the sound of the beast in the distance followed by a scream!" Forest is a room. Forest is north of Field. "Only trees surround you. The scream seemed to be coming from the people surrounding a wild beast" a sword is in Armory. The description of a sword is " Good for attacking, built for defeating enemies. Deals up to 10HP." a shield is in Armory. The description of a shield is "The shield helps you defend enemy attacks. Reduces damage received up to 3HP." [The two following methods check the order in which the user takes the shield and sword and then give different outputs depending on if certain conditions.] After taking sword: if SwordTaken is false: say "The shopkeeper is willing to let you take the shield also."; now SwordTaken is true; stop the action; if SwordTaken is true: say "Seeing your interest in the shield, the shopkeeper provides it to you along with the sword."; say "You are now prepared to fight the beast."; stop the action; After taking shield: now ShieldTaken is true; if SwordTaken is false: say "You cannot take this right now."; now SwordTaken is true; stop the action; if SwordTaken is true: say "Now you are prepared to fight the beast. You will have to leave the armory to go on your journey"; a wild Beast is a person in Forest. "It lays its eyes on you and charges at you. This is your chance to attack and keep on fighting!! (See both of your HP at the top.)" The description of a wild Beast is "This is the beast that has been terrorizing the people of the village! Defeat it and save the people." A person has a number called maximum hit points. A person has a number called current hit points. The maximum hit points of the player is 100. The maximum hit points of the Beast is 100. The current hit points of the player is 100. The current hit points of the Beast is 100. [This method is the override for the attack command. subsequently, it checks if either the player or the beast has died] Instead of attacking someone: let the damage be a random number between 1 and 10; say "You dealt [damage]HP."; decrease the current hit points of the Beast by the damage; let the enemy damage be a random number between 1 and 10; let ShieldBlock be a random number between 1 and 3; if ShieldTaken is true: decrease the enemy damage by ShieldBlock; if enemy damage is less than 0: now enemy damage is 0; say "The Beast dealt [enemy damage]HP. Your shield blocked [ShieldBlock]HP."; if ShieldTaken is false: say "The Beast dealt [enemy damage]HP."; decrease the current hit points of the player by the enemy damage; if the current hit points of the player is less than 1: say "Oh no! You have lost. Next time try picking up something else that may block some of the damage from the beast. Thanks for playing."; end the story; if the current hit points of Beast is less than 1: say "The Beast dies, The people are overjoyed and the village has been saved! Thanks for playing."; end the story; stop the action;