Install Steam
login
|
language
简体中文 (Simplified Chinese)
繁體中文 (Traditional Chinese)
日本語 (Japanese)
한국어 (Korean)
ไทย (Thai)
Български (Bulgarian)
Čeština (Czech)
Dansk (Danish)
Deutsch (German)
Español - España (Spanish - Spain)
Español - Latinoamérica (Spanish - Latin America)
Ελληνικά (Greek)
Français (French)
Italiano (Italian)
Bahasa Indonesia (Indonesian)
Magyar (Hungarian)
Nederlands (Dutch)
Norsk (Norwegian)
Polski (Polish)
Português (Portuguese - Portugal)
Português - Brasil (Portuguese - Brazil)
Română (Romanian)
Русский (Russian)
Suomi (Finnish)
Svenska (Swedish)
Türkçe (Turkish)
Tiếng Việt (Vietnamese)
Українська (Ukrainian)
Report a translation problem
The heading for the combat function might look like this:
def enterCombat(player,enemy):
Then all you have to do is write the rest of the functions for combat in that file, something like:
def attack(attacker,target):
target.health -= attacker.attack
print "%s lost %i health from %s , %s has %i health remaining" -->(target.name,attacker.attack,attacker.name,target.name,target.health)
*--> means auto wrap
There is most likely a few syntax errors as i have never done any python before and i made this short bit of code from looking at what you wrote and looking at the syntax and documentation online.
Edit: Lol --> makes a hyperlink on the steam client.
It would go back to the function you called it from once it was completed automatically, for example in main if i called
enterCombat(player,enemy)
after that function finished it would go back to main, i dont understand what you mean by "switching" between codes.Programming does not work that way, the python interpreter interprets each line of code in your program one line at a time, it does not matter where the line comes from as long as it has a valid line to interpret and quiting has not been requested it will continue to do so. Are you kind of new to programming?(not that there is anything wrong with that becuase we all got to start somewhere, it would just make sense that you would ask these kinds of questions if you where new to it).