As Winkleink said, the Invent With Pygame stuff is awesome; tons of good hands-on examples. The author is very cool and will probably help you out or recommend a blog post if you have specific questions on how something works. Â
http://inventwithpython.com/
For troop movement, if you're making a grid-based game, I recommend this tile map tutorial: Â
http://sheep.art.pl/Tiled%20Map%20in%20PyGame
That will help you understand how to break up an area into 'cells'.
For combat, again, you just need to break things down:
- Characters need data for HP, Attack Power, Accuracy, Dodge Chance, Defense
- Use something like:
- # see if the attacker hits the defender (there are a LOT of ways to do this)
- hit = False
- if ( random.randint( 0, 100 ) +Âattacker.accuracy ) > defender.DodgeChance:
- # If the attack hits, lower the defender's HP, adjusting the damage by the defender's defense
- if hit:
- damage = attacker.attack_power - defender.defense
- if damage >= 0:
- # check if the defender is dead; if so, remove hide sprite, etc.,
- if defender.hp <= 0: