[SOLVED] JRPG

So I want to make a simple JRPG with 1on1 turn-based battles, a “party” of 4 players (next player after current players HP<1), monsters and items.
So I got some noob questions about how to do this stuff.
For example turns.
pseudocode:

# after all the assets are loaded...
def chooseTurns():
        if playerSpeed > enemySpeed:
                playerTurn()
        elif playerSpeed < enemySpeed:
                enemyTurn()
        else: #if equal
                random.randint(0,1)
                if random == 0:
                        playerTurn()
                elif random == 1:
                        enemyTurn()
                else:
                        playerTurn() #error or somethin

Its bad is it? :frowning:

And this is the turn (pseudo) functions

def playerTurn():
	def chooseMove():
                # add buttons for attacks and stuff
                # atttack function
                
                if enemyHP < 1:
                    victory()
                else:
                    enemyTurn()

	chooseMove()
			
def enemyTurn():
    # AI chooses a move (actually with random numbers)
    # and attacks

    if yourHp < 1:
		if playerTeam < 1:
			youLoose()
	        else:
			nextTeamMember()
    else:
		playerTurn()

Well thats the best way I could think of (dont laugh).

Another question I got: how would you store item information. Im thinking of potions that heal HP, MP, status, and key items.

And also the players team (humans) and monsters are different, but they all have the same characteristics: all have names, hp, mp, attack power, defence power and speed power. Should I use classes for these?

if the code works for you. it’s just fine.
about using classes. that’s the very reason classes where invented. to keep things which belong closely together in one container.

The stats for players and monsters is something you definitely want to use classes for. It will help you out immensely and will be very easy to do. You just need to make a class definition that looks like this:

class Hero:
     def __init__(self):
          self.HP = 100
          self.MP = 100
          self.Attacks = [attack1, attack2, attack3]

And then you can create an instance of the class and access all of it’s info very easily.

badassKnight = Hero()
badassKnight.HP = badass.Knight.HP - 30
Attack = badassKnight.Attack[2]