# player turn elif playerTurn: # picking a unit to attack if currentState == states.selectingAttack: if event.type == pygame.KEYDOWN and event.key == pygame.K_z: currentState = states.attacking myBattleForcast.roll() if event.type == pygame.KEYDOWN and (event.key == pygame.K_RIGHT or event.key == pygame.K_UP): if attackUnitIndex < len(unitsInRange) - 1: attackUnitIndex += 1 else: attackUnitIndex = 0 defendingUnit = unitsInRange[attackUnitIndex] mainCursor.X = defendingUnit.X mainCursor.Y = defendingUnit.Y myBattleForcast.calculate(currentUnit, defendingUnit, findTilesInAttackRange, currentMap) if event.type == pygame.KEYDOWN and (event.key == pygame.K_LEFT or event.key == pygame.K_DOWN): if attackUnitIndex > 0: attackUnitIndex -= 1 else: attackUnitIndex = len(unitsInRange)-1 defendingUnit = unitsInRange[attackUnitIndex] mainCursor.X = defendingUnit.X mainCursor.Y = defendingUnit.Y myBattleForcast.calculate(currentUnit, defendingUnit, findTilesInAttackRange, currentMap) if event.type == pygame.KEYDOWN and event.key == pygame.K_x: currentState = states.selectingWeapon