Yeah, my Elven Relations combat minigame is mostly written in Python, but most of the Python is Ren'Py calls ^^;;
So the code looks like this kind of thing:
Code: Select all
menu:
"%(EnemyName)s moves to attack %(EnemyTargetName)s ! What should I do?"
"Counterattack %(EnemyName)s":
$ AllyTimeGauges[A_Takuya] = 0.0
$ TmpEnemyPos = PositionBasedOn(0.8, AllyPos, 0.2, EnemyPos)
$ TmpMePos = PositionBasedOn(0.8, AllyPos, 0.2, MePos)
$ renpy.show( (EnemyTargetName, "defend"))
$ renpy.show( (EnemyName, "attack"), at_list = [CombatPosition(TmpEnemyPos)])
$ renpy.show( ("Takuya", "attack"), at_list = [CombatPosition(TmpMePos)])
with move
$ EnemyPower = EnemyStrengths[ThisEnemy]
if EnemyTarget == A_Takuya:
"As %(EnemyName)s hits me, I strike with my sword."
"I take %(EnemyPower)d damage. I deal %(MyPower)d damage to %(EnemyName)s."
else:
"As %(EnemyName)s hits %(EnemyTargetName)s, I strike with my sword."
"%(EnemyTargetName)s takes %(EnemyPower)d damage. I deal %(MyPower)d damage to %(EnemyName)s."
$ AllyHealths[EnemyTarget] -= EnemyPower
$ EnemyHealths[ThisEnemy] -= MyPower
call ES_CheckHealths
So all the user interaction is just Ren'Py menus, and all the showing and moving of images is taken care of by the Ren'Py functions like
Code: Select all
$ renpy.show( (EnemyName, "attack"), at_list = [CombatPosition(TmpEnemyPos)])
I had to write the little CombatPosition() and PositionBasedOn() functions myself, but they're only about two lines each...