Posted: Wed Jan 13, 2010 5:54 pm Post subject: How are Battle phases done? Especially more Compilicated ones?
What is it you are trying to achieve?
I am trying to achieve a battle phase in my code, where the enemy monster has health, you have health, and that the damage is calculated turn based.
Also, if its not too much, if there could be a skipped battle phase, where it just displays whether or not you won the battle, or you can see what happened each round sort of thing.
Also, when the battle is over, you have full health again
What is the problem you are having?
That I have no clue whatsoever how to do this
Describe what you have tried to solve this problem
Absolutely nothing
Post any relevant code (You may choose to attach the file instead of posting the code if it is too long)
Unfortunately for some reason, I cannot attach the zipped file, so Im gonna have to give you the code it self, sorry
var command :string var key :string(1) const PIC_ID :=Pic.FileNew("mentalroom.jpg") const PIC_ID2 :=Pic.FileNew("headset.jpg") const PIC_ID3 :=Pic.FileNew("bloodstains.jpg") const PIC_ID4 :=Pic.FileNew("paper_ball.jpg") const PIC_ID5 :=Pic.FileNew("knife.jpg") const PIC_ID6 :=Pic.FileNew("Zombie.jpg") var font :int
font :=Font.New("Cambria:50") var keyboardinput :int var Health :int:=100 var username :string var knife_answer :string var menu_choice :int var chars :arraycharofboolean var death :int var battle :int
process BackgroundMusic
Music.PlayFile("Guns N' Roses - Shackler's Revenge.mp3")
fork BackgroundMusic
locate(1, 1) put"Welcome!" put"PLEASE ENTER YOUR USERNAME" get username
cls if username ="Pablo"then loop color(1) put"PABLO IS A TREEE!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!" color(2) put"PABLO IS A TREEE!!!!!!!!!!!!!! !!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!" color(3) put"PABLO IS A TREEE!!!!!!!!!!!!! !!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!" color(4) put"PABLO IS A TREEE!!!!!!!!!!!! !!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!" color(5) put"PABLO IS A TREEE!!!!!!!!!!! !!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!" color(6) put"PABLO IS A TREEE!!!!!!!!!! !!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!" color(7) put"PABLO IS A TREEE!!!!!!!!! !!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!" color(8) put"PABLO IS A TREEE!!!!!!!! !!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!" color(9) put"PABLO IS A TREEE!!!!!!! !!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!" color(10) put"PABLO IS A TREEE!!!!!! !!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!" color(11) put"PABLO IS A TREEE!!!!! !!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!" color(12) put"PABLO IS A TREEE!!!! !!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!" color(13) put"PABLO IS A TREEE!!! !!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!" color(14) put"PABLO IS A TREEE!! !!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!" color(15) put"PABLO IS A TREEE! !!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!" color(1) put"PABLO IS A TREEE!! !!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!" color(2) put"PABLO IS A TREEE!!! !!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!" color(3) put"PABLO IS A TREEE!!!! !!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!" color(4) put"PABLO IS A TREEE!!!!! !!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!" color(5) put"PABLO IS A TREEE!!!!!! !!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!" color(6) put"PABLO IS A TREEE!!!!!!! !!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!" color(7) put"PABLO IS A TREEE!!!!!!!! !!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!" color(8) put"PABLO IS A TREEE!!!!!!!!! !!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!" color(9) put"PABLO IS A TREEE!!!!!!!!!! !!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!" color(10) put"PABLO IS A TREEE!!!!!!!!!!! !!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!" color(11) put"PABLO IS A TREEE!!!!!!!!!!!! !!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!" color(12) put"PABLO IS A TREEE!!!!!!!!!!!!! !!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!" color(13) put"PABLO IS A TREEE!!!!!!!!!!!!!! !!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!" color(14) put"PABLO IS A TREEE!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!" endloop endif
getch(key) cls locate(25, 65) put"Welcome?"..
locate(25, 65) put"My name is Friend." put" " put" "
put"PRESS ANY KEY TO CONTINUE"
getch(key) cls locate(25, 65) put"*What am I doing here?Friend?*" put" " put" "
put"PRESS ANY KEY TO CONTINUE"
getch(key) cls locate(25, 65) put"How about you reach upwards, there should be a string" locate(26, 65) put"**You reach and find the string**" locate(27, 65) put"Pull it?now" put" " put" "
put"PRESS ANY KEY TO CONTINUE"
getch(key) cls locate(22, 65) put"The following commands for this situation are..." locate(23, 65) put"Pull the string?PULL" locate(24, 65) put"Don't trust this *friend* guy, you can manage on your own?LEAVE" locate(25, 65) get command
case command of label"PULL": cls colorback(0) cls put"**A light flickers on, and you realize that the string was attached to the light**" put"Well that wasn't so hard now was it?" put"Why don't you have a look around where you are right now..." put" " put" "
getch(key) cls put"" put"You see, right now, in this situation, I'm the best hope you have of surviving." put"Look on the table, there should be a headset there...pick it up..." put"**You go to pick it up, and find a note underneath**" Pic.Draw(PIC_ID3, 0, 0, picCopy) put" " put" "
put"PRESS ANY KEY TO CONTINUE"
getch(key) cls put"The commands for this situation are..." put"Read the note...Read" put"Leave the note alone...Leave" get command
cls loop if command ="Read"then put"" put"**It reads...'IF SOMEONE FINDS THIS NOTE, DO NOT TRUST THE PERSON NAMED 'FRIEND'..." put"**It looks like the note goes on, but the rest is covered by blood**" put" " put" "
put"PRESS ANY KEY TO CONTINUE"
getch(key) cls exitwhen command ="Read" elsif command ="Leave"then put"" put"**You crumple the paper and throw it into a corner, your hand is briefly stained with fresh blood from the note**" Pic.Draw(PIC_ID4, 0, 0, picCopy) put" " put" "
endif endloop put"" put"Alright, there should be a door, to get out, go to it" put"*Fine but you better tell me whats going on here, and what is happening?*" put"**You hear laughing, all in good time ", username, "." put" " put" "
put"PRESS ANY KEY TO CONTINUE"
getch(key) cls put"" put"**As you approach the door, you stumble upon something, when you look closer you see its a knife**" put"**Would you like to pick it up?**" put"The commands for this situation are...." put"Pick it up....................Yes" put"Leave it......................Leave" Pic.Draw(PIC_ID5, 0, 0, picCopy) get command
cls
if command ="Yes"then put"" put"You pick up the knife..."
put"PRESS ANY KEY TO CONTINUE"
getch(key) cls put"" put"YOU HAVE JUST FOUND THE KNIFE!!!" put"Stats!" put"This weapon gives you 5 attack and 1 defense" put"The code for this weapon is knife1" put"Write it down somewhere!!!!!!!!!!!"
put"PRESS ANY KEY TO CONTINUE"
getch(key) cls elsif command ="No"then put"" put"You decide to leave the knife thinking you are in no need of a knife whatsoever..."
endif put"" put"Alright now ", username, " now go outside the door, you should find yourself in a hallway" put"**As you step out the door, you try to get your bearings...**"
put"YOU HAVE JUST ENCOUNTERED YOUR FIRST MONSTER!!!!!!" put"NOW YOU MUST BATTLE TO SURVIVE!!!!!!!!!!!!!"
put"PRESS ANY KEY TO CONTINUE"
getch(key) cls put"The stats for the 'zombie' is...." put"Attack...........................2" put"Defense..........................1" put"Would you like to battle this monster, or would you rather run away?" put"You may gain some items from battling this monster, but if you run" put"you may sustain damage..!"
put"PRESS ANY KEY TO CONTINUE"
getch(key) cls put"The commands for this situation are........" put"Battle.............................Attack" put"Run away like a coward.............Run" get command
loop if command ="Attack"then put"Now that you have chosen to attack the monster, you must select a weapon..." put"When you picked up the knife from earlier on, you should have gotten a code..." put"USE THAT CODE NOW!!!!"
put"PRESS ANY KEY TO CONTINUE"
getch(key) cls put"....Wait....You did pick up the knife didn't you?" put"Well if you didn't I will give you the code...REMEMBER IT..."
put"PRESS ANY KEY TO CONTINUE"
getch(key) cls put"The code for the knife was knife1, REMEMBER IT!, I will not tell you again..." put"Alright, are you ready for this, just remember the good ol' one two!" getch(key) cls
elsif command ="Run"then put"You attempt to run away from the zombie, but you trip and fall" put"You feel a sharp pain in your leg, and cannot get up again..." put"You manage to drag yourself back into the room, but..." put"Because you cannot close the door, you are trapped in the room with the zombie..." put"All you feel is a sharp pain on your neck, and you are given...Escape...." put"GAME OVER....YOUR INABILITY TO FIGHT HAS LED TO YOUR DEATH"
else put"Invalid Command!"
endif endloop
label"LEAVE": cls put"What an unfortuanate desicion" put" " put" "
put"PRESS ANY KEY TO CONTINUE"
getch(key) cls put"**You hear a huge crackle, and hear a spark.**" put" " put" "
put"PRESS ANY KEY TO CONTINUE"
getch(key) cls put"**You stumble backwards and fall**" put"**Unable to find the string again, you are forced to wander" put"around the room aimlessly**" put" " put" "
put"PRESS ANY KEY TO CONTINUE"
getch(key) cls put"**Because there is no food or water, you die of malnutrition in a few days" put"atleast, you think its a few days...**" put" " put" "
put"PRESS ANY KEY TO CONTINUE"
getch(key) cls put"GAME OVER....YOUR INABILITY TO TRUST HAS LED TO YOUR DEATH"
put"_________________________INSTRUCTIONS__________________________" putskip put"Basically this game is text based, and requires you to type things in." put"The program will give you situations in which you need to enter a command..." put"These commands are limited to the situation, such as picking something up" put"Will have the option of leaving the object, or picking it up." put"Read each line carefully, because it may have some useful information." put"Follow the story and have fun!! XD" end Instruction
var fname :string var lname :string var age :string var answer :string var yorno :string var answers :int var yesorno :string var yes :string var command :string var commands :string var command1 :string put"Hello, please enter your first and last name." delay(2500) cls put"First name..." get fname :* delay(2500) cls put"Last name..." get lname :* delay(2500) cls put"Hello ", fname, "! How are you doing today? Now I am just going to" put"ask a few questions." put"Press any key to continue" get answer :* delay(2500) cls put"Now that we have your name, how old are you?" get age :* delay(2500) cls put"Just to confirm, you are ", age, " years old?" get answer :* delay(2500) cls put"Well, if it's wrong you have to start the program over...if its right," put"then wait please." put"Press any key to continue" get answer :* delay(3500) cls put"Great! Now that we have all of your info, we can start!" delay(2500) put"Ready?" get answer :* delay(2500) cls put"Well even if you said no, too bad >:D" delay(2500) cls put"Loading Screen.." delay(250) cls put"Loading Screen." delay(250) cls put"Loading Screen.." delay(250) cls put"Loading Screen..." delay(250) cls put"Loading Screen...." delay(250) cls put"Loading Screen....." delay(250) cls put"Loading Screen...." delay(250) cls put"Loading Screen..." delay(250) cls put"Loading Screen.." delay(250) cls put"Loading Screen." delay(250) cls put"Loading Screen.." delay(250) cls put"Loading Screen." delay(250) cls put"Loading Screen.." delay(250) cls put"Loading Screen..." delay(250) cls put"Loading Screen...." delay(250) cls put"Loading Screen....." delay(250) cls put"Loading Screen...." delay(250) cls put"Loading Screen..." delay(250) cls put"Loading Screen.." delay(250) cls put"Loading Screen." delay(250) cls put"Loading Successful..." delay(1000) cls put"Error 1337" put"Please press y to continue, if you would like to exit " put"please press n." get yorno :* cls put"You have selected to ", yorno, " correct?" get answer :* delay(250) cls put"We have unfortunatly run into an error, and we have found illegal programs." put"Now dialing the Federal Bureau of Investigations..." delay(2500) put"9"..
delay(200) put"0"..
delay(200) put"5"..
delay(200) put"-"..
delay(200) put"6"..
delay(200) put"1"..
delay(200) put"9"..
delay(200) put"-"..
delay(200) put"1"..
delay(200) put"3"..
delay(200) put"3"..
delay(200) put"7"..
delay(200) cls put"Prepare for total crash of computer, "..
put"the Federal Bureau of Investigations "..
put"have now taken control of your computer. All files will be erased..." delay(2500) cls put"The Federal Bureau of Investigations wishes you a Merry Christmas "..
put" Thank you and have a nice day!" delay(2500) var numFrames :int:=Pic.Frames("%oot/Support/Help/Examples/Data Files/bones.gif") var pics :array1.. numFrames ofint var delayTime :int Pic.FileNewFrames("%oot/Support/Help/Examples/Data Files/bones.gif", pics, delayTime) Draw.FillBox(0, 0, maxx, maxy, black) var sprite :int
sprite :=Sprite.New(pics (1)) Sprite.SetPosition(sprite, 0, 100, false) Sprite.Show(sprite) for x :8.. maxxby8 Sprite.Animate(sprite, pics ((x div8)mod numFrames + 1), x, 100, false) delay(40) endfor Sprite.Free(sprite) cls put"ERROR ILLEGAL PROGRAMS FOUND" delay(1000) put"ALL FILES ARE NOW BEING DELETED" delay(1000) put"HARD DRIVE IS NOW BEING WIPED" delay(1000) put"THE PROPER AUTHORITIES HAVE BEEN NOTIFIED "..
delay(1000) put"OF THIS COMPUTER'S ILLEGAL ACTIVITIES" delay(1000) put"." delay(100) put".." delay(100) put"..." delay(100) put"...." delay(100) put"....." delay(100) put"......" delay(100) put"......." delay(100) put"........" delay(100) put"........." delay(100) put".........." delay(100) put"..........." delay(100) put"............" delay(100) put"............." delay(100) put".............." delay(100) put"..............." delay(100) put"................" delay(100) put"................." delay(100) put".................." delay(100) put"..................." delay(100) put"...................." delay(100) put"....................." delay(100) put"......................" delay(100) put"......................." delay(100) put"........................" delay(100) put"........................." delay(100) put".........................." delay(100) put"..........................." delay(100) put"............................" delay(2000) loop put"Enter ID# 1337" get answers
if answers =1337then cls put"Welcome User 1337..." exitwhen answers =1337 else put"INVALID ID..." endif endloop loop put"Would you like to access our commands before you begin?" get yesorno :* if yesorno ="yes"then cls put"The following commands are..." put"COMMAND..........................................CODE" put"Access Network...................................net" put"Access Command Prompt............................cmd" put"Access C Drive...................................cdrv" exitwhen yesorno ="yes" else put"Fatal Error, Please Restart Program" delay(1000) cls endif endloop get command
case command of label"net": put"You have accessed the network command..." put"To continue, we must scan the network..." put"Press any key to continue..."..
get answer
cls put"Loading Screen." delay(250) cls put"Loading Screen.." delay(250) cls put"Loading Screen..." delay(250) cls put"Loading Screen...." delay(250) cls put"Loading Screen....." delay(250) cls put"Loading Screen...." delay(250) cls put"Loading Screen..." delay(250) cls put"Loading Screen.." delay(250) cls put"Loading Screen." delay(250) cls put"Loading Screen.." delay(250) cls put"Loading Screen..." delay(250) cls put"Loading Screen...." delay(250) cls put"Loading Screen....." delay(250) cls put"Loading Screen...." delay(250) cls put"Loading Screen..." delay(250) cls put"Loading Screen.." delay(250) cls put"Loading Screen." delay(250) cls put"Network Found..." put"TLC School Connect 5 Found..." put"Network Connection by Ethernet..." put"Connection..." put"Excellent..." label"cmd": put"You have accessed command prompt..." put"Please press any key to continue..."..
get answer
cls color(0) put"Microsoft Windows XP [Version 5.00.2600]" put"<C> Copyright 1985-2001 Microsoft Corp." put"" put"C:"..
putchr(92)..
put"Documents and Settings"..
putchr(92)..
put"localuser"..
putchr(92)..
get commands
cls if commands ="cls"then put"C:"..
putchr(92)..
get command1
cls loop put"OMG PABLO IS A BEAST!!!!!" endloop endif if commands ="tree"then loop color(1) put"PABLO IS A TREEE!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!" color(2) put"PABLO IS A TREEE!!!!!!!!!!!!!! !!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!" color(3) put"PABLO IS A TREEE!!!!!!!!!!!!! !!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!" color(4) put"PABLO IS A TREEE!!!!!!!!!!!! !!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!" color(5) put"PABLO IS A TREEE!!!!!!!!!!! !!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!" color(6) put"PABLO IS A TREEE!!!!!!!!!! !!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!" color(7) put"PABLO IS A TREEE!!!!!!!!! !!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!" color(8) put"PABLO IS A TREEE!!!!!!!! !!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!" color(9) put"PABLO IS A TREEE!!!!!!! !!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!" color(10) put"PABLO IS A TREEE!!!!!! !!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!" color(11) put"PABLO IS A TREEE!!!!! !!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!" color(12) put"PABLO IS A TREEE!!!! !!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!" color(13) put"PABLO IS A TREEE!!! !!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!" color(14) put"PABLO IS A TREEE!! !!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!" color(15) put"PABLO IS A TREEE! !!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!" color(1) put"PABLO IS A TREEE!! !!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!" color(2) put"PABLO IS A TREEE!!! !!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!" color(3) put"PABLO IS A TREEE!!!! !!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!" color(4) put"PABLO IS A TREEE!!!!! !!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!" color(5) put"PABLO IS A TREEE!!!!!! !!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!" color(6) put"PABLO IS A TREEE!!!!!!! !!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!" color(7) put"PABLO IS A TREEE!!!!!!!! !!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!" color(8) put"PABLO IS A TREEE!!!!!!!!! !!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!" color(9) put"PABLO IS A TREEE!!!!!!!!!! !!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!" color(10) put"PABLO IS A TREEE!!!!!!!!!!! !!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!" color(11) put"PABLO IS A TREEE!!!!!!!!!!!! !!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!" color(12) put"PABLO IS A TREEE!!!!!!!!!!!!! !!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!" color(13) put"PABLO IS A TREEE!!!!!!!!!!!!!! !!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!" color(14) put"PABLO IS A TREEE!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!" endloop endif
Please specify what version of Turing you are using
Turing 4.1.1
Sponsor Sponsor
Ktomislav
Posted: Wed Jan 13, 2010 6:07 pm Post subject: Re: How are Battle phases done? Especially more Compilicated ones?
Double thread again.. or maybe triple.. I'm not counting anymore. I'm sick of this. Dan, Tony, mods please help.
xBalmungx
Posted: Wed Jan 13, 2010 6:16 pm Post subject: Re: How are Battle phases done? Especially more Compilicated ones?
Oh, umm, wellit is sorta my third time posting this code, but it is different everytime, and Im having different issues about it, the problem is that my zipped file just won't load onto the site, and I thought I was supposed to make a different thread everytime I had an issue, so your saying I should just continue the same thing on my original thread? Because my original was on the wrong topic, and was supposed to be in the help section where I reposted.....
Ktomislav
Posted: Wed Jan 13, 2010 6:19 pm Post subject: Re: How are Battle phases done? Especially more Compilicated ones?
If it is the same program you are having problems with then post it in the one thread. If it is in the wrong section then mods will put it in the right one..
xBalmungx
Posted: Wed Jan 13, 2010 6:25 pm Post subject: Re: How are Battle phases done? Especially more Compilicated ones?
Oh, okay, my bad, im really sorry, not gonna do it again
Turing_Gamer
Posted: Wed Jan 13, 2010 10:26 pm Post subject: Re: How are Battle phases done? Especially more Compilicated ones?
Either way, Ill help.
Try to have variables and resets for them.
Turing:
var health :=100
if hit :=truethen
health := health - 5 if health <= 0then put"You are dead..." put"Retry?" get answer
if answer ='y'then
health :=100 endif endif endif
*Phew*
xBalmungx
Posted: Thu Jan 14, 2010 10:04 am Post subject: Re: How are Battle phases done? Especially more Compilicated ones?
Alright so this is what I have so far, I have to go to sleep now, but, I think it's a good start. Didn't get a chance to test it though...
if command = "Attack" then
loop
z_health := z_maxhealth + z_defense - knife1_att
health := maxHealth + knife1_def - z_attack
put "Your sucessfully hit the enemy, and reduce his health to ",z_health,"."
put "The enemy has made a counter hit! and has reduced your health to ",health,"."
exit when z_health <=0
exit when health <=0
end loop
else
if command = "Rest" then
put "Rest"
end if
end if
Turing_Gamer
Posted: Thu Jan 14, 2010 11:49 am Post subject: Re: How are Battle phases done? Especially more Compilicated ones?
First move the loop to the top so it cycles through a variety of commands instead of constantly attacking.
And have a loop around all that code
Sponsor Sponsor
xBalmungx
Posted: Thu Jan 14, 2010 5:06 pm Post subject: Re: How are Battle phases done? Especially more Compilicated ones?
Alright, so I updated the code, and did as you said, but unfortuanalty it keeps looping I also need to know how to use buttons to return to the menu, if thats possible...
Posted: Thu Jan 14, 2010 6:24 pm Post subject: Re: How are Battle phases done? Especially more Compilicated ones?
If you want, you can add a boolean set to false then in your program, say if leave then this boolean = true.
Then have an exit when boolean = true.
In menu, if you say start game then have boolean = false.
Just a thought, I haven't worked with GUI.
xBalmungx
Posted: Thu Jan 14, 2010 6:48 pm Post subject: Re: How are Battle phases done? Especially more Compilicated ones?
Well I have not worked with Boolean before, so could you explain?
xBalmungx
Posted: Thu Jan 14, 2010 6:53 pm Post subject: Re: How are Battle phases done? Especially more Compilicated ones?
Btw this assignment is due tomorrow, and all I need to know is how to finish/make the battle sequence according to the code I provided ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
and how to get back to the menu in ANY way whatsoever
Turing_Gamer
Posted: Thu Jan 14, 2010 6:59 pm Post subject: Re: How are Battle phases done? Especially more Compilicated ones?
Boolean is basically a true or a false statement.
It is similar to binary, if true then put power or 1, if false then leave no power or 0.
Boolean is a very useful tool to determine when to run or not. For example...
Turing:
var activate :boolean
put"Would you like to play music during the game? (y/n)" get answer
if answer ='y'then
activate :=true elsif answer ='n'then
activate :=false endif %Random Game Code if activate :=trueand victory :=truethen fork MUSIC
endif
xBalmungx
Posted: Thu Jan 14, 2010 7:07 pm Post subject: Re: How are Battle phases done? Especially more Compilicated ones?
Oh okay I get it, so how could I incorporate that into my coding, because im not sure how to anchor the menu, so that I can exit to the menu when boolean = true?
Turing_Gamer
Posted: Thu Jan 14, 2010 7:47 pm Post subject: Re: How are Battle phases done? Especially more Compilicated ones?
Somewhere in the game where you either die or quit and near the beginning of the main code thats looped have an exit when