The Challenge: -Develop a turn based combat system that implements the following choices that occur during the player's turns:
--Fight (Straight Damage)
--Item (Use an object from a choice of your design)
--Ability (Use an ability from a choice of your design)
--Run (Flee the battle)
The Deadline: - 2010-07-01 00:00
The rest is up to you.
Name:
Anonymous2010-06-30 10:24
>>39
For one, you don't have a main, you have WinMain. That's the whole point of SDL's main fuckery, it's so your app can consistently have a main() function with the same prototype, even on Windows.
Are you sure you're trying to link it as a GUI application? You need a switch for that, I don't remember what it is though.
>>41
For one, you don't have a WinMain, you have a _tWinMain. That's the whole point of WIN32's main fuckery, it's so your app can consistently have a main() function with the same prototype, even when using Unicode.
>>23
>expert programmers
please don't tell me i qualify as an expert programmer from learning programming from google since i was 13, im almost 16 now.
programming a basic pokemans battle system is just 1 step above hello world.
>>41
By default, if you use main the code compiles as a console application, and if you use WinMain the code compiles as a GUI application.
And I'm talking about compiling without no fancy-pants IDEs.
Uhh.. I see an overabundance of C progams. No python anywhere.
I wrote my own python version of this.. Too bad I am horrible at python. This is really simple and not anywhere near as elaborate as some of these other scripts. It's more of a simple "press this button and see what hapens" kind of battle
# I know - This is pretty shitty.
# But I am a beginner python programmer
# And I just wanted to contribute to the challenge.
# If you must criticize, please keep it constructive :)
import random
print ">:3";
c = raw_input("You encounter a lion! What do? [F]ight / [I]tem / [R]un / [M]agic ")
dmg = random.randint(1, 10)
if c == "f":
if dmg > 5:
print "What a powerful blow! You win!"
raw_input("press [enter] to continue")
else:
print "Oooh.. Your attack power of ",dmg," was not strong enough."
print "The lion has torn you to shreds."
raw_input("press [enter] to continue")
elif c == "i":
i = raw_input("Inventory:\n1. SICP\n2. Lion Trap\nWhat do you choose? ")
if i == "1":
print "You read SICP to the lion.. He get's bored and walks away!"
print "You are technically victorious."
raw_input("press [enter] to continue")
elif i == "2":
print "Surprisingly, the lion trap failed.. This lion is pretty smart!"
print "The lion has decapitated you!"
raw_input("press [enter] to continue")
else:
print "While you were typing in the wrong command the lion bit your legs off."
raw_input("press [enter] to continue")
elif c == "r":
print "You quickly got in the car!"
raw_input("press [enter] to continue")
elif c == "m":
print "You summon the almighty progsnake!"
print "the snake wraps around the lion and kills it!"
raw_input("press [enter] to continue")
else:
print "While you were typing in the wrong command the lion dragged you off to his herd."
raw_input("press [enter] to continue")
>>55 print "Oooh.. Your attack power of ",dmg," was not strong enough."
This will output more spaces around dmg than you want it to. Remove the last space in the first string and the first space in the last, or replace the commas with +s.
(And put spaces after your commas, for fuck's sake. You're writing Python, not PHP.)
>>74
In Python 3, and 2.x with the future feature imported, print is a function. Get used to it.
The other paren is stylistic, I find it's way too easy to write something like print("blah %d blah blah" % x)
and then later adapt the line to add y, forgetting to make the RHS value a tuple: print("blah %d blah %d blah" % x, y)
Which of course doesn't work. This is especially bad if your first value is a tuple and you're using %r or %s to print a tuple, because then you won't even get an error message, it'll just work -- incorrectly. Better off putting that extra set of parentheses around your values every time you %-substitute.