grade 10 mid-semester culminating
Author |
Message |
mace
|
Posted: Mon Jun 30, 2008 1:13 am Post subject: grade 10 mid-semester culminating |
|
|
here is my grade 10 mid-semester culminating
i would have used graphics but the outline said to use asci symbols and background colors
i know that some parts seem stupid (like the startup window) but i had to put it all in to get full marks
however my teacher didnt let me hand it in because he said it was too advanced for the course, and he might make the final culminating an RPG (which he didnt)
so I would like you opinion on it, since my teacher never seen it
once u get to the loading screen hit any button, then hit any button again to get past the text
you use WASD to move
Q to bring up your stats menu(move to take it down dont hit Q again)
and E brings up the loading and saving screen
the object of the game is to kill all the zombies on the screen (green asterisks)
to get in a building simply walk into it
when you die you lose all of your money and the number of zombies resets to their max
i tried to incorporate RPG like things into the game, aka, leveling up your skills and upgrading you equipment
i have never actual beat the game, seeing as how it takes forever to level up to kill the hardest zombies
Turing: |
/* MYRPG.t
this is a game that is a zombie RPG
*/
setscreen ("nocursor") %removes the cursor from the screen
const up : char := chr (ord ("w")) %the variable that will hold tyhe button to move up
const left : char := chr (ord ("a")) %the variable that will hold tyhe button to move left
const right : char := chr (ord ("d")) %the variable that will hold tyhe button to move right
const down : char := chr (ord ("s")) %the variable that will hold tyhe button to move down
const stats : char := chr (ord ("q")) %the variable that will hold tyhe button to access your inventory
const saveload : char := chr (ord ("e")) %the variable used for the menu button
var columnName : int := 1 %the variable that will be used to write columns for the title screen
var life : boolean := true %the variable that will be used to see if the player is alive
var zombies : array 1 .. 50 of boolean %the array that will be used to see if teh zombies are alive
var zombiesRow : array 1 .. 50 of int %the array that will store the row were each ombie will be put
var zombiesColumn : array 1 .. 50 of int %the array that will be used to store the column for each zombie
var zombieHealth : array 1 .. 50 of int %the array that will be used to store the health of each zombie
var zombieDamageStart : array 1 .. 50 of int %the array that will be used to hold the starting range for teh damage done by the zombie
var zombieDamageEnd : array 1 .. 50 of int %the array that will be used to hold the ending range for teh damage done by the zombie
var zombieLootStart : array 1 .. 50 of int %the array that will be used to hold the starting range for teh loot given by the zombie
var zombieLootEnd : array 1 .. 50 of int %the array that will be used to hold the ending range for teh loot given by the zombie
var zombieRowPrepare, zombieColumnPrepare : int %teh intergers that will be used to prepare teh zombie column and row arrays to accept values
var zombieRowSee, zombieColumnSee : boolean %the variables that wil be used to see if two zombies are touching
var chars : array char of boolean %the array that is used to hold that carachters that is used for moving
var column, row : int := 1 %the aintergers that will be used to control the players row and column
var gameTime : int := 1 %the interger that will be used to control teh players speed
row := 15 %sets the player to begin in the middle of town
column := 65 %sets the player to begin in the middle of town
var strength, defence : int := 5 %the variables that will be used to hold the values for the player strenght and defence
var loot, gold, lootGot : int %the variables that will be used to hold the players loot, their gold, and to colculate the loot teh payer gets from each
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%zombie
gold := 100 %sets the players starting gold at 100
loot := 0 %sets the player to being with no loot from dead zombies
var command : string %the varriable that will be used to get commands from teh user
var character : string (1) %the variable that will be used for teh player ot hit any key to continue
var gun, sword, ammo, medPacks : int := 20 %the variable that will hold teh strenght of the players gun, the strenght of the player sword,
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% the amount of ammo the player has, and the amount of medpacks the player has, respectavely
var health, fullHealth : int := 100 %the variables that will be used to control the amount of health, and teh vales for full health, each are set at 100
var moveUp, moveDown, moveRight, moveLeft : boolean := true %teh boolean varible that will eb used to see if the player is going to move up, down, right,
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% or left, respectavily
var deadZombies, totDeadZombies : int := 0 %the variables that will be used to see how many zombies are dead on teh current map, and how many zombies have
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% been killed in total
var count : int %the variable that will be used to run through each zombie when they are being assigned their rows and columns
var battleNumber : int %the variable that will hold the number of the zombie that the player is currentl fighting
var zombieDamage : int %the variable that will be used to calculate teh damage done by the zombies
var commandInt : int %the variabel that will be used when teh player is entering any 'number' of things
var line : int := 0 %this will control which line to put the spaces on in the zombie face
var amount : int := 0 %this variable will control how many spaces to put in the zombie face
var save : int
var load : int
procedure drawZombie %the drawZombie proceudre that will eb used to draw teh zombies faces
colorback (brown) %changes the color, to teh color of the zombie skin
amount := 0 %resets teh amount of spaces
line := 0 %esets teh amount of rows
for count : 1 .. 10 %this will run through 5 rows
amount + = 1 %increases the number of spaces to put, per line
line + = 1 %increases the row number
locate (line, 40 - amount * 2) %goes to the proepr area to put the spaces, makes enough space for the spaces
for count1 : 1 .. amount * 2 %puts as many spaces as needed
put " " .. %puts teh spaces
end for
end for
for count : 1 .. 10 %this will run through 5 rows
amount - = 1 %decreases the number of spaces to put, per line
line + = 1 %increases the row number
locate (line, 40 - amount * 2) %goes to the proepr area to put the spaces, makes enough space for the spaces
for count1 : 1 .. amount * 2 %puts as many spaces as needed
put " " .. %puts teh spaces
end for
end for
colorback (brightred) %changes the color, to teh color of the zombie eyes
for eyes : 1 .. 3 %runs through three rows, for the eyes
locate (5 + eyes, 33) %locates and puts the left eye
put " " ..
locate (5 + eyes, 43) %locates and puts the right eye
put " " ..
end for
colorback (black) %changes the color to the color of the zombie pupil, and mouth
color (brightred) %changes the color of teh character that will go in the zombie eye
locate (7, 34) %locates and puts the left pupil, in the middle of the left eye
put "*" ..
locate (7, 44) %locates and puts the left pupil, in the middle of the right eye
put "*" ..
locate (12, 38) %locates and draws the first line of the mouth
put " " ..
locate (13, 37) %locates and draws the second line of the mouth
put " " ..
locate (14, 38) %locates and draws the fourth line of the mouth
put " " ..
colorback (brown) %changes the color, to teh color of the zombie skin
for count : 18 .. 25 %loops from teh bottem of the zombies head to teh bottem of teh screen
locate (count, 35) %locates the middle of the zombies head
put " " .. %draws the zombies neck
end for
for count : 20 .. 25 %loops from teh bottem of the zombies neck to teh bottem of teh screen
locate (count, 25) %locates the middle of the zombies head
put " " .. %draws the zombies shoulders
end for
colorback (black) %sets the color that will be used to outline the zombies arms
for count : 22 .. 25 %goes through three rows, to outline the zombies arms
locate (count, 30) %locates to draw for the left arm
put " " .. %draws the left arm
end for
for count : 22 .. 25 %goes through three rows, to outline the zombies arms
locate (count, 50) %locates to draw for the right arm
put " " .. %draws the right arm
end for
getch (character ) %waits for the user to enter any key
cls %clears the screen %clears the screen
colorback (white) %sets the background color to the normal color
color (black) %sets the color to the normal color
end drawZombie
process music % the process that will teh used to play the music at teh end of teh game
for musicCount2 : 1 .. 7 %this for statement will run the music 7 times during the credits
for musicCount : 1 .. 4 %this for statement will run this chorus for times
sound (100, 200) %plays a frequency for a duration
sound (110, 200)
sound (150, 200)
sound (200, 200)
sound (150, 200)
sound (100, 200)
end for
sound (100, 400)
sound (120, 400)
sound (100, 400)
sound (150, 400)
for musicCount : 1 .. 2 %this for statement will be used to play the following chorus twice
sound (400, 200)
sound (200, 200)
sound (500, 200)
sound (200, 200)
sound (300, 200)
end for
sound (175, 400)
sound (200, 400)
sound (100, 400)
sound (175, 400)
sound (200, 400)
end for
end music
procedure zombiePrepareTot %the proceude that will be used to prepare the zombies for teh game
for zombieHealthCount : 1 .. 50 %this loop will set the health of each zombie, based on their level
zombieHealth (zombieHealthCount ) := zombieHealthCount * 10 %sets teh health of each zombie basd on their level
end for
for zombieDamageStartCount : 1 .. 50 %this loop will set teh begginingin range for teh damage done by zombies, based on their level
zombieDamageStart (zombieDamageStartCount ) := zombieDamageStartCount %sets the begginingin range for teh damage done by zombies, based on their
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%level
end for
for zombieDamageEndCount : 1 .. 50 %this loop will set teh enden range for teh damage done by zombies, based on their level
zombieDamageEnd (zombieDamageEndCount ) := zombieDamageEndCount * 3 %sets teh enden range for teh damage done by zombies, based on their level
end for
for zombieLootStartCount : 1 .. 50 %this loop will set teh begginingin range for teh loot given by zombies, based on their level
zombieLootStart (zombieLootStartCount ) := zombieLootStartCount * 5 %sets teh begginingin range for teh loot given by zombies, based on their level
end for
for zombieLootEndCount : 1 .. 50 %this loop will set teh ended range for teh loot given by zombies, based on their level
zombieLootEnd (zombieLootEndCount ) := zombieLootEndCount * 10 %sets teh enden range for teh loot given by zombies, based on their level
end for
for zomdieRowCountPrepare : 1 .. 50 %this loop will prepare each zombie to be assigned a variable for their row
zombiesRow (zomdieRowCountPrepare ) := 0 %this prepares each zombie for a row, by setting all their rows to zero
end for
for zombieColumnCountPrepare : 1 .. 50 %this loop will prepare each zombie to be assigned a variable for their column
zombiesColumn (zombieColumnCountPrepare ) := 0 %this prepares each zombie for a row, by setting all their columnss to zero
end for
for zombiePrepare : 1 .. 50 %this prepares each zombie for the game, by setting them all to true, or to 'alive'
zombies (zombiePrepare ) := true %sets each zombie to true, or makes each zombie 'alive'
end for
end zombiePrepareTot
procedure randomRows %the proceudre that will be used to put random rows for each of the zombies
randint (zombieRowPrepare, 2, 24) %makes a random interger for teh row of each zombie, in front of teh town
for zombieRowCountReal2 : 1 .. 50 %runs trhough each of the zombies
if zombiesRow (count ) = zombieRowPrepare then %sees if teh zombie has the same row as a nother zombie
randomRows %is the zombie has the same row as another zombie, it gets another random number
end if
end for
zombiesRow (count ) := zombieRowPrepare %sets the current random number to teh current zombie
count := count + 1 %jumps to teh next zombie
end randomRows
procedure randomColumns %the proceudre that will be used to put random columns for each of the zombies
randint (zombieColumnPrepare, 2, 49) %makes a random interger for teh column of each zombie, in front of teh town
for zombieRowCountReal2 : 1 .. 50 %runs trhough each of the zombies
if zombiesColumn (count ) = zombieColumnPrepare then %sees if teh zombie has the same column as a nother zombie
randomColumns %is the zombie has the same column as another zombie, it gets another random number
end if
end for
zombiesColumn (count ) := zombieColumnPrepare %sets the current random number to teh current zombie
count := count + 1 %jumps to teh next zombie
end randomColumns
procedure zombiePut %the procedure that will eb used to draw each zombie
for zombiePutCount : 1 .. 50 %runs through each of the fiftey zombies
if zombies (zombiePutCount ) = true then %if teh zombie is true (alive), the zombie will eb drawn on the screen
locate (zombiesRow (zombiePutCount ), zombiesColumn (zombiePutCount )) %locates the proeper position for teh zombie
color (green) %sets the color for the zombie to eb put
put "#" .. %draws the zombie on the screen
end if
end for
color (black) %sets the color back to its original
end zombiePut
procedure zombiePreparePosition %the proceudre that will be used to give each of teh zombies their locations
count := 1 %sets the zombie coutner at teh first zombie
loop %the loop that will run through each of the zombies to assign random row
randomRows %calls on the proceudre randomRows to give each zombie a random row, and to make sure that it doesnt have teh same row as another
exit when count = 51 %exits when all of teh zombies have been assigned a random row
end loop
count := 1 %sets the zombie coutner at teh first zombie
loop %the loop that will run through each of the zombies to assign random columns
randomColumns %calls on the proceudre randomColumns to give each zombie a random column, and to make sure that it doesnt have teh same column as
%%%%%%%%%%%%%%another
exit when count = 51 %exits when all of teh zombies have been assigned a random row
end loop
end zombiePreparePosition
procedure marketBuilding %the procedure that will be used to draw the market building
for marketRow : 2 .. 5 %runs through the 4 rows that will make up the market place
locate (marketRow, 70) %locates the proper row, and the proper column to put the market building
put "MARKET" .. %draws the market building
end for
end marketBuilding
procedure healerBuilding %the procedure that will be used to draw the healer building
for healerRow : 7 .. 9 %runs through the 3 rows that will make up the healer place
locate (healerRow, 70) %locates the proper row, and the proper column to put the healer building
put "HEALER" .. %draws the healer building
end for
end healerBuilding
procedure trainerBuilding %the procedure that will be used to draw the trainer building
for trainerRow : 11 .. 15 %runs through the 5 rows that will make up the trainer place
locate (trainerRow, 70) %locates the proper row, and the proper column to put the trainer building
put "TRAINER" .. %draws the trainer building
end for
end trainerBuilding
procedure armoryBuilding %the procedure that will be used to draw the rmory building
for armoryRow : 17 .. 21 %runs through the 5 rows that will make up the rmory place
locate (armoryRow, 70) %locates the proper row, and the proper column to put the rmory building
put "ARMORY" .. %draws the rmory building
end for
end armoryBuilding
procedure innBuilding %the procedure that will be used to draw the inn building
for innrow : 22 .. 24 %runs through the 3 rows that will make up the inn place
locate (innrow, 55) %locates the proper row, and the proper column to put the inn building
put "INNINNINN" .. %draws the inn building
end for
end innBuilding
procedure walls %the porcedure that will draw the walls
colorback (black) %sets the background color as black, to draw the walls
for wallsColumn : 50 .. 80 %runs through the right half of the colomns to draw the top section of the walls
locate (1, wallsColumn ) %locates at the top of the screen to draw teh wall
put " " .. %draws teh wall
end for
for wallsColumn : 50 .. 80 %runs through the right half of the colomns to draw the bottem section of the walls
locate (25, wallsColumn ) %locates at the bottem of the screen to draw teh wall
put " " .. %draws teh wall
end for
for wallsRow : 1 .. 24 %runs through the right side of the screen to draw the right part of the walls
locate (wallsRow, 80) %locates at the right side of the screen to draw the wall
put " " .. %draws the wall
end for
for wallsRow : 1 .. 10 %runs through the first 10 rows, to draw the uppermost left section of the wall
locate (wallsRow, 50) %locates to teh proper location to draw the uppermost left section of the wall
put " " .. %draws teh wall
end for
for wallsRow : 15 .. 25 %runs through the last 10 rows, to draw the lowermost left section of the wall
locate (wallsRow, 50) %locates to teh proper location to draw the lowermost left section of the wall
put " " .. %draws the wall
end for
colorback (white)
end walls
procedure buildings %the procedure that will be used to draw the buildings
cls %clears the screen %clears the screen to draw the buildigns
marketBuilding %calls a procedure to draw teh market building
healerBuilding %calls a proceudre to draw teh healre building
trainerBuilding %calls a procedure to draw the trainer buildign
armoryBuilding %calls a proceudre to draw the armory building
innBuilding %calls a procedure to draw the inn building
walls %calls a procedure to draw the walls
zombiePut %calls a procedure to draw teh zombies on the screen
end buildings
procedure healer %teh healer procedure that will be used to do waht happens wen teh player enters the healers
cls %clears the screen
%calculates the cost to heal teh player, based on the amount of health they will giain
put "Would you like me to heal you? It would cost ", (fullHealth - health ), " gold. (Y/N)?" %asks teh user wat they want to do
put "You currently have ", gold, " gold." %tells teh user how much gold they have
get command %gets the comamd of the user
if command = "Y" and gold > (fullHealth - health ) then %sees if teh user has enough money to pay for the cost of healing, and if they want to get
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%healed
gold - = (fullHealth - health ) %subtracts the cost of healing from the total amount og gold the user has
health := fullHealth %sets teh payers health to full
end if
if command = "Y" and gold < (fullHealth - health ) then %if the user wants to get healed, but doesnt have enough gold the user will be not healed, and
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%told that they do not have enough money
put "You do not have enough money." %tells teh user that they do not have enough money
getch (character ) %waits for the user input to continue
end if
%sets the players location to outside the healer
row := 8
column := 68
cls %clears the screen
buildings %draws all teh buildings and zombies buy calling on a procedure
end healer
procedure trainer %teh trainer procedure that will be used to do waht happens wen teh player enters the trainers
cls %clears the screen
put "What would you like train?" %asks the user what they would like to train
put "1)Strength (cost:50), 2)Defence(cost:75), 3)Vitilaty(cost:100)" %tells the user the prices of training various things
put "You currently have ", gold, " gold." %tells teh user how much gold they have
get command %gets the players commadn to see what they want to do
if command = "1" then %sees if the user wants ot train their strength
if gold > 50 then %sees if the user has enough gold, if so
gold - = 50 %the proper amount of gold is subtracted from the total amount of gold that the player has
strength + = 1 %increases teh strength of teh player
else %if the player does not have enough gold, they are told so, and thier strength is not increased
put "You do not have enough money." %teh payer is told that they do not have enough gold
getch (character ) %waits for the users input
end if
end if
if command = "2" then %sees if the user wants ot train their defence
if gold > 75 then %sees if the user has enough gold, if so
gold - = 75 %the proper amount of gold is subtracted from the total amount of gold that the player has
defence + = 1 %increases teh defence of teh player
else %if the player does not have enough gold, they are told so, and thier strength is not increased
put "You do not have enough money." %teh payer is told that they do not have enough gold
getch (character ) %waits for the users input
end if
end if
if command = "3" then %sees if the user wants ot train their vitality
if gold > 100 then %sees if the user has enough gold, if so
gold - = 100 %the proper amount of gold is subtracted from the total amount of gold that the player has
fullHealth + = 5 %increases teh vitality of teh player
else %if the player does not have enough gold, they are told so, and thier strength is not increased
put "You do not have enough money." %teh payer is told that they do not have enough gold
getch (character ) %waits for the users input
end if
end if
%sets teh players location to outside the trainers
row := 15
column := 68
cls %clears the screen
buildings %draws all teh buildings and zombies buy calling on a procedure
end trainer
procedure market %teh market procedure that will be used to do waht happens wen teh player enters the market
cls %clears the screen
put "What would you like to do?"
put "1) Sell Loot, 2) Buy Med Pack" %asks the user what they would like to do
put "You currently have ", gold, " gold." %tells teh user how much gold they have
get command %gets the players commadn to see what they want to do
if command = "1" then %sees if the user wants ot sell their loot
put "You have made ", loot, " gold." %tells teh user how much lot they have to sell
gold + = loot %increases the amoutn of gold that the user has, based on how kuch loot they ahve traded in
put "You currently have ", gold, " gold." %tells teh user how much gold they have
loot := 0 %sets teh players loot to 0, since they just traded it in
getch (character )
end if
if command = "2" then %sees if the user wants to buy medpacks
put "How many medpacks do you want? (cost:50)" %asks the user for how many medpacks they want to buy, and asks them how much they want to buy
put "You currently have ", gold, " gold." %tells teh user how much gold they have
get commandInt %gets the players commadn to see what they want to do
if 50 * commandInt < gold then %sees if the user has enough gold, if so
gold - = 50 * commandInt %the proper amount of gold is subtracted from the total amount of gold that the player has
medPacks + = commandInt
else %if the player does not have enough gold, they are told so, and they do not gain any medpacks
put "You do not have enough money." %teh payer is told that they do not have enough gold
getch (character ) %waits for the users input
end if
end if
%sets teh players location to outside the market
row := 4
column := 68
cls %clears the screen
buildings %draws all teh buildings and zombies buy calling on a procedure
end market
procedure armory %teh armory procedure that will be used to do waht happens wen teh player enters the armory
cls %clears the screen
put "What would you like to do?" %asks teh user what they want to do
put "1) Strengthen Sword, 2) Stengthen Gun, 3) Buy Ammo"
get command %gets what the player wants to do
if command = "1" then %sees if the player wants to buy a sword
put "It costs 50 gold for each strength level to add to your sword." %tells teh user how much it is per upgrade
put "How many power levels do you want to add to your sword?" %asks the user how much of an upgrade theat they want
put "You currently have ", gold, " gold." %tells teh user how much gold they have
get commandInt %gets how many power levels teh player wants to increase their sword
if commandInt * 50 < gold then %sees if teh player has enough to pay for the amount of power levels requested if so..
sword + = commandInt %the players sword is increased teh appropreat amount of power levels
gold - = commandInt * 50 %teh player loses the appropreat amount of gold, relative to how many power levels they just bought
else %if the user doesnt have enough gold
put "You do not have enough money." %teh user is told that they do not have enough gold
getch (character ) %waits for use input
end if
end if
if command = "2" then %sees if the player wants to buy a gun
put "It costs 25 gold for each strength level to add to your gun." %tells teh user how much it is per upgrade
put "How many power levels do you want to add to your gun?" %asks the user how much of an upgrade theat they want
put "You currently have ", gold, " gold." %tells teh user how much gold they have
get commandInt %gets how many power levels teh player wants to increase their sword
if commandInt * 25 < gold then %sees if teh player has enough to pay for the amount of power levels requested if so..
gun + = commandInt %the players sword is increased teh appropreat amount of power levels
gold - = commandInt * 25 %teh player loses the appropreat amount of gold, relative to how many power levels they just bought
else %if the user doesnt have enough gold
put "You do not have enough money." %teh user is told that they do not have enough gold
getch (character ) %waits for use input
end if
end if
if command = "3" then %sees if the player wants to buy ammo
put "It costs 20 gold for each round of ammunition." %tells teh user how much it is for ammo
put "How many rounds of ammunition do you want to buy?" %asks the user how much ammo they want
put "You currently have ", gold, " gold." %tells teh user how much gold they have
get commandInt %gets how many rounds of ammo the player wants
if commandInt * 20 < gold then %sees if teh player has enough to pay for the ammo requested if so..
gold - = commandInt * 20 %teh player loses the appropreat amount of gold, relative to how many rounds of ammo they just bought
ammo + = commandInt %the players amoutn of ammo is increased buy how much they just bought
else %if the user doesnt have enough gold
put "You do not have enough money." %teh user is told that they do not have enough gold
getch (character ) %waits for use input
end if
end if
%sets teh players location to outside the armory
row := 20
column := 68
cls %clears the screen
buildings %draws all teh buildings and zombies buy calling on a procedure
end armory
procedure sleep %teh procedure that will be used to reset teh zombies
zombiePrepareTot %calls on a procedure to reset all teh stats of all the zombies
zombiePreparePosition %calls on a proceudre to reset teh positions of all the zombies
health := fullHealth %sets teh players health to full after sleeping
end sleep
procedure died %teh procedure that wil be used if teh player dies
sleep %calls on a procedure to reset teh zombies, and to make the player have full haelth
%sets teh users location in the middle of town
row := 15
column := 65
life := true %sets teh users life to true (alive)
deadZombies := 0 %resets teh number of zombies dead on that page
gold := 0 %sets teh users gold to 0
end died
procedure inn %the inn procedure that will be used to see wat happens when teh user enter the inn
cls %clears the screen
put "Would you like to sleep in one of our beds? (Cost:100)(Y/N)" %asks teh user what they would like to do, and how much it costs to sleep
put "You currently have ", gold, " gold." %tells the user how much gold they have
get command %gets what the player want to do
if command = "Y" and gold > 99 then %if teh player wants to sleep, and has enough money, than they sleep
sleep %calls on the sleep procedure to reset teh zombies, and make teh player have full health
end if
if command = "Y" and gold < 100 then %if the player does not have enough money to sleep, but wants to, then they are told tehy do not have enough money
put "You do not have enough money." %tells the user they do not have enough money
end if
%sets teh players location to outside of the inn
row := 21
column := 60
cls %clears the screen
buildings %draws all teh buildings and zombies buy calling on a procedure
end inn
procedure strats %teh procedure strats that will be used to show teh user their current player info
cls %clears the screen
put "You current health is ", health, "/", fullHealth, "." %shows teh user their current health over their max health
put "You currently have ", gold, " gold." %shows the user how much gold they have
put "You currently have ", medPacks, " medPacks." %shows the user how many medpacks they have
put "Your srength level is ", strength, "." %shows teh user their current strength level
put "Your defence level is ", defence, "." %shows teh user their current defence level
put "The current level of your gun is ", gun, "." %shows teh user their current level level of their gun
put "The current level of your sword is ", sword, "." %shows teh user their current level of their sword
put "You currently have ", ammo, " rounds of ammunition." %shows the user how much ammunition they have
put "You have ", loot, " gold worth of loot." %shows the user how much their current loot is worth
put "You have killed ", totDeadZombies, " zombies." %shows the user how many zombies they have killed in total
getch (character ) %waits for user input
cls %clears the screen
buildings %draws all teh buildings and zombies buy calling on a procedure
end strats
procedure battle %teh procedure battle that will be used when teh player wants to battle
drawZombie %draws the zombie face
loop
cls %clears the screen
put "Zombie Battle!!!" %tells the user they are in a zombie battle
put "This zombie is level ", battleNumber, "." %tells teh user the power level of teh zombie they are facing
put "This zombie has a vitality of ", zombieHealth (battleNumber ), "." %tells teh user teh health of teh zombie they are facing
put "You current health is ", health, "/", fullHealth, "." %tells teh ser their health, over theur max health
put "You currently have ", medPacks, " medPacks." %tells teh user how amny medpacks they have
put "Your srength level is ", strength, "." %tells teh user their current strength level
put "Your defence level is ", defence, "." %tells teh user their current defence level
put "The current damage of your gun is ", gun, "." %tells teh user the current level of their gun
put "You current sword level is ", sword, "." %tells teh user the current level of their sword
put "You currently have ", ammo, " rounds of ammunition." %tells teh user how many rounds of ammunition they have
loop %this loop ensures that teh user enters a repectable comamdn
put "What would you like to do?" %asks teh user what tehy want to do
put "1)Use Sword, 2) Use Gun, 3)Teleport Home, 4) Use Medpack" %tells the user their choices
get command %gets the users command
if command = "1" then %if teh user wants to use their sword
zombieHealth (battleNumber ) - = strength + sword %the damage done to the zombie is the damage of teh sword plus the damage of their
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%strength
exit %exit the loop, because an acceptable commadn was entered
end if
if command = "2" and ammo > 0 then %if teh user wants to use their gun, and has ammo
zombieHealth (battleNumber ) - = gun %the damgage done to the zombie is the power level of their gun
ammo - = 1 %the player loses one round of ammunition
exit %exits teh loop because an acceptable cammand has been entered
end if
if command = "3" then %sees if teh user wants to teleport home
%sets the players location in the middle of town
row := 15
column := 65
exit %exits teh loop because an acceptable cammand has been entered
end if
if command = "4" and medPacks > 0 then %sees if the user wants to use a medpack, if they have enough medpacks, and
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%if they wont have over full health with theur medpacks
medPacks := medPacks - 1 %decrease teh amount of medpacks that the user ahs by one
if health + 50 < fullHealth then %sees if the player will have less than perfect health
health := health + 50 %increases the players health by one
end if
if health + 50 > fullHealth then %if the players health wil,l b egreater than max, than the health will be max, beacuas
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%eht ehealth cannot be more than perfect
health := fullHealth %makes the players health full
exit %exits teh loop because an acceptable cammand has been entered
end if
end if
end loop
if command = "3" then %quits the battle loop, if teh player wants to quit
exit
end if
randint (zombieDamage, zombieDamageStart (battleNumber ), zombieDamageEnd (battleNumber )) %the damage inflicted by the zombie is randomized based on
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%previos intergers that are based on teh zombies power
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%level
if (zombieDamage - defence ) > 1 then %sees if the zombie inflicts positive damage, found by subtracting the damage by teh players defence
health - = (zombieDamage - defence ) %the damage done by teh zombie is subtracted from your health
end if
if health < 1 then %sees if the player has health of less that 1, aka dead
cls %clears the screen
%sets the player location at the center of teh screen
row := 15
column := 65
%informs teh player that they died, and that zombeis stole their money
put "You died!!"
put "The town folk have been able to bring you to the healers, and revive you."
put "But not before the zombies stole all you gold."
%waits for any input fromt eh player
getch (character )
life := false %sets teh players life to false, aka dead
exit %exits teh loop of battle
end if
if zombieHealth (battleNumber ) < 1 then %sees if teh zombie has health of less than one, aka dead
cls %clears the screen
%sets the player location at the center of teh screen
row := 15
column := 65
randint (lootGot, zombieLootStart (battleNumber ), zombieLootEnd (battleNumber )) %gets a random interger for the amount of loot that the player
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%gets from teh zombie, based on pervious numbers, which are
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%derived from the zombies power level
loot + = lootGot %teh players total loot is increased by the amount of loot just gotten from the zombie
put "You are victorios!!" %tells teh player they are victorious
put "You got ", lootGot, " gold of loot from the zombie." %tells the player how much loot they got
getch (character ) %waits for any user input
zombies (battleNumber ) := false %sets the zombie to false, aka dead
deadZombies + = 1 %increases the number of dead zombies for that level
totDeadZombies + = 1 %increases the numebr of total dead zombies
exit
end if
exit when zombieHealth (battleNumber ) < 1 or life = false %exit teh main battle loop if teh zombie dies, or if u die
end loop
cls %clears the screen
buildings %draws all teh buildings and zombies buy calling on a procedure
end battle
procedure zombieCheck %the procedure zombieCheck to see if the player runs into a zombie
for zombieCheckCount : 1 .. 50 %runs through teh 50 zombies
if zombies (zombieCheckCount ) = true and zombiesRow (zombieCheckCount ) = row and zombiesColumn (zombieCheckCount ) = column then %if the zombie is
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% alive and it has
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%the same x and y
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% coordinates as
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% the player then
battleNumber := zombieCheckCount %the nummber of teh zombie that the player is battling is the number of the zombie that the player just ran
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%into
battle %calls on the procedure battle, for teh player to battle teh zombie
end if
end for
end zombieCheck
procedure checkCollision %teh procedure that will constrict teh players movemetns
moveLeft := true %sets the player able to move to the left
moveRight := true %sets the player able to move to the right
moveUp := true %sets the player able to move up
moveDown := true %sets the player able to move down
for checkWall1 : 1 .. 10 %runs through the 10 rows of the uppermost left wall
if row = checkWall1 and column = 49 then %if teh player is exactly to teh left of the wall, teh player cannot move right
moveRight := false %sets teh player not able t move right
end if
if row = checkWall1 and column = 52 then %if teh player is exactly to teh lright of the wall, teh player cannot move right
moveLeft := false %sets teh player not able t move right
end if
end for
for checkWall2 : 15 .. 25 %runs through the 10 rows of the lowemost left wall
if row = checkWall2 and column = 52 then %if teh player is exactly to teh lright of the wall, teh player cannot move right
moveLeft := false %sets teh player not able t move right
end if
if row = checkWall2 and column = 49 then %if teh player is exactly to teh left of the wall, teh player cannot move right
moveRight := false %sets teh player not able t move right
end if
end for
for checkWall3 : 50 .. 51 %runs through the width of teh uppermost left wall
if column = checkWall3 and row = 11 then %if the player is under the uppermost left wall, they cannot move up
moveUp := false %teh player cannot move up
end if
end for
for checkWall4 : 50 .. 51 %runs through the width of teh lowermost left wall
if column = checkWall4 and row = 14 then %if the player is above the lowermost left wall, they cannot move down
moveDown := false %teh player cannot move down
end if
end for
end checkCollision
procedure menu
cls
put "Would you like to save, or load a game (save/load/exit)?"
get command %gets command
if command = "save" then %sees the the player wants to save their game
put "Where would you like ot put, and name your file?(name)"
get command %gets command
open : save, command, write
write : save, health
write : save, fullHealth
write : save, gold
write : save, medPacks
write : save, strength
write : save, defence
write : save, gun
write : save, sword
write : save, ammo
write : save, totDeadZombies
write : save, deadZombies
close : save
end if
if command = "load" then %sees the the player wants to load a game
put "What is the rootpath of the saved file?(name)"
get command %gets command
open : load, command, read
read : load, health
read : load, fullHealth
read : load, gold
read : load, medPacks
read : load, strength
read : load, defence
read : load, gun
read : load, sword
read : load, ammo
read : load, totDeadZombies
read : load, deadZombies
close : load
end if
buildings
end menu
colorback (black) %sets the background color in black
for count9 : 1 .. 25 %runs through all 25 rows
for count8 : 1 .. 80 %runs through all 80 columns
locate (count9, count8 ) %locates eventaully through every space on teh srceen
put " " .. %puts a black space, to make teh whole screen black
end for
end for
colorback (brightred) %makes hte background bright red
for count1 : 1 .. 80 %runs through teh top row of teh screen
locate (1, count1 ) %locates at the top row of the screen
put " " .. %puts red spaces all along the top row of the screen
end for
for count1 : 1 .. 80 %runs through teh bottem row of teh screen
locate (25, count1 ) %locates at the bottem row of the screen
put " " .. %puts red spaces all along the bottem row of the screen
end for
for count1 : 1 .. 80 %puts red spaces all along the second row of the screen
locate (2, count1 ) %puts red spaces all along the second row of the screen
put " " .. %puts red spaces all along the second row of the screen
end for
for count1 : 1 .. 80 %puts red spaces all along the second last row of the screen
locate (24, count1 ) %puts red spaces all along the second last row of the screen
put " " .. %puts red spaces all along the second last row of the screen
end for
for count3 : 1 .. 25 %runs through each of teh 25 rows
locate (count3, columnName ) %locates in a diagonal line across the scree
put " " .. %draws teh diagonal line
columnName + = 3 %increases the column to write the diagonal
end for
colorback (white) %sets teh background color to its original white
color (black) %sets teh color to its original black
getch (character ) %waits for the input of teh user
cls %clears the screen
%puts a little story for teh player
put "Your town has been attacked by a gang of roving zombies."
put "You are your towns only hope."
put "Can you save them?"
getch (character ) %waits for the input of teh user
zombiePrepareTot %prepares teh zombies
zombiePreparePosition %assigns zombies positions
buildings %draws teh buildigns
loop %the main loop of teh game
checkCollision %checks the collision of the user, by callign a procedure
Input.KeyDown (chars ) %keyboard keays entered
%movement
if ((gameTime / 10) rem 5) = 0 then %slows teh user down by making usre that they can only move every so often
if moveUp = true then %sees if the user can move up
if chars (up ) and row > 2 then %see if the user wants to move up, and makes sure that they are not on the edge of the screen
locate (row, column ) %locates the previous position
put " " .. %erases the old asterisk
row - = 1 %moves the player up
end if
end if
if moveDown = true then %sees if the user can move down
if chars (down ) and row < 24 then %see if the user wants to move down, and makes sure that they are not on the edge of the screen
locate (row, column ) %locates the previous position
put " " .. %erases the old asterisk
row + = 1 %moves the player down
end if
end if
if moveLeft = true then %sees if the user can move left
if chars (left ) and column > 1 then %see if the user wants to move left, and makes sure that they are not on the edge of the screen
locate (row, column ) %locates the previous position
put " " .. %erases the old asterisk
column - = 1 %moves the player over left
end if
end if
if moveRight = true then %sees if the user can move right
if chars (right ) and column < 78 then %see if the user wants to move right, and makes sure that they are not on the edge of the screen
locate (row, column ) %locates the previous position
put " " .. %erases the old asterisk
column + = 1 %moves the player over right
end if
end if
end if
%menus
if chars (stats ) then %sees if teh player wants to see their stats, if so, they are showed their stats
strats %shwos the player their stats
end if
if chars (saveload ) then
menu
end if
%collision
if column > 68 and row > 1 and row < 6 then %sees if teh player is inside the market if so, runs teh market procedure
market %runs wat happens wen teh player is inside the market
end if
if column > 68 and row > 6 and row < 10 then %sees if teh player is inside the healer if so, runs teh healer procedure
healer %runs wat happens wen teh player is inside the healer
end if
if column > 68 and row > 10 and row < 16 then %sees if teh player is inside the trainer if so, runs teh trainer procedure
trainer %runs wat happens wen teh player is inside the trainer
end if
if column > 68 and row > 16 and row < 22 then %sees if teh player is inside the armory if so, runs teh armory procedure
armory %runs wat happens wen teh player is inside the armory
end if
if column > 55 and column < 64 and row > 22 then %sees if teh player is inside the inn if so, runs teh inn procedure
inn %runs wat happens wen teh player is inside the inn
end if
%zombie collision
zombieCheck
locate (row, column ) %locates the players position and draws them
put "*" .. %Draws teh player
delay (1) %slows the game down
gameTime + = 1 %increases the game tiem
exit when deadZombies = 50 %exits when all the zombie have been killed, 50
if life = false then %sees if the player is dead, if so calls the died procedure
died %calls the died procedure, wat happens wen the player dies
buildings %draws all teh buildings and zombies buy calling on a procedure
end if
end loop
fork music %plays the music at the end of the game
cls %clears the screen
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%Tells the user that they one."
put "You have destroyed all the zombies."
put "And incinerated their zombified flesh."
put "The town is saved."
put "You will live on in legend, as "
put "The Zombie Raper!!"
put ""
put ""
put ""
put ""
put ""
put ""
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%credits
delay (5000) %slows the game down for teh credits
put "A MACE game."
put ""
delay (5000) %slows the game down for teh credits
put "Head Software engineer : mace"
put ""
delay (5000) %slows the game down for teh credits
put "Lead programer : mace"
put ""
delay (5000) %slows the game down for teh credits
put "Head level designer : mace"
put ""
delay (5000) %slows the game down for teh credits
put "Head Composer : mace"
put ""
delay (5000) %slows the game down for teh credits
put "Head Story writer : mace"
put ""
delay (5000) %slows the game down for teh credits
put "Game testers : "
put ""
delay (5000) %slows the game down for teh credits
put " mace"
delay (5000) %slows the game down for teh credits
put " George"
delay (5000) %slows the game down for teh credits
put " Coco"
put ""
delay (5000) %slows the game down for teh credits
put "Special thanks goes out to:"
put ""
delay (5000) %slows the game down for teh credits
put " mace"
put ""
delay (5000) %slows the game down for teh credits
put "This video game is purely fictional."
put ""
delay (5000) %slows the game down for teh credits
put "Any resemblence to previous works, actual people living or dead, are purely coincidental."
put ""
delay (5000) %slows the game down for teh credits
put "This game is made of 100% recycled electrons."
put ""
delay (5000) %slows the game down for teh credits
put "No Zombies were harmed during the making of the game."
put ""
|
|
|
|
|
|
|
Sponsor Sponsor
|
|
|
Tony
|
Posted: Mon Jun 30, 2008 1:35 am Post subject: RE:grade 10 mid-semester culminating |
|
|
I think you might have missed the point of comments in code.
You don't have to type out what's going on, on the line, twice. If your entire line is cls, I know that it will clear the screen. That's what the command does. If it's not obvious why you are clearing the screen at that point, fair enough, tell me why you are clearing the screen. Don't tell me what the command does... close to 20 times.
Besides, it looks like you just went back to add in this pile of redundant "commentary" after writing the code itself. Courtesy of this gem of a line
code: |
cls %clears the screen %clears the screen
|
Global search-and-replace? |
Tony's programming blog. DWITE - a programming contest. |
|
|
|
|
apomb
|
Posted: Mon Jun 30, 2008 8:41 am Post subject: Re: grade 10 mid-semester culminating |
|
|
What is with there being so many lines such as code: | % the process that will teh used to play the music at teh end of teh game |
Look at all those "teh"s... there is no need for that.
the game itself is interesting, though it, too is riddled with spelling errors, and the math for the amount of gold you have is incorrect, if you have exactly 50 gold, you cant afford something that is also 50 gold, meaning you used a statement such as code: | if commandInt * 25 < gold then | meaning you dont account for if the player has exactly the right amount of gold... a pretty annoying error |
|
|
|
|
|
McKenzie
|
Posted: Mon Jun 30, 2008 4:52 pm Post subject: Re: grade 10 mid-semester culminating |
|
|
It's a great start mace!
As the guys point out, there are some issues with your style that you need to look at. Overall, it's a cool little game. It's a pity your work didn't match well with the course you took. Don't despair, your work is still appreciated.
I know it's tough to know whom to listen to. Your teacher tells you one thing, the online guys tell you another, you feel something else. You're good at this stuff, you know that and I know that and you want to become great. The guys at this site aren't great at telling you how good you are, but they will help you become great. Take their advice as tips to become great and not as harsh criticism and you will grow here. |
|
|
|
|
|
|
|